Browse Source

Lot of identifier renames in anticipation of session not always being a remote session

Source commit: 5493b1a58e0471358556a4ede802dd2e5266cefc
Martin Prikryl 5 years ago
parent
commit
3f53897447

+ 86 - 73
source/forms/CustomScpExplorer.cpp

@@ -331,7 +331,7 @@ __fastcall TCustomScpExplorerForm::~TCustomScpExplorerForm()
     // it to be stored
     StoreParams();
   }
-  Terminal = NULL;
+  ManagedSession = NULL;
   Queue = NULL;
   DebugAssert(NonVisualDataModule && (NonVisualDataModule->ScpExplorer == this));
   NonVisualDataModule->ScpExplorer = NULL;
@@ -353,7 +353,7 @@ __fastcall TCustomScpExplorerForm::~TCustomScpExplorerForm()
   SAFE_DESTROY(FDocks);
 
   SessionsPageControl->Images = NULL;
-  // only after clearing Terminal (after TerminalListChanged => ... => AddSessionColor is called)
+  // only after clearing Terminal (after SessionListChanged => ... => AddSessionColor is called)
   SAFE_DESTROY(FSessionColors);
   SAFE_DESTROY(FSessionsDragDropFilesEx);
 
@@ -383,7 +383,7 @@ void __fastcall TCustomScpExplorerForm::RefreshPanel(const UnicodeString & Sessi
   TTerminalManager * Manager = TTerminalManager::Instance();
   for (int Index = 0; Index < Manager->Count; Index++)
   {
-    TTerminal * Terminal = Manager->Terminals[Index];
+    TTerminal * Terminal = Manager->Sessions[Index];
     if (Session.IsEmpty() ||
         Manager->IsActiveTerminalForSite(Terminal, Data.get()))
     {
@@ -515,7 +515,7 @@ bool __fastcall TCustomScpExplorerForm::CommandLineFromAnotherInstance(
       if (DataList->Count > 0)
       {
         TTerminalManager * Manager = TTerminalManager::Instance();
-        Manager->ActiveTerminal = Manager->NewTerminals(DataList.get());
+        Manager->ActiveSession = Manager->NewTerminals(DataList.get());
       }
     }
     __finally
@@ -526,18 +526,33 @@ bool __fastcall TCustomScpExplorerForm::CommandLineFromAnotherInstance(
   return Result;
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::SetTerminal(TManagedTerminal * value)
+TManagedTerminal * TCustomScpExplorerForm::GetTerminal()
 {
-  if (FTerminal != value)
+  TManagedTerminal * Result;
+  if ((FManagedSession != NULL) && !FManagedSession->LocalBrowser)
+  {
+    Result = FManagedSession;
+  }
+  else
+  {
+    Result = NULL;
+  }
+  return Result;
+}
+//---------------------------------------------------------------------------
+void __fastcall TCustomScpExplorerForm::SetManagedSession(TManagedTerminal * value)
+{
+  if (FManagedSession != value)
   {
     TerminalChanging();
-    DoSetTerminal(value, false);
+    DoSetManagedSession(value, false);
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::DoSetTerminal(TManagedTerminal * value, bool Replace)
+void __fastcall TCustomScpExplorerForm::DoSetManagedSession(TManagedTerminal * value, bool Replace)
 {
-  FTerminal = value;
+  DebugAssert(!Replace || ((value != NULL) && !value->LocalBrowser));
+  FManagedSession = value;
   bool PrevAllowTransferPresetAutoSelect = FAllowTransferPresetAutoSelect;
   FAllowTransferPresetAutoSelect = false;
   try
@@ -557,14 +572,14 @@ void __fastcall TCustomScpExplorerForm::DoSetTerminal(TManagedTerminal * value,
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::ReplaceTerminal(TManagedTerminal * value)
 {
-  DoSetTerminal(value, true);
+  DoSetManagedSession(value, true);
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::TerminalChanging()
 {
-  if (FTerminal != NULL)
+  if (ManagedSession != NULL)
   {
-    UpdateTerminal(Terminal);
+    UpdateTerminal(ManagedSession);
   }
 }
 //---------------------------------------------------------------------------
@@ -574,21 +589,19 @@ void __fastcall TCustomScpExplorerForm::TerminalChanged(bool Replaced)
   {
     UpdateSessionColor((TColor)Terminal->StateData->Color);
   }
-  TerminalListChanged();
-
-  DebugAssert(!IsLocalBrowserMode());
-  if (Replaced)
-  {
-    RemoteDirView->ReplaceTerminal(Terminal);
-  }
-  else
-  {
-    RemoteDirView->Terminal = Terminal;
-  }
-  NonVisualDataModule->ResetQueueOnceEmptyOperation();
+  SessionListChanged();
 
   if (Terminal != NULL)
   {
+    if (Replaced)
+    {
+      RemoteDirView->ReplaceTerminal(Terminal);
+    }
+    else
+    {
+      RemoteDirView->Terminal = Terminal;
+    }
+
     if (Terminal->Active)
     {
       Terminal->RefreshDirectory();
@@ -3792,8 +3805,8 @@ void __fastcall TCustomScpExplorerForm::ExecutedFileReload(
       (ExtractFileName(FileName), Data->SessionName)));
   }
 
-  TManagedTerminal * PrevTerminal = TTerminalManager::Instance()->ActiveTerminal;
-  TTerminalManager::Instance()->ActiveTerminal = Data->Terminal;
+  TManagedTerminal * PrevSession = TTerminalManager::Instance()->ActiveSession;
+  TTerminalManager::Instance()->ActiveSession = Data->Terminal;
   NonVisualDataModule->StartBusy();
   try
   {
@@ -3831,7 +3844,7 @@ void __fastcall TCustomScpExplorerForm::ExecutedFileReload(
   {
     NonVisualDataModule->EndBusy();
     // it actually may not exist anymore...
-    TTerminalManager::Instance()->ActiveTerminal = PrevTerminal;
+    TTerminalManager::Instance()->ActiveSession = PrevSession;
   }
 }
 //---------------------------------------------------------------------------
@@ -4110,7 +4123,7 @@ bool __fastcall TCustomScpExplorerForm::RemoteTransferDialog(TManagedTerminal *&
     }
     else
     {
-      TStrings * Sessions = TTerminalManager::Instance()->TerminalList;
+      TStrings * Sessions = TTerminalManager::Instance()->SessionList;
       TStrings * Directories = new TStringList;
       try
       {
@@ -4181,7 +4194,7 @@ bool __fastcall TCustomScpExplorerForm::RemoteTransferFiles(
 
         ProcessLocalDirectory(TempDir, Terminal->MakeLocalFileList, &MakeFileListParam);
 
-        TTerminalManager::Instance()->ActiveTerminal = Session;
+        TTerminalManager::Instance()->ActiveSession = Session;
 
         if (TemporaryFilesList->Count > 0)
         {
@@ -4522,7 +4535,7 @@ void __fastcall TCustomScpExplorerForm::KeyDown(Word & Key, Classes::TShiftState
       if (NonVisualDataModule->OpenSessionShortCut(i) == KeyShortCut)
       {
         KeyProcessed(Key, Shift);
-        TTerminalManager::Instance()->ActiveTerminalIndex = i;
+        TTerminalManager::Instance()->ActiveSessionIndex = i;
         return;
       }
     }
@@ -4876,7 +4889,7 @@ void __fastcall TCustomScpExplorerForm::DuplicateSession()
 
     TTerminalManager * Manager = TTerminalManager::Instance();
     TManagedTerminal * Terminal = Manager->NewManagedTerminal(SessionData.get());
-    Manager->ActiveTerminal = Terminal;
+    Manager->ActiveSession = Terminal;
   }
 }
 //---------------------------------------------------------------------------
@@ -4893,7 +4906,7 @@ void __fastcall TCustomScpExplorerForm::RenameSession()
 
     UpdateControls();
     // Add/Remove distinguishing paths from sessions of the same name.
-    TerminalListChanged();
+    SessionListChanged();
   }
 }
 //---------------------------------------------------------------------------
@@ -4963,7 +4976,7 @@ void __fastcall TCustomScpExplorerForm::OpenStoredSession(TSessionData * Data)
   {
     TTerminalManager * Manager = TTerminalManager::Instance();
     TManagedTerminal * Terminal = Manager->NewManagedTerminal(Data);
-    Manager->ActiveTerminal = Terminal;
+    Manager->ActiveSession = Terminal;
   }
 }
 //---------------------------------------------------------------------------
@@ -4979,7 +4992,7 @@ void __fastcall TCustomScpExplorerForm::DoOpenFolderOrWorkspace(const UnicodeStr
     FirstTerminal->Disconnected = true;
     FirstTerminal->DisconnectedTemporarily = true;
   }
-  Manager->ActiveTerminal = FirstTerminal;
+  Manager->ActiveSession = FirstTerminal;
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::OpenFolderOrWorkspace(const UnicodeString & Name)
@@ -6182,7 +6195,7 @@ bool __fastcall TCustomScpExplorerForm::SaveWorkspace(bool EnableAutoSave)
       if (SessionData->HasAnySessionPassword())
       {
         AnyNonStoredSessionWithPassword = true;
-        if (!Manager->Terminals[Index]->SessionData->IsWorkspace)
+        if (!Manager->Sessions[Index]->SessionData->IsWorkspace)
         {
           AnyNonStoredNonWorkspaceSessionWithPassword = true;
         }
@@ -6747,17 +6760,17 @@ void __fastcall TCustomScpExplorerForm::NeedSession(bool Startup)
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::TerminalListChanged()
+void __fastcall TCustomScpExplorerForm::SessionListChanged()
 {
-  TStrings * TerminalList = TTerminalManager::Instance()->TerminalList;
-  int ActiveTerminalIndex = TTerminalManager::Instance()->ActiveTerminalIndex;
+  TStrings * SessionList = TTerminalManager::Instance()->SessionList;
+  int ActiveSessionIndex = TTerminalManager::Instance()->ActiveSessionIndex;
 
-  Configuration->Usage->SetMax(L"MaxOpenedSessions", TerminalList->Count);
+  Configuration->Usage->SetMax(L"MaxOpenedSessions", SessionList->Count);
 
   SendMessage(SessionsPageControl->Handle, WM_SETREDRAW, 0, 0);
   try
   {
-    while ((SessionsPageControl->PageCount > TerminalList->Count + 1) ||
+    while ((SessionsPageControl->PageCount > SessionList->Count + 1) ||
            // Clear the design time unthemed tab
            ((SessionsPageControl->PageCount > 0) &&
             (dynamic_cast<TThemeTabSheet *>(SessionsPageControl->Pages[SessionsPageControl->PageCount - 1]) == NULL)))
@@ -6765,7 +6778,7 @@ void __fastcall TCustomScpExplorerForm::TerminalListChanged()
       delete SessionsPageControl->Pages[SessionsPageControl->PageCount - 1];
     }
 
-    for (int Index = 0; Index <= TerminalList->Count; Index++)
+    for (int Index = 0; Index <= SessionList->Count; Index++)
     {
       TThemeTabSheet * TabSheet;
       if (Index >= SessionsPageControl->PageCount)
@@ -6778,10 +6791,10 @@ void __fastcall TCustomScpExplorerForm::TerminalListChanged()
         TabSheet = DebugNotNull(dynamic_cast<TThemeTabSheet *>(SessionsPageControl->Pages[Index]));
       }
 
-      bool IsSessionTab = (Index < TerminalList->Count);
+      bool IsSessionTab = (Index < SessionList->Count);
       if (IsSessionTab)
       {
-        TTerminal * Terminal = dynamic_cast<TTerminal *>(TerminalList->Objects[Index]);
+        TTerminal * Terminal = dynamic_cast<TTerminal *>(SessionList->Objects[Index]);
         TabSheet->Tag = reinterpret_cast<int>(Terminal);
 
         UpdateSessionTab(TabSheet);
@@ -6803,7 +6816,7 @@ void __fastcall TCustomScpExplorerForm::TerminalListChanged()
     SendMessage(SessionsPageControl->Handle, WM_SETREDRAW, 1, 0);
   }
 
-  SessionsPageControl->ActivePageIndex = ActiveTerminalIndex;
+  SessionsPageControl->ActivePageIndex = ActiveSessionIndex;
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::UpdateNewSessionTab()
@@ -6818,7 +6831,7 @@ void __fastcall TCustomScpExplorerForm::UpdateNewSessionTab()
       UnicodeString();
 }
 //---------------------------------------------------------------------------
-TManagedTerminal * __fastcall TCustomScpExplorerForm::GetSessionTabTerminal(TTabSheet * TabSheet)
+TManagedTerminal * __fastcall TCustomScpExplorerForm::GetSessionTabSession(TTabSheet * TabSheet)
 {
   return reinterpret_cast<TManagedTerminal *>(TabSheet->Tag);
 }
@@ -6827,7 +6840,7 @@ void __fastcall TCustomScpExplorerForm::UpdateSessionTab(TTabSheet * TabSheet)
 {
   if (DebugAlwaysTrue(TabSheet != NULL))
   {
-    TManagedTerminal * ATerminal = GetSessionTabTerminal(TabSheet);
+    TManagedTerminal * ATerminal = GetSessionTabSession(TabSheet);
     if (DebugAlwaysTrue(ATerminal != NULL))
     {
       TColor Color = (ATerminal == Terminal) ? FSessionColor : ATerminal->StateData->Color;
@@ -6848,11 +6861,11 @@ void __fastcall TCustomScpExplorerForm::UpdateSessionTab(TTabSheet * TabSheet)
 bool __fastcall TCustomScpExplorerForm::SessionTabSwitched()
 {
   DebugAssert(SessionsPageControl->ActivePage != NULL);
-  TManagedTerminal * Terminal = GetSessionTabTerminal(SessionsPageControl->ActivePage);
-  bool Result = (Terminal != NULL);
+  TManagedTerminal * Session = GetSessionTabSession(SessionsPageControl->ActivePage);
+  bool Result = (Session != NULL);
   if (Result)
   {
-    TTerminalManager::Instance()->ActiveTerminal = Terminal;
+    TTerminalManager::Instance()->ActiveSession = Session;
   }
   else
   {
@@ -6862,7 +6875,7 @@ bool __fastcall TCustomScpExplorerForm::SessionTabSwitched()
     }
     __finally
     {
-      TerminalListChanged();
+      SessionListChanged();
     }
 
     FSessionsPageControlNewSessionTime = Now();
@@ -7131,7 +7144,7 @@ void __fastcall TCustomScpExplorerForm::UpdatePixelsPerInchMainWindowCounter()
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::StartingDisconnected()
 {
-  TerminalListChanged();
+  SessionListChanged();
   InitStatusBar();
   UpdateControls();
 }
@@ -7257,7 +7270,7 @@ void __fastcall TCustomScpExplorerForm::ShowExtendedException(
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::TerminalReady()
+void __fastcall TCustomScpExplorerForm::SessionReady()
 {
   if (Terminal->Active)
   {
@@ -7267,8 +7280,8 @@ void __fastcall TCustomScpExplorerForm::TerminalReady()
   // as it can happen that active page is the "new session" page
   // (e.g. when reconnecting active terminal, while login dialog
   // invoked from "new session" page is modal)
-  int ActiveTerminalIndex = TTerminalManager::Instance()->ActiveTerminalIndex;
-  UpdateSessionTab(SessionsPageControl->Pages[ActiveTerminalIndex]);
+  int ActiveSessionIndex = TTerminalManager::Instance()->ActiveSessionIndex;
+  UpdateSessionTab(SessionsPageControl->Pages[ActiveSessionIndex]);
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::InactiveTerminalException(
@@ -7328,7 +7341,7 @@ void __fastcall TCustomScpExplorerForm::QueueEmptyNoteClicked(TObject * Sender)
       !NonVisualDataModule->Busy)
   {
     TManagedTerminal * Terminal = TerminalNoteData->Terminal;
-    TTerminalManager::Instance()->ActiveTerminal = Terminal;
+    TTerminalManager::Instance()->ActiveSession = Terminal;
     if (!ComponentVisible[fcQueueView])
     {
       ToggleQueueVisibility();
@@ -7725,7 +7738,7 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDTargetDrop()
       TPoint Point = SessionsPageControl->ScreenToClient(Mouse->CursorPos);
       int Index = SessionsPageControl->IndexOfTabAt(Point.X, Point.Y);
       // do not allow dropping on the "+" tab
-      TargetTerminal = GetSessionTabTerminal(SessionsPageControl->Pages[Index]);
+      TargetTerminal = GetSessionTabSession(SessionsPageControl->Pages[Index]);
       if (TargetTerminal != NULL)
       {
         if ((FLastDropEffect == DROPEFFECT_MOVE) &&
@@ -8458,7 +8471,7 @@ void __fastcall TCustomScpExplorerForm::PasteFromClipBoard()
       DebugAssert(!IsLocalBrowserMode());
       TTerminalManager * Manager = TTerminalManager::Instance();
       TTerminal * TergetTerminal = Manager->ActiveTerminal;
-      Manager->ActiveTerminal = FClipboardTerminal;
+      Manager->ActiveSession = FClipboardTerminal;
 
       ExecuteFileOperation(foRemoteCopy, osRemote, FClipboardFileList.get(), false, TergetTerminal);
     }
@@ -8710,7 +8723,7 @@ void __fastcall TCustomScpExplorerForm::UpdateControls()
     if (Terminal != NULL)
     {
       // Update path when it changes
-      if ((SessionsPageControl->ActivePage != NULL) && (GetSessionTabTerminal(SessionsPageControl->ActivePage) == Terminal))
+      if ((SessionsPageControl->ActivePage != NULL) && (GetSessionTabSession(SessionsPageControl->ActivePage) == Terminal))
       {
         UpdateSessionTab(SessionsPageControl->ActivePage);
       }
@@ -9798,7 +9811,7 @@ void __fastcall TCustomScpExplorerForm::DoFindFiles(
 {
   if (!NonVisualDataModule->Busy)
   {
-    TTerminalManager::Instance()->ActiveTerminal = DebugNotNull(dynamic_cast<TManagedTerminal *>(ATerminal));
+    TTerminalManager::Instance()->ActiveSession = DebugNotNull(dynamic_cast<TManagedTerminal *>(ATerminal));
     Configuration->Usage->Inc(L"FileFinds");
     LockWindow(true);
     NonVisualDataModule->StartBusy();
@@ -9820,7 +9833,7 @@ void __fastcall TCustomScpExplorerForm::DoFocusRemotePath(TTerminal * ATerminal,
 {
   if (!NonVisualDataModule->Busy)
   {
-    TTerminalManager::Instance()->ActiveTerminal = DebugNotNull(dynamic_cast<TManagedTerminal *>(ATerminal));
+    TTerminalManager::Instance()->ActiveSession = DebugNotNull(dynamic_cast<TManagedTerminal *>(ATerminal));
     SetFocus();
     RemoteDirView->Path = UnixExtractFilePath(Path);
     UnicodeString FileName = UnixExtractFileName(Path);
@@ -9846,7 +9859,7 @@ bool __fastcall TCustomScpExplorerForm::CanOperateOnFoundFiles(TTerminal * ATerm
   bool Result = !NonVisualDataModule->Busy;
   if (Result)
   {
-    TTerminalManager::Instance()->ActiveTerminal = DebugNotNull(dynamic_cast<TManagedTerminal *>(ATerminal));
+    TTerminalManager::Instance()->ActiveSession = DebugNotNull(dynamic_cast<TManagedTerminal *>(ATerminal));
   }
   return Result;
 }
@@ -9922,7 +9935,7 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlMouseDown(
         // starts, prevent that
         if (MilliSecondsBetween(Now(), FSessionsPageControlNewSessionTime) > 500)
         {
-          TTerminal * Terminal = GetSessionTabTerminal(SessionsPageControl->Pages[Index]);
+          TTerminal * Terminal = GetSessionTabSession(SessionsPageControl->Pages[Index]);
           if (Terminal != NULL)
           {
             SessionsPageControl->BeginDrag(false);
@@ -9933,7 +9946,7 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlMouseDown(
     else if (Button == mbMiddle)
     {
       // ignore middle-click for "New session tab"
-      TTerminal * Terminal = GetSessionTabTerminal(SessionsPageControl->Pages[Index]);
+      TTerminal * Terminal = GetSessionTabSession(SessionsPageControl->Pages[Index]);
       if (Terminal != NULL)
       {
         CloseSessionTab(Index);
@@ -9947,15 +9960,15 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlDragDrop(
 {
   int Index = SessionsPageControl->IndexOfTabAt(X, Y);
   // do not allow dropping on the "+" tab
-  TTerminal * TargetTerminal = GetSessionTabTerminal(SessionsPageControl->Pages[Index]);
+  TTerminal * TargetTerminal = GetSessionTabSession(SessionsPageControl->Pages[Index]);
   if ((TargetTerminal != NULL) &&
       (SessionsPageControl->ActivePage->PageIndex != Index))
   {
     Configuration->Usage->Inc(L"SessionTabMoves");
-    // this is almost redundant as we would recreate tabs in TerminalListChanged,
+    // this is almost redundant as we would recreate tabs in SessionListChanged,
     // but we want to actually prevent that to avoid flicker
     SessionsPageControl->ActivePage->PageIndex = Index;
-    TTerminal * Terminal = GetSessionTabTerminal(SessionsPageControl->ActivePage);
+    TTerminal * Terminal = GetSessionTabSession(SessionsPageControl->ActivePage);
     TTerminalManager::Instance()->Move(Terminal, TargetTerminal);
   }
 }
@@ -9968,7 +9981,7 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlDragOver(
   if (Accept)
   {
     int Index = SessionsPageControl->IndexOfTabAt(X, Y);
-    TTerminal * Terminal = GetSessionTabTerminal(SessionsPageControl->Pages[Index]);
+    TTerminal * Terminal = GetSessionTabSession(SessionsPageControl->Pages[Index]);
     // do not allow dragging to the "+" tab
     Accept = (Terminal != NULL);
   }
@@ -9984,7 +9997,7 @@ void __fastcall TCustomScpExplorerForm::SessionsDDDragOver(
   }
   else
   {
-    TTerminal * TargetTerminal = GetSessionTabTerminal(SessionsPageControl->Pages[Index]);
+    TTerminal * TargetTerminal = GetSessionTabSession(SessionsPageControl->Pages[Index]);
     // do not allow dropping on the "+" tab
     if (TargetTerminal == NULL)
     {
@@ -10002,13 +10015,13 @@ void __fastcall TCustomScpExplorerForm::SessionsDDProcessDropped(
 {
   int Index = SessionsPageControl->IndexOfTabAt(Point.X, Point.Y);
   // do not allow dropping on the "+" tab
-  TManagedTerminal * TargetTerminal = GetSessionTabTerminal(SessionsPageControl->Pages[Index]);
+  TManagedTerminal * TargetTerminal = GetSessionTabSession(SessionsPageControl->Pages[Index]);
   if (TargetTerminal != NULL)
   {
     DebugAssert(!IsFileControl(DropSourceControl, osRemote));
     if (!IsFileControl(DropSourceControl, osRemote))
     {
-      TTerminalManager::Instance()->ActiveTerminal = TargetTerminal;
+      TTerminalManager::Instance()->ActiveSession = TargetTerminal;
       RemoteFileControlDragDropFileOperation(SessionsPageControl, Effect,
         // Why don't we use Terminal->CurrentDirectory directly?
         TTerminalManager::Instance()->ActiveTerminal->CurrentDirectory,
@@ -10264,7 +10277,7 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlContextPopup(TObject
 {
   int Index = SessionsPageControl->IndexOfTabAt(MousePos.X, MousePos.Y);
   // no context menu for "New session tab"
-  if ((Index >= 0) && (GetSessionTabTerminal(SessionsPageControl->Pages[Index]) != NULL))
+  if ((Index >= 0) && (GetSessionTabSession(SessionsPageControl->Pages[Index]) != NULL))
   {
     SessionsPageControl->ActivePageIndex = Index;
 
@@ -10549,7 +10562,7 @@ void __fastcall TCustomScpExplorerForm::CloseSessionTab(int Index)
   else
   {
     TTabSheet * TabSheet = SessionsPageControl->Pages[Index];
-    TTerminal * Terminal = GetSessionTabTerminal(TabSheet);
+    TTerminal * Terminal = GetSessionTabSession(TabSheet);
     TTerminalManager * Manager = TTerminalManager::Instance();
     if (!Terminal->Active)
     {
@@ -10643,7 +10656,7 @@ void __fastcall TCustomScpExplorerForm::ClipboardDataObjectRelease(TObject * /*S
 void __fastcall TCustomScpExplorerForm::ClipboardDownload(const UnicodeString & TargetDirectory, bool NoConfirmation, bool DragDrop)
 {
   TTerminalManager * Manager = TTerminalManager::Instance();
-  Manager->ActiveTerminal = FClipboardTerminal;
+  Manager->ActiveSession = FClipboardTerminal;
 
   TTransferOperationParam Params;
   Params.TargetDirectory = TargetDirectory;

+ 9 - 7
source/forms/CustomScpExplorer.h

@@ -218,7 +218,7 @@ __published:
   void __fastcall QueueFileListResize(TObject *Sender);
 
 private:
-  TManagedTerminal * FTerminal;
+  TManagedTerminal * FManagedSession;
   TTerminalQueue * FQueue;
   TTerminalQueueStatus * FQueueStatus;
   TCriticalSection * FQueueStatusSection;
@@ -296,8 +296,9 @@ private:
 
   bool __fastcall GetEnableFocusedOperation(TOperationSide Side, int FilesOnly);
   bool __fastcall GetEnableSelectedOperation(TOperationSide Side, int FilesOnly);
-  void __fastcall SetTerminal(TManagedTerminal * value);
-  void __fastcall DoSetTerminal(TManagedTerminal * value, bool Replace);
+  void __fastcall SetManagedSession(TManagedTerminal * value);
+  void __fastcall DoSetManagedSession(TManagedTerminal * value, bool Replace);
+  TManagedTerminal * GetTerminal();
   void __fastcall SetQueue(TTerminalQueue * value);
   void __fastcall TransferListChange(TObject * Sender);
   void __fastcall TransferListDrawItem(TTBXCustomList * Sender, TCanvas * ACanvas,
@@ -644,7 +645,7 @@ protected:
   void __fastcall SetTaskbarListProgressState(TBPFLAG Flags);
   void __fastcall SetTaskbarListProgressValue(int Progress);
   void __fastcall SetTaskbarListProgressValue(TFileOperationProgressType * ProgressData);
-  TManagedTerminal * __fastcall GetSessionTabTerminal(TTabSheet * TabSheet);
+  TManagedTerminal * __fastcall GetSessionTabSession(TTabSheet * TabSheet);
   bool __fastcall SessionTabSwitched();
   void __fastcall RestoreApp();
   void __fastcall GoToQueue();
@@ -796,7 +797,7 @@ public:
   void __fastcall TerminalRemoved(TObject * Sender);
   void __fastcall TerminalDisconnected();
   void __fastcall TerminalConnecting();
-  void __fastcall TerminalListChanged();
+  void __fastcall SessionListChanged();
   void __fastcall ApplicationTitleChanged();
   unsigned int __fastcall MoreMessageDialog(const UnicodeString Message,
     TStrings * MoreMessages, TQueryType Type, unsigned int Answers,
@@ -808,7 +809,7 @@ public:
   UnicodeString __fastcall GetProgressTitle();
   void __fastcall ShowExtendedException(TTerminal * Terminal, Exception * E);
   void __fastcall InactiveTerminalException(TTerminal * Terminal, Exception * E);
-  void __fastcall TerminalReady();
+  void __fastcall SessionReady();
   void __fastcall QueueEvent(TManagedTerminal * Terminal, TTerminalQueue * Queue, TQueueEvent Event);
   void __fastcall QueueEmptyNoteClicked(TObject * Sender);
   bool __fastcall DoSynchronizeDirectories(
@@ -862,7 +863,8 @@ public:
   __property bool EnableFocusedFileOperation[TOperationSide Side] = { read = GetEnableFocusedOperation, index = 1 };
   __property bool EnableSelectedFileOperation[TOperationSide Side] = { read = GetEnableSelectedOperation, index = 1 };
   __property bool HasDirView[TOperationSide Side] = { read = GetHasDirView };
-  __property TManagedTerminal * Terminal = { read = FTerminal, write = SetTerminal };
+  __property TManagedTerminal * ManagedSession = { read = FManagedSession, write = SetManagedSession };
+  __property TManagedTerminal * Terminal = { read = GetTerminal };
   __property TTerminalQueue * Queue = { read = FQueue, write = SetQueue };
   __property TColor SessionColor = { read = FSessionColor, write = SetSessionColor };
 };

+ 2 - 2
source/forms/NonVisual.cpp

@@ -1535,7 +1535,7 @@ void __fastcall TNonVisualDataModule::CreateOpenedSessionListMenu(TAction * Acti
   TTBCustomItem * OpenedSessionsMenu = dynamic_cast<TTBCustomItem *>(Action->ActionComponent);
   DebugAssert(OpenedSessionsMenu != NULL);
   TTerminalManager * Manager = TTerminalManager::Instance();
-  TStrings * TerminalList = Manager->TerminalList;
+  TStrings * TerminalList = Manager->SessionList;
   int PrevCount = OpenedSessionsMenu->Count;
   for (int Index = 0; Index < TerminalList->Count; Index++)
   {
@@ -1559,7 +1559,7 @@ void __fastcall TNonVisualDataModule::CreateOpenedSessionListMenu(TAction * Acti
 //---------------------------------------------------------------------------
 void __fastcall TNonVisualDataModule::OpenedSessionItemClick(TObject * Sender)
 {
-  TTerminalManager::Instance()->ActiveTerminal = (TManagedTerminal*)(((TMenuItem *)Sender)->Tag);
+  TTerminalManager::Instance()->ActiveSession = (TManagedTerminal*)(((TMenuItem *)Sender)->Tag);
 }
 //---------------------------------------------------------------------------
 void __fastcall TNonVisualDataModule::CreateEditorListMenu(TTBCustomItem * Menu, bool OnFocused)

+ 1 - 1
source/forms/Preferences.cpp

@@ -2858,7 +2858,7 @@ void __fastcall TPreferencesDialog::AddCommandButtonDropDownClick(TObject * /*Se
 //---------------------------------------------------------------------------
 UnicodeString __fastcall TPreferencesDialog::GetSessionKey()
 {
-  TTerminal * Terminal = TTerminalManager::Instance()->ActiveTerminal;
+  TTerminal * Terminal = TTerminalManager::Instance()->ActiveSession;
   UnicodeString Result;
   if (Terminal != NULL)
   {

+ 82 - 68
source/windows/TerminalManager.cpp

@@ -30,7 +30,7 @@ TTerminalManager * TTerminalManager::FInstance = NULL;
 __fastcall TManagedTerminal::TManagedTerminal(TSessionData * SessionData,
   TConfiguration * Configuration) :
   TTerminal(SessionData, Configuration),
-  LocalExplorerState(NULL), RemoteExplorerState(NULL),
+  LocalBrowser(false), LocalExplorerState(NULL), RemoteExplorerState(NULL),
   ReopenStart(0), DirectoryLoaded(Now()), TerminalThread(NULL), Disconnected(false), DisconnectedTemporarily(false)
 {
   StateData = new TSessionData(L"");
@@ -65,7 +65,7 @@ __fastcall TTerminalManager::TTerminalManager() :
   TTerminalList(Configuration)
 {
   FQueueSection = new TCriticalSection();
-  FActiveTerminal = NULL;
+  FActiveSession = NULL;
   FScpExplorer = NULL;
   FDestroying = false;
   FTerminalPendingAction = tpNull;
@@ -93,7 +93,7 @@ __fastcall TTerminalManager::TTerminalManager() :
   DebugAssert(Configuration && !Configuration->OnChange);
   Configuration->OnChange = ConfigurationChange;
 
-  FTerminalList = new TStringList();
+  FSessionList = new TStringList();
   FQueues = new TList();
   FTerminationMessages = new TStringList();
   std::unique_ptr<TSessionData> DummyData(new TSessionData(L""));
@@ -118,7 +118,7 @@ __fastcall TTerminalManager::~TTerminalManager()
   delete FLocalTerminal;
   delete FQueues;
   delete FTerminationMessages;
-  delete FTerminalList;
+  delete FSessionList;
   CloseAutheticateForm();
   delete FQueueSection;
   ReleaseTaskbarList();
@@ -153,7 +153,7 @@ TTerminal * __fastcall TTerminalManager::CreateTerminal(TSessionData * Data)
   return CreateManagedTerminal(Data);
 }
 //---------------------------------------------------------------------------
-TManagedTerminal * __fastcall TTerminalManager::GetTerminal(int Index)
+TManagedTerminal * __fastcall TTerminalManager::GetSession(int Index)
 {
   return DebugNotNull(dynamic_cast<TManagedTerminal *>(TTerminalList::Terminals[Index]));
 }
@@ -197,7 +197,7 @@ TManagedTerminal * __fastcall TTerminalManager::DoNewTerminal(TSessionData * Dat
 TTerminal * __fastcall TTerminalManager::NewTerminal(TSessionData * Data)
 {
   TTerminal * Terminal = DoNewTerminal(Data);
-  DoTerminalListChanged();
+  DoSessionListChanged();
   return Terminal;
 }
 //---------------------------------------------------------------------------
@@ -226,7 +226,7 @@ TManagedTerminal * __fastcall TTerminalManager::NewTerminals(TList * DataList)
       Result = Terminal;
     }
   }
-  DoTerminalListChanged();
+  DoSessionListChanged();
   return Result;
 }
 //---------------------------------------------------------------------------
@@ -258,7 +258,7 @@ void __fastcall TTerminalManager::DoConnectTerminal(TTerminal * Terminal, bool R
   try
   {
     TTerminalThread * TerminalThread = new TTerminalThread(Terminal);
-    TerminalThread->AllowAbandon = (Terminal == FActiveTerminal);
+    TerminalThread->AllowAbandon = (Terminal == ActiveTerminal);
     try
     {
       if (ManagedTerminal != NULL)
@@ -293,15 +293,15 @@ void __fastcall TTerminalManager::DoConnectTerminal(TTerminal * Terminal, bool R
       TerminalThread->OnIdle = NULL;
       if (!TerminalThread->Release())
       {
-        if (!AdHoc && (DebugAlwaysTrue(Terminal == FActiveTerminal)))
+        if (!AdHoc && (DebugAlwaysTrue(Terminal == ActiveTerminal)))
         {
           // terminal was abandoned, must create a new one to replace it
           Terminal = ManagedTerminal = CreateManagedTerminal(new TSessionData(L""));
           SetupTerminal(Terminal);
           OwnsObjects = false;
-          Items[ActiveTerminalIndex] = Terminal;
+          Items[ActiveSessionIndex] = Terminal;
           OwnsObjects = true;
-          FActiveTerminal = ManagedTerminal;
+          FActiveSession = ManagedTerminal;
           // Can be NULL, when opening the first session from command-line
           if (FScpExplorer != NULL)
           {
@@ -353,7 +353,7 @@ bool __fastcall TTerminalManager::ConnectTerminal(TTerminal * Terminal)
 {
   bool Result = true;
   // were it an active terminal, it would allow abandoning, what this API cannot deal with
-  DebugAssert(Terminal != FActiveTerminal);
+  DebugAssert(Terminal != ActiveTerminal);
   try
   {
     DoConnectTerminal(Terminal, false, false);
@@ -381,7 +381,7 @@ bool __fastcall TTerminalManager::ConnectActiveTerminalImpl(bool Reopen)
     Result = false;
     try
     {
-      DebugAssert(ActiveTerminal);
+      DebugAssert(ActiveTerminal != NULL);
 
       DoConnectTerminal(ActiveTerminal, Reopen, false);
 
@@ -515,7 +515,7 @@ void __fastcall TTerminalManager::DisconnectActiveTerminal()
     ScpExplorer->TerminalDisconnected();
   }
   // disconnecting duplidate session removes need to distinguish the only connected session with short path
-  DoTerminalListChanged();
+  DoSessionListChanged();
 }
 //---------------------------------------------------------------------------
 void __fastcall TTerminalManager::ReconnectActiveTerminal()
@@ -555,7 +555,7 @@ void __fastcall TTerminalManager::FreeAll()
   {
     while (Count)
     {
-      FreeTerminal(Terminals[0]);
+      FreeTerminal(Sessions[0]);
     }
   }
   __finally
@@ -602,17 +602,17 @@ void __fastcall TTerminalManager::FreeTerminal(TTerminal * Terminal)
     {
       if ((Count > 0) && !FDestroying)
       {
-        TManagedTerminal * NewActiveTerminal = Terminals[Index < Count ? Index : Index - 1];
+        TManagedTerminal * NewActiveTerminal = Sessions[Index < Count ? Index : Index - 1];
         if (!NewActiveTerminal->Active && !NewActiveTerminal->Disconnected)
         {
           NewActiveTerminal->Disconnected = true;
           NewActiveTerminal->DisconnectedTemporarily = true;
         }
-        ActiveTerminal = NewActiveTerminal;
+        ActiveSession = NewActiveTerminal;
       }
       else
       {
-        ActiveTerminal = NULL;
+        ActiveSession = NULL;
       }
     }
     else
@@ -625,7 +625,7 @@ void __fastcall TTerminalManager::FreeTerminal(TTerminal * Terminal)
     delete Queue;
     delete Terminal;
 
-    DoTerminalListChanged();
+    DoSessionListChanged();
   }
 }
 //---------------------------------------------------------------------------
@@ -638,66 +638,80 @@ void __fastcall TTerminalManager::SetScpExplorer(TCustomScpExplorerForm * value)
     FScpExplorer = value;
     if (FScpExplorer)
     {
-      FScpExplorer->Terminal = ActiveTerminal;
+      FScpExplorer->ManagedSession = ActiveTerminal;
       FScpExplorer->Queue = ActiveQueue;
       UpdateTaskbarList();
     }
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TTerminalManager::SetActiveTerminal(TManagedTerminal * value)
+TManagedTerminal * TTerminalManager::GetActiveTerminal()
+{
+  TManagedTerminal * Result;
+  if ((ActiveSession != NULL) && !ActiveSession->LocalBrowser)
+  {
+    Result = ActiveSession;
+  }
+  else
+  {
+    Result = NULL;
+  }
+  return Result;
+}
+//---------------------------------------------------------------------------
+void __fastcall TTerminalManager::SetActiveSession(TManagedTerminal * value)
 {
-  DoSetActiveTerminal(value, false);
+  DoSetActiveSession(value, false);
 }
 //---------------------------------------------------------------------------
 void __fastcall TTerminalManager::SetActiveTerminalWithAutoReconnect(TManagedTerminal * value)
 {
-  DoSetActiveTerminal(value, true);
+  DoSetActiveSession(value, true);
 }
 //---------------------------------------------------------------------------
-void __fastcall TTerminalManager::DoSetActiveTerminal(TManagedTerminal * value, bool AutoReconnect)
+void __fastcall TTerminalManager::DoSetActiveSession(TManagedTerminal * value, bool AutoReconnect)
 {
-  if (ActiveTerminal != value)
+  if (ActiveSession != value)
   {
     // here used to be call to TCustomScpExporer::UpdateSessionData (now UpdateTerminal)
     // but it seems to be duplicate to call from TCustomScpExporer::TerminalChanging
 
-    TManagedTerminal * PActiveTerminal = ActiveTerminal;
-    FActiveTerminal = value;
+    TManagedTerminal * PActiveSession = ActiveSession;
+    FActiveSession = value;
     // moved from else block of next if (ActiveTerminal) statement
     // so ScpExplorer can update its caption
     UpdateAppTitle();
     if (ScpExplorer)
     {
-      if (ActiveTerminal && ((ActiveTerminal->Status == ssOpened) || ActiveTerminal->Disconnected))
+      if ((ActiveSession != NULL) && ((ActiveSession->Status == ssOpened) || ActiveSession->Disconnected))
       {
         TerminalReady();
       }
       else
       {
-        ScpExplorer->Terminal = NULL;
+        ScpExplorer->ManagedSession = NULL;
         ScpExplorer->Queue = NULL;
       }
     }
 
-    if (PActiveTerminal != NULL)
+    if (PActiveSession != NULL)
     {
-      if (PActiveTerminal->DisconnectedTemporarily && DebugAlwaysTrue(PActiveTerminal->Disconnected))
+      if (PActiveSession->DisconnectedTemporarily && DebugAlwaysTrue(PActiveSession->Disconnected))
       {
-        PActiveTerminal->Disconnected = false;
-        PActiveTerminal->DisconnectedTemporarily = false;
+        PActiveSession->Disconnected = false;
+        PActiveSession->DisconnectedTemporarily = false;
       }
 
-      if (!PActiveTerminal->Active)
+      if (!PActiveSession->Active)
       {
-        SaveTerminal(PActiveTerminal);
+        SaveTerminal(PActiveSession);
       }
     }
 
-    if (ActiveTerminal)
+    if (ActiveSession != NULL)
     {
-      int Index = ActiveTerminalIndex;
-      if (!ActiveTerminal->Active && !FTerminationMessages->Strings[Index].IsEmpty())
+      int Index = ActiveSessionIndex;
+      if (!ActiveSession->Active && !FTerminationMessages->Strings[Index].IsEmpty())
       {
         UnicodeString Message = FTerminationMessages->Strings[Index];
         FTerminationMessages->Strings[Index] = L"";
@@ -729,8 +743,8 @@ void __fastcall TTerminalManager::DoSetActiveTerminal(TManagedTerminal * value,
       }
     }
 
-    if ((ActiveTerminal != NULL) && !ActiveTerminal->Active &&
-        !ActiveTerminal->Disconnected)
+    if ((ActiveSession != NULL) && !ActiveSession->Active &&
+        !ActiveSession->Disconnected)
     {
       ConnectActiveTerminal();
     }
@@ -1326,9 +1340,9 @@ void __fastcall TTerminalManager::DoConfigurationChange()
   TTerminalQueue * Queue;
   for (int Index = 0; Index < Count; Index++)
   {
-    DebugAssert(Terminals[Index]->Log);
-    Terminals[Index]->Log->ReflectSettings();
-    Terminals[Index]->ActionLog->ReflectSettings();
+    DebugAssert(Sessions[Index]->Log);
+    Sessions[Index]->Log->ReflectSettings();
+    Sessions[Index]->ActionLog->ReflectSettings();
     Queue = reinterpret_cast<TTerminalQueue *>(FQueues->Items[Index]);
     SetQueueConfiguration(Queue);
   }
@@ -1354,31 +1368,31 @@ void __fastcall TTerminalManager::ConfigurationChange(TObject * /*Sender*/)
 //---------------------------------------------------------------------------
 void __fastcall TTerminalManager::TerminalReady()
 {
-  ScpExplorer->Terminal = ActiveTerminal;
+  ScpExplorer->ManagedSession = ActiveSession;
   ScpExplorer->Queue = ActiveQueue;
-  ScpExplorer->TerminalReady();
+  ScpExplorer->SessionReady();
 }
 //---------------------------------------------------------------------------
-TStrings * __fastcall TTerminalManager::GetTerminalList()
+TStrings * __fastcall TTerminalManager::GetSessionList()
 {
-  FTerminalList->Clear();
+  FSessionList->Clear();
   for (int i = 0; i < Count; i++)
   {
-    TManagedTerminal * Terminal = Terminals[i];
+    TManagedTerminal * Terminal = Sessions[i];
     UnicodeString Name = GetTerminalTitle(Terminal, true);
-    FTerminalList->AddObject(Name, Terminal);
+    FSessionList->AddObject(Name, Terminal);
   }
-  return FTerminalList;
+  return FSessionList;
 }
 //---------------------------------------------------------------------------
-int __fastcall TTerminalManager::GetActiveTerminalIndex()
+int __fastcall TTerminalManager::GetActiveSessionIndex()
 {
-  return ActiveTerminal ? IndexOf(ActiveTerminal) : -1;
+  return (ActiveSession != NULL) ? IndexOf(ActiveSession) : -1;
 }
 //---------------------------------------------------------------------------
-void __fastcall TTerminalManager::SetActiveTerminalIndex(int value)
+void __fastcall TTerminalManager::SetActiveSessionIndex(int value)
 {
-  ActiveTerminal = Terminals[value];
+  ActiveSession = Sessions[value];
 }
 //---------------------------------------------------------------------------
 UnicodeString __fastcall TTerminalManager::GetTerminalShortPath(TTerminal * Terminal)
@@ -1403,9 +1417,9 @@ UnicodeString __fastcall TTerminalManager::GetTerminalTitle(TTerminal * Terminal
     {
       for (int Index2 = 0; Index2 < Count; Index2++)
       {
-        UnicodeString Name = Terminals[Index2]->SessionData->SessionName;
-        if ((Terminals[Index2] != Terminal) &&
-            Terminals[Index2]->Active &&
+        UnicodeString Name = Sessions[Index2]->SessionData->SessionName;
+        if ((Sessions[Index2] != Terminal) &&
+            Sessions[Index2]->Active &&
             SameText(Name, Result))
         {
           UnicodeString Path = GetTerminalShortPath(Terminal);
@@ -1442,7 +1456,7 @@ TTerminalQueue * __fastcall TTerminalManager::GetActiveQueue()
   TTerminalQueue * Result = NULL;
   if (ActiveTerminal != NULL)
   {
-    Result = reinterpret_cast<TTerminalQueue *>(FQueues->Items[ActiveTerminalIndex]);
+    Result = reinterpret_cast<TTerminalQueue *>(FQueues->Items[ActiveSessionIndex]);
   }
   return Result;
 }
@@ -1451,7 +1465,7 @@ void __fastcall TTerminalManager::CycleTerminals(bool Forward)
 {
   if (Count > 0)
   {
-    int Index = ActiveTerminalIndex;
+    int Index = ActiveSessionIndex;
     Index += Forward ? 1 : -1;
     if (Index < 0)
     {
@@ -1461,7 +1475,7 @@ void __fastcall TTerminalManager::CycleTerminals(bool Forward)
     {
       Index = 0;
     }
-    ActiveTerminalIndex = Index;
+    ActiveSessionIndex = Index;
   }
 }
 //---------------------------------------------------------------------------
@@ -1547,7 +1561,7 @@ void __fastcall TTerminalManager::NewSession(const UnicodeString & SessionUrl, b
       }
       try
       {
-        ActiveTerminal = ANewTerminal;
+        ActiveSession = ANewTerminal;
       }
       __finally
       {
@@ -1586,7 +1600,7 @@ void __fastcall TTerminalManager::Idle(bool SkipCurrentTerminal)
 
   for (int Index = 0; Index < Count; Index++)
   {
-    TManagedTerminal * Terminal = Terminals[Index];
+    TManagedTerminal * Terminal = Sessions[Index];
     try
     {
       if (!SkipCurrentTerminal || (Terminal != ActiveTerminal))
@@ -1666,7 +1680,7 @@ void __fastcall TTerminalManager::Idle(bool SkipCurrentTerminal)
       // the session may not exist anymore
       if (Index >= 0)
       {
-        TManagedTerminal * Terminal = Terminals[Index];
+        TManagedTerminal * Terminal = Sessions[Index];
         // we can hardly have a queue event without explorer
         DebugAssert(ScpExplorer != NULL);
         if (ScpExplorer != NULL)
@@ -1703,17 +1717,17 @@ void __fastcall TTerminalManager::Move(TTerminal * Source, TTerminal * Target)
   int TargetIndex = IndexOf(Target);
   TTerminalList::Move(SourceIndex, TargetIndex);
   FQueues->Move(SourceIndex, TargetIndex);
-  DoTerminalListChanged();
+  DoSessionListChanged();
   // when there are indexed sessions with the same name,
   // the index may change when reordering the sessions
   UpdateAppTitle();
 }
 //---------------------------------------------------------------------------
-void __fastcall TTerminalManager::DoTerminalListChanged()
+void __fastcall TTerminalManager::DoSessionListChanged()
 {
   if (FScpExplorer != NULL)
   {
-    FScpExplorer->TerminalListChanged();
+    FScpExplorer->SessionListChanged();
   }
 }
 //---------------------------------------------------------------------------
@@ -1721,7 +1735,7 @@ void __fastcall TTerminalManager::SaveWorkspace(TList * DataList)
 {
   for (int Index = 0; Index < Count; Index++)
   {
-    TManagedTerminal * ManagedTerminal = Terminals[Index];
+    TManagedTerminal * ManagedTerminal = Sessions[Index];
     TSessionData * Data = StoredSessions->SaveWorkspaceData(ManagedTerminal->StateData, Index);
     DataList->Add(Data);
   }
@@ -1744,7 +1758,7 @@ TTerminal * __fastcall TTerminalManager::FindActiveTerminalForSite(TSessionData
   TTerminal * Result = NULL;
   for (int Index = 0; (Result == NULL) && (Index < Count); Index++)
   {
-    TTerminal * Terminal = Terminals[Index];
+    TTerminal * Terminal = Sessions[Index];
     if (IsActiveTerminalForSite(Terminal, Data))
     {
       Result = Terminal;

+ 16 - 13
source/windows/TerminalManager.h

@@ -21,6 +21,7 @@ public:
   __fastcall TManagedTerminal(TSessionData * SessionData, TConfiguration * Configuration);
   virtual __fastcall ~TManagedTerminal();
 
+  bool LocalBrowser;
   TSessionData * StateData;
   TObject * LocalExplorerState;
   TObject * RemoteExplorerState;
@@ -76,12 +77,13 @@ public:
   bool __fastcall UploadPublicKey(TTerminal * Terminal, TSessionData * Data, UnicodeString & FileName);
 
   __property TCustomScpExplorerForm * ScpExplorer = { read = FScpExplorer, write = SetScpExplorer };
-  __property TManagedTerminal * ActiveTerminal = { read = FActiveTerminal, write = SetActiveTerminal };
+  __property TManagedTerminal * ActiveSession = { read = FActiveSession, write = SetActiveSession };
+  __property TManagedTerminal * ActiveTerminal = { read = GetActiveTerminal };
   __property TTerminalQueue * ActiveQueue = { read = GetActiveQueue };
-  __property int ActiveTerminalIndex = { read = GetActiveTerminalIndex, write = SetActiveTerminalIndex };
-  __property TStrings * TerminalList = { read = GetTerminalList };
+  __property int ActiveSessionIndex = { read = GetActiveSessionIndex, write = SetActiveSessionIndex };
+  __property TStrings * SessionList = { read = GetSessionList };
   __property TTerminal * LocalTerminal = { read = FLocalTerminal };
-  __property TManagedTerminal * Terminals[int Index]  = { read=GetTerminal };
+  __property TManagedTerminal * Sessions[int Index]  = { read = GetSession };
 
 protected:
   virtual TTerminal * __fastcall CreateTerminal(TSessionData * Data);
@@ -91,11 +93,11 @@ protected:
 private:
   static TTerminalManager * FInstance;
   TCustomScpExplorerForm * FScpExplorer;
-  TManagedTerminal * FActiveTerminal;
+  TManagedTerminal * FActiveSession;
   TTerminal * FLocalTerminal;
   bool FDestroying;
   TTerminalPendingAction FTerminalPendingAction;
-  TStrings * FTerminalList;
+  TStrings * FSessionList;
   TList * FQueues;
   TStrings * FTerminationMessages;
   UnicodeString FProgressTitle;
@@ -119,8 +121,9 @@ private:
   bool __fastcall ConnectActiveTerminal();
   TTerminalQueue * __fastcall NewQueue(TTerminal * Terminal);
   void __fastcall SetScpExplorer(TCustomScpExplorerForm * value);
-  void __fastcall DoSetActiveTerminal(TManagedTerminal * value, bool AutoReconnect);
-  void __fastcall SetActiveTerminal(TManagedTerminal * value);
+  void __fastcall DoSetActiveSession(TManagedTerminal * value, bool AutoReconnect);
+  void __fastcall SetActiveSession(TManagedTerminal * value);
+  TManagedTerminal * GetActiveTerminal();
   void __fastcall UpdateAll();
   void __fastcall ApplicationException(TObject * Sender, Exception * E);
   void __fastcall ApplicationShowHint(UnicodeString & HintStr, bool & CanShow,
@@ -146,11 +149,11 @@ private:
   void __fastcall TerminalCustomCommand(TTerminal * Terminal, const UnicodeString & Command, bool & Handled);
   void __fastcall FreeAll();
   void __fastcall TerminalReady();
-  TStrings * __fastcall GetTerminalList();
-  int __fastcall GetActiveTerminalIndex();
+  TStrings * __fastcall GetSessionList();
+  int __fastcall GetActiveSessionIndex();
   TTerminalQueue * __fastcall GetActiveQueue();
   void __fastcall SaveTerminal(TTerminal * Terminal);
-  void __fastcall SetActiveTerminalIndex(int value);
+  void __fastcall SetActiveSessionIndex(int value);
   void __fastcall OperationFinished(::TFileOperation Operation, TOperationSide Side,
     bool Temp, const UnicodeString & FileName, bool Success,
     TOnceDoneOperation & OnceDoneOperation);
@@ -166,7 +169,7 @@ private:
   void __fastcall CreateTaskbarList();
   void __fastcall UpdateTaskbarList();
   void __fastcall AuthenticateFormCancel(TObject * Sender);
-  void __fastcall DoTerminalListChanged();
+  void __fastcall DoSessionListChanged();
   TManagedTerminal * __fastcall DoNewTerminal(TSessionData * Data);
   static void __fastcall TerminalThreadIdle(void * Data, TObject * Sender);
   void __fastcall SetQueueConfiguration(TTerminalQueue * Queue);
@@ -181,7 +184,7 @@ private:
   TRemoteFile * __fastcall CheckRights(
     TTerminal * Terminal, const UnicodeString & EntryType, const UnicodeString & FileName, bool & WrongRights);
   TManagedTerminal * __fastcall CreateManagedTerminal(TSessionData * Data);
-  TManagedTerminal * __fastcall GetTerminal(int Index);
+  TManagedTerminal * __fastcall GetSession(int Index);
 };
 //---------------------------------------------------------------------------
 #endif

+ 6 - 6
source/windows/WinMain.cpp

@@ -1148,7 +1148,7 @@ int __fastcall Execute()
 
             try
             {
-              DebugAssert(!TerminalManager->ActiveTerminal);
+              DebugAssert(TerminalManager->ActiveSession == NULL);
 
               bool CanStart;
               bool Browse = false;
@@ -1177,7 +1177,7 @@ int __fastcall Execute()
                   Terminal->SessionData->RemoteDirectory = L"";
                   Terminal->StateData->RemoteDirectory = Terminal->SessionData->RemoteDirectory;
                 }
-                TerminalManager->ActiveTerminal = Terminal;
+                TerminalManager->ActiveSession = Terminal;
                 CanStart = (TerminalManager->Count > 0);
               }
               else
@@ -1213,16 +1213,16 @@ int __fastcall Execute()
 
                   if (ParamCommand == pcUpload)
                   {
-                    Upload(TerminalManager->ActiveTerminal, CommandParams, UseDefaults);
+                    Upload(TerminalManager->ActiveSession, CommandParams, UseDefaults);
                   }
                   else if (ParamCommand == pcFullSynchronize)
                   {
-                    FullSynchronize(TerminalManager->ActiveTerminal, ScpExplorer,
+                    FullSynchronize(TerminalManager->ActiveSession, ScpExplorer,
                       CommandParams, UseDefaults);
                   }
                   else if (ParamCommand == pcSynchronize)
                   {
-                    Synchronize(TerminalManager->ActiveTerminal, ScpExplorer,
+                    Synchronize(TerminalManager->ActiveSession, ScpExplorer,
                       CommandParams, UseDefaults);
                   }
                   else if (ParamCommand == pcEdit)
@@ -1231,7 +1231,7 @@ int __fastcall Execute()
                   }
                   else if (!DownloadFile.IsEmpty())
                   {
-                    Download(TerminalManager->ActiveTerminal, DownloadFile,
+                    Download(TerminalManager->ActiveSession, DownloadFile,
                       UseDefaults);
                   }
                   else