Ver código fonte

Showing username and hostname in session tab tooltip

Source commit: bd115794c926d6238cc8182d8fc2b2626bddcb0d
Martin Prikryl 2 anos atrás
pai
commit
b1004a8a0e

+ 18 - 3
source/forms/CustomScpExplorer.cpp

@@ -11646,16 +11646,31 @@ UnicodeString TCustomScpExplorerForm::GetSessionPath(TManagedTerminal * ASession
   return Result;
 }
 //---------------------------------------------------------------------------
+UnicodeString TCustomScpExplorerForm::GetTabHintSessionDetails(TManagedTerminal * ASession)
+{
+  UnicodeString Title = TTerminalManager::Instance()->GetSessionTitle(ASession, false);
+  UnicodeString Result = ASession->SessionData->DefaultSessionName;
+  if (Title == Result)
+  {
+    Result = EmptyStr;
+  }
+  else
+  {
+    Result += L"\n";
+  }
+  return Result;
+}
+//---------------------------------------------------------------------------
 UnicodeString TCustomScpExplorerForm::GetTabHintDetails(TManagedTerminal * ASession)
 {
-  UnicodeString Result;
+  UnicodeString Result = GetTabHintSessionDetails(ASession);
   if (!ASession->Active)
   {
-    Result = LoadStr(STATUS_NOT_CONNECTED2);
+    Result += LoadStr(STATUS_NOT_CONNECTED2);
   }
   else
   {
-    Result = GetSessionPath(ASession, osRemote);
+    Result += GetSessionPath(ASession, osRemote);
   }
   return Result;
 }

+ 1 - 0
source/forms/CustomScpExplorer.h

@@ -745,6 +745,7 @@ protected:
   void __fastcall UpdateDarkMode();
   virtual UnicodeString GetTabHintDetails(TManagedTerminal * ASession);
   virtual UnicodeString GetNewTabHintDetails();
+  UnicodeString GetTabHintSessionDetails(TManagedTerminal * ASession);
   UnicodeString GetSessionPath(TManagedTerminal * ASession, TOperationSide Side);
   void __fastcall DirectorySizeCalculated(TOperationSide Side, const UnicodeString & FileName, bool Success);
   TListItem * VisualiseOperationFinished(TOperationSide Side, const UnicodeString & FileName, bool Unselect);

+ 7 - 3
source/forms/ScpCommander.cpp

@@ -2905,9 +2905,13 @@ int TScpCommanderForm::GetNewTabTabImageIndex(TOperationSide Side)
 UnicodeString TScpCommanderForm::GetTabHintDetails(TManagedTerminal * ASession)
 {
   UnicodeString Result;
+  if (!ASession->LocalBrowser)
+  {
+    Result = GetTabHintSessionDetails(ASession);
+  }
   if (!ASession->LocalBrowser && !ASession->Active)
   {
-    Result = LoadStr(STATUS_NOT_CONNECTED2);
+    Result += LoadStr(STATUS_NOT_CONNECTED2);
   }
   else
   {
@@ -2918,11 +2922,11 @@ UnicodeString TScpCommanderForm::GetTabHintDetails(TManagedTerminal * ASession)
     UnicodeString Sep = L"\n";
     if (!WinConfiguration->ScpCommander.SwappedPanels)
     {
-      Result = Local + Sep + Other;
+      Result += Local + Sep + Other;
     }
     else
     {
-      Result = Other + Sep + Local;
+      Result += Other + Sep + Local;
     }
   }
   return Result;