Ver código fonte

Bug 1183: Rename session tab

https://winscp.net/tracker/1183

Source commit: fd6633ce8ce5dcc0a869c06d5c9589a7fc99e700
Martin Prikryl 7 anos atrás
pai
commit
b6b6d07aab

+ 41 - 4
source/core/SessionData.cpp

@@ -271,6 +271,7 @@ void __fastcall TSessionData::Default()
 
 
   IsWorkspace = false;
   IsWorkspace = false;
   Link = L"";
   Link = L"";
+  NameOverride = L"";
 
 
   Selected = false;
   Selected = false;
   FModified = false;
   FModified = false;
@@ -431,7 +432,8 @@ void __fastcall TSessionData::NonPersistant()
   PROPERTY(CustomParam2);
   PROPERTY(CustomParam2);
 #define META_PROPERTIES \
 #define META_PROPERTIES \
   PROPERTY(IsWorkspace); \
   PROPERTY(IsWorkspace); \
-  PROPERTY(Link);
+  PROPERTY(Link); \
+  PROPERTY(NameOverride);
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
 void __fastcall TSessionData::Assign(TPersistent * Source)
 void __fastcall TSessionData::Assign(TPersistent * Source)
 {
 {
@@ -788,6 +790,7 @@ void __fastcall TSessionData::DoLoad(THierarchicalStorage * Storage, bool PuttyI
 
 
   IsWorkspace = Storage->ReadBool(L"IsWorkspace", IsWorkspace);
   IsWorkspace = Storage->ReadBool(L"IsWorkspace", IsWorkspace);
   Link = Storage->ReadString(L"Link", Link);
   Link = Storage->ReadString(L"Link", Link);
+  NameOverride = Storage->ReadString(L"NameOverride", NameOverride);
 
 
   CustomParam1 = Storage->ReadString(L"CustomParam1", CustomParam1);
   CustomParam1 = Storage->ReadString(L"CustomParam1", CustomParam1);
   CustomParam2 = Storage->ReadString(L"CustomParam2", CustomParam2);
   CustomParam2 = Storage->ReadString(L"CustomParam2", CustomParam2);
@@ -1119,6 +1122,7 @@ void __fastcall TSessionData::DoSave(THierarchicalStorage * Storage,
 
 
     WRITE_DATA(Bool, IsWorkspace);
     WRITE_DATA(Bool, IsWorkspace);
     WRITE_DATA(String, Link);
     WRITE_DATA(String, Link);
+    WRITE_DATA(String, NameOverride);
 
 
     WRITE_DATA(String, CustomParam1);
     WRITE_DATA(String, CustomParam1);
     WRITE_DATA(String, CustomParam2);
     WRITE_DATA(String, CustomParam2);
@@ -2860,7 +2864,19 @@ UnicodeString __fastcall TSessionData::GetNameWithoutHiddenPrefix()
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
 bool __fastcall TSessionData::HasSessionName()
 bool __fastcall TSessionData::HasSessionName()
 {
 {
-  return (!GetNameWithoutHiddenPrefix().IsEmpty() && (Name != DefaultName) && !IsWorkspace);
+  UnicodeString ALocalName = ExtractLocalName(Name);
+  bool AIsWorkspaceSessionWithoutName = IsWorkspace && (ALocalName.Length() == 4); // See SaveWorkspaceData()
+  if (AIsWorkspaceSessionWithoutName)
+  {
+    int Index = 1;
+    while (AIsWorkspaceSessionWithoutName && (Index <= ALocalName.Length()))
+    {
+      AIsWorkspaceSessionWithoutName = IsHex(ALocalName[Index]);
+      Index++;
+    }
+  }
+
+  return (!GetNameWithoutHiddenPrefix().IsEmpty() && (Name != DefaultName) && !AIsWorkspaceSessionWithoutName);
 }
 }
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
 UnicodeString __fastcall TSessionData::GetSessionName()
 UnicodeString __fastcall TSessionData::GetSessionName()
@@ -3912,6 +3928,11 @@ void __fastcall TSessionData::SetLink(UnicodeString value)
   SET_SESSION_PROPERTY(Link);
   SET_SESSION_PROPERTY(Link);
 }
 }
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
+void __fastcall TSessionData::SetNameOverride(UnicodeString value)
+{
+  SET_SESSION_PROPERTY(NameOverride);
+}
+//---------------------------------------------------------------------
 void __fastcall TSessionData::SetHostKey(UnicodeString value)
 void __fastcall TSessionData::SetHostKey(UnicodeString value)
 {
 {
   SET_SESSION_PROPERTY(HostKey);
   SET_SESSION_PROPERTY(HostKey);
@@ -4842,6 +4863,11 @@ void __fastcall TStoredSessionList::GetFolderOrWorkspace(const UnicodeString & N
         Data2->CopyStateData(RawData);
         Data2->CopyStateData(RawData);
       }
       }
 
 
+      if (!RawData->NameOverride.IsEmpty())
+      {
+        Data2->Name = RawData->NameOverride;
+      }
+
       List->Add(Data2);
       List->Add(Data2);
     }
     }
   }
   }
@@ -4859,7 +4885,16 @@ TStrings * __fastcall TStoredSessionList::GetFolderOrWorkspaceList(
 
 
     if (Data != NULL)
     if (Data != NULL)
     {
     {
-      Result->Add(Data->SessionName);
+      UnicodeString Name;
+      if (!Data->NameOverride.IsEmpty())
+      {
+        Name = Data->NameOverride;
+      }
+      else
+      {
+        Name = Data->SessionName;
+      }
+      Result->Add(Name);
     }
     }
   }
   }
 
 
@@ -4960,7 +4995,7 @@ TSessionData * __fastcall TStoredSessionList::ResolveWorkspaceData(TSessionData
   return Data;
   return Data;
 }
 }
 //---------------------------------------------------------------------
 //---------------------------------------------------------------------
-TSessionData * __fastcall TStoredSessionList::SaveWorkspaceData(TSessionData * Data)
+TSessionData * __fastcall TStoredSessionList::SaveWorkspaceData(TSessionData * Data, int Index)
 {
 {
   std::unique_ptr<TSessionData> Result(new TSessionData(L""));
   std::unique_ptr<TSessionData> Result(new TSessionData(L""));
 
 
@@ -4973,9 +5008,11 @@ TSessionData * __fastcall TStoredSessionList::SaveWorkspaceData(TSessionData * D
   else
   else
   {
   {
     Result->Assign(Data);
     Result->Assign(Data);
+    Result->NameOverride = Data->Name;
   }
   }
 
 
   Result->IsWorkspace = true;
   Result->IsWorkspace = true;
+  Result->Name = IntToHex(Index, 4); // See HasSessionName()
 
 
   return Result.release();
   return Result.release();
 }
 }

+ 5 - 2
source/core/SessionData.h

@@ -220,6 +220,7 @@ private:
   UnicodeString FS3DefaultRegion;
   UnicodeString FS3DefaultRegion;
   bool FIsWorkspace;
   bool FIsWorkspace;
   UnicodeString FLink;
   UnicodeString FLink;
+  UnicodeString FNameOverride;
   UnicodeString FHostKey;
   UnicodeString FHostKey;
   bool FFingerprintScan;
   bool FFingerprintScan;
   bool FOverrideCachedHostKey;
   bool FOverrideCachedHostKey;
@@ -279,7 +280,6 @@ private:
   void __fastcall SetTimeDifferenceAuto(bool value);
   void __fastcall SetTimeDifferenceAuto(bool value);
   void __fastcall SetPingType(TPingType value);
   void __fastcall SetPingType(TPingType value);
   UnicodeString __fastcall GetSessionName();
   UnicodeString __fastcall GetSessionName();
-  bool __fastcall HasSessionName();
   UnicodeString __fastcall GetDefaultSessionName();
   UnicodeString __fastcall GetDefaultSessionName();
   UnicodeString __fastcall GetProtocolUrl(bool HttpForWebDAV);
   UnicodeString __fastcall GetProtocolUrl(bool HttpForWebDAV);
   void __fastcall SetFSProtocol(TFSProtocol value);
   void __fastcall SetFSProtocol(TFSProtocol value);
@@ -393,6 +393,7 @@ private:
   void __fastcall SetLogicalHostName(UnicodeString value);
   void __fastcall SetLogicalHostName(UnicodeString value);
   void __fastcall SetIsWorkspace(bool value);
   void __fastcall SetIsWorkspace(bool value);
   void __fastcall SetLink(UnicodeString value);
   void __fastcall SetLink(UnicodeString value);
+  void __fastcall SetNameOverride(UnicodeString value);
   void __fastcall SetHostKey(UnicodeString value);
   void __fastcall SetHostKey(UnicodeString value);
   void __fastcall SetNote(UnicodeString value);
   void __fastcall SetNote(UnicodeString value);
   void __fastcall SetWinTitle(UnicodeString value);
   void __fastcall SetWinTitle(UnicodeString value);
@@ -488,6 +489,7 @@ public:
   bool __fastcall IsInFolderOrWorkspace(UnicodeString Name);
   bool __fastcall IsInFolderOrWorkspace(UnicodeString Name);
   UnicodeString __fastcall GenerateSessionUrl(unsigned int Flags);
   UnicodeString __fastcall GenerateSessionUrl(unsigned int Flags);
   bool __fastcall HasRawSettingsForUrl();
   bool __fastcall HasRawSettingsForUrl();
+  bool __fastcall HasSessionName();
 
 
   UnicodeString __fastcall GenerateOpenCommandArgs(bool Rtf);
   UnicodeString __fastcall GenerateOpenCommandArgs(bool Rtf);
   void __fastcall GenerateAssemblyCode(TAssemblyLanguage Language, UnicodeString & Head, UnicodeString & Tail, int & Indent);
   void __fastcall GenerateAssemblyCode(TAssemblyLanguage Language, UnicodeString & Head, UnicodeString & Tail, int & Indent);
@@ -642,6 +644,7 @@ public:
   __property UnicodeString S3DefaultRegion = { read = FS3DefaultRegion, write = SetS3DefaultRegion };
   __property UnicodeString S3DefaultRegion = { read = FS3DefaultRegion, write = SetS3DefaultRegion };
   __property bool IsWorkspace = { read = FIsWorkspace, write = SetIsWorkspace };
   __property bool IsWorkspace = { read = FIsWorkspace, write = SetIsWorkspace };
   __property UnicodeString Link = { read = FLink, write = SetLink };
   __property UnicodeString Link = { read = FLink, write = SetLink };
+  __property UnicodeString NameOverride = { read = FNameOverride, write = SetNameOverride };
   __property UnicodeString HostKey = { read = FHostKey, write = SetHostKey };
   __property UnicodeString HostKey = { read = FHostKey, write = SetHostKey };
   __property bool FingerprintScan = { read = FFingerprintScan, write = FFingerprintScan };
   __property bool FingerprintScan = { read = FFingerprintScan, write = FFingerprintScan };
   __property bool OverrideCachedHostKey = { read = FOverrideCachedHostKey };
   __property bool OverrideCachedHostKey = { read = FOverrideCachedHostKey };
@@ -694,7 +697,7 @@ public:
   TStrings * __fastcall GetFolderOrWorkspaceList(const UnicodeString & Name);
   TStrings * __fastcall GetFolderOrWorkspaceList(const UnicodeString & Name);
   TStrings * __fastcall GetWorkspaces();
   TStrings * __fastcall GetWorkspaces();
   bool __fastcall HasAnyWorkspace();
   bool __fastcall HasAnyWorkspace();
-  TSessionData * __fastcall SaveWorkspaceData(TSessionData * Data);
+  TSessionData * __fastcall SaveWorkspaceData(TSessionData * Data, int Index);
   virtual __fastcall ~TStoredSessionList();
   virtual __fastcall ~TStoredSessionList();
   __property TSessionData * Sessions[int Index]  = { read=AtSession };
   __property TSessionData * Sessions[int Index]  = { read=AtSession };
   __property TSessionData * DefaultSettings  = { read=FDefaultSettings, write=SetDefaultSettings };
   __property TSessionData * DefaultSettings  = { read=FDefaultSettings, write=SetDefaultSettings };

+ 22 - 2
source/forms/CustomScpExplorer.cpp

@@ -4672,6 +4672,23 @@ void __fastcall TCustomScpExplorerForm::DuplicateSession()
   }
   }
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
+void __fastcall TCustomScpExplorerForm::RenameSession()
+{
+  UnicodeString Name = Terminal->SessionData->Name;
+  if (InputDialog(LoadStr(RENAME_SESSION_TITLE), LoadStr(RENAME_SESSION_PROMPT), Name, HELP_SESSION_RENAME))
+  {
+    // Checks for a slash only, so it's not that big deal that we do the check after submitting the dialog only.
+    TSessionData::ValidateName(Name);
+
+    // This is inconsistent with how color (for example) is handled.
+    Terminal->SessionData->Name = Name;
+
+    UpdateControls();
+    // Add/Remove distinguishing paths from sessions of the same name.
+    DoTerminalListChanged();
+  }
+}
+//---------------------------------------------------------------------------
 bool __fastcall TCustomScpExplorerForm::CanCloseQueue(TTerminalQueue * Queue)
 bool __fastcall TCustomScpExplorerForm::CanCloseQueue(TTerminalQueue * Queue)
 {
 {
   DebugAssert(Queue != NULL);
   DebugAssert(Queue != NULL);
@@ -5610,9 +5627,9 @@ TSessionData * __fastcall TCustomScpExplorerForm::CloneCurrentSessionData()
   SessionData->Assign(Terminal->SessionData);
   SessionData->Assign(Terminal->SessionData);
   UpdateSessionData(SessionData.get());
   UpdateSessionData(SessionData.get());
   TTerminalManager::Instance()->UpdateSessionCredentials(SessionData.get());
   TTerminalManager::Instance()->UpdateSessionCredentials(SessionData.get());
-  if (Terminal->SessionData->IsWorkspace)
+  if (!Terminal->SessionData->HasSessionName())
   {
   {
-    // Have to reset the "Workspace/XXX" name which would become user-visible
+    // Particularly for "Workspace/XXXX" name, we need to reset it, as it would become user-visible
     // once IsWorkspace is cleared
     // once IsWorkspace is cleared
     SessionData->Name = UnicodeString();
     SessionData->Name = UnicodeString();
     SessionData->IsWorkspace = false;
     SessionData->IsWorkspace = false;
@@ -5786,6 +5803,9 @@ void __fastcall TCustomScpExplorerForm::UpdateSessionData(TSessionData * Data)
 
 
   DebugAssert(Data != NULL);
   DebugAssert(Data != NULL);
 
 
+  // This is inconsistent with how color (for example) is handled.
+  Data->Name = Terminal->SessionData->Name;
+
   // cannot use RemoteDirView->Path, because it is empty if connection
   // cannot use RemoteDirView->Path, because it is empty if connection
   // was already closed
   // was already closed
   // also only peek, we may not be connected at all atm
   // also only peek, we may not be connected at all atm

+ 1 - 0
source/forms/CustomScpExplorer.h

@@ -653,6 +653,7 @@ public:
 
 
   void __fastcall NewSession(bool FromSite, const UnicodeString & SessionUrl = L"");
   void __fastcall NewSession(bool FromSite, const UnicodeString & SessionUrl = L"");
   void __fastcall DuplicateSession();
   void __fastcall DuplicateSession();
+  void __fastcall RenameSession();
   void __fastcall CloseSession();
   void __fastcall CloseSession();
   void __fastcall OpenDirectory(TOperationSide Side);
   void __fastcall OpenDirectory(TOperationSide Side);
   virtual void __fastcall HomeDirectory(TOperationSide Side);
   virtual void __fastcall HomeDirectory(TOperationSide Side);

+ 2 - 0
source/forms/NonVisual.cpp

@@ -396,6 +396,7 @@ void __fastcall TNonVisualDataModule::ExplorerActionsUpdate(
   UPD(NewSessionAction, true)
   UPD(NewSessionAction, true)
   UPD(SiteManagerAction, true)
   UPD(SiteManagerAction, true)
   UPD(DuplicateSessionAction, HasTerminal)
   UPD(DuplicateSessionAction, HasTerminal)
+  UPD(RenameSessionAction, HasTerminal)
   UPD(CloseSessionAction, HasTerminal)
   UPD(CloseSessionAction, HasTerminal)
   UPD(SavedSessionsAction2, true)
   UPD(SavedSessionsAction2, true)
   UPD(WorkspacesAction, StoredSessions->HasAnyWorkspace())
   UPD(WorkspacesAction, StoredSessions->HasAnyWorkspace())
@@ -710,6 +711,7 @@ void __fastcall TNonVisualDataModule::ExplorerActionsExecute(
     EXE(NewSessionAction, ScpExplorer->NewSession(false))
     EXE(NewSessionAction, ScpExplorer->NewSession(false))
     EXE(SiteManagerAction, ScpExplorer->NewSession(true))
     EXE(SiteManagerAction, ScpExplorer->NewSession(true))
     EXE(DuplicateSessionAction, ScpExplorer->DuplicateSession())
     EXE(DuplicateSessionAction, ScpExplorer->DuplicateSession())
+    EXE(RenameSessionAction, ScpExplorer->RenameSession())
     EXE(CloseSessionAction, ScpExplorer->CloseSession())
     EXE(CloseSessionAction, ScpExplorer->CloseSession())
     EXE(SavedSessionsAction2, CreateSessionListMenu(SavedSessionsAction2))
     EXE(SavedSessionsAction2, CreateSessionListMenu(SavedSessionsAction2))
     EXE(WorkspacesAction, CreateWorkspacesMenu(WorkspacesAction))
     EXE(WorkspacesAction, CreateWorkspacesMenu(WorkspacesAction))

+ 10 - 0
source/forms/NonVisual.dfm

@@ -2238,6 +2238,13 @@ object NonVisualDataModule: TNonVisualDataModule
       HelpKeyword = 'ui_toolbars'
       HelpKeyword = 'ui_toolbars'
       Hint = 'Show/hide toolbar buttons'
       Hint = 'Show/hide toolbar buttons'
     end
     end
+    object RenameSessionAction: TAction
+      Tag = 15
+      Category = 'Session'
+      Caption = '&Rename Session'
+      HelpKeyword = 'task_connections'
+      Hint = 'Rename session|Changes name of the current session'
+    end
   end
   end
   object ExplorerBarPopup: TTBXPopupMenu
   object ExplorerBarPopup: TTBXPopupMenu
     Images = GlyphsModule.ExplorerImages
     Images = GlyphsModule.ExplorerImages
@@ -2992,6 +2999,9 @@ object NonVisualDataModule: TNonVisualDataModule
     object TBXItem219: TTBXItem
     object TBXItem219: TTBXItem
       Action = DuplicateSessionAction
       Action = DuplicateSessionAction
     end
     end
+    object TBXItem78: TTBXItem
+      Action = RenameSessionAction
+    end
     object TBXItem125: TTBXItem
     object TBXItem125: TTBXItem
       Action = SaveCurrentSessionAction2
       Action = SaveCurrentSessionAction2
     end
     end

+ 2 - 0
source/forms/NonVisual.h

@@ -616,6 +616,8 @@ __published:    // IDE-managed Components
   TTBXSubmenuItem *TBXSubmenuItem6;
   TTBXSubmenuItem *TBXSubmenuItem6;
   TTBXSubmenuItem *TBXSubmenuItem9;
   TTBXSubmenuItem *TBXSubmenuItem9;
   TAction *PrivateKeyUploadAction;
   TAction *PrivateKeyUploadAction;
+  TAction *RenameSessionAction;
+  TTBXItem *TBXItem78;
   void __fastcall ExplorerActionsUpdate(TBasicAction *Action, bool &Handled);
   void __fastcall ExplorerActionsUpdate(TBasicAction *Action, bool &Handled);
   void __fastcall ExplorerActionsExecute(TBasicAction *Action, bool &Handled);
   void __fastcall ExplorerActionsExecute(TBasicAction *Action, bool &Handled);
   void __fastcall SessionIdleTimerTimer(TObject *Sender);
   void __fastcall SessionIdleTimerTimer(TObject *Sender);

+ 3 - 0
source/forms/ScpCommander.dfm

@@ -415,6 +415,9 @@ inherited ScpCommanderForm: TScpCommanderForm
         object TBXItem218: TTBXItem
         object TBXItem218: TTBXItem
           Action = NonVisualDataModule.DuplicateSessionAction
           Action = NonVisualDataModule.DuplicateSessionAction
         end
         end
+        object TBXItem127: TTBXItem
+          Action = NonVisualDataModule.RenameSessionAction
+        end
         object TBXItem114: TTBXItem
         object TBXItem114: TTBXItem
           Action = NonVisualDataModule.SaveCurrentSessionAction2
           Action = NonVisualDataModule.SaveCurrentSessionAction2
         end
         end

+ 1 - 0
source/forms/ScpCommander.h

@@ -424,6 +424,7 @@ __published:
   TTBXItem *TBXItem249;
   TTBXItem *TBXItem249;
   TTBXItem *TBXItem250;
   TTBXItem *TBXItem250;
   TTBXItem *TBXItem76;
   TTBXItem *TBXItem76;
+  TTBXItem *TBXItem127;
   void __fastcall SplitterMoved(TObject *Sender);
   void __fastcall SplitterMoved(TObject *Sender);
   void __fastcall SplitterCanResize(TObject *Sender, int &NewSize,
   void __fastcall SplitterCanResize(TObject *Sender, int &NewSize,
     bool &Accept);
     bool &Accept);

+ 3 - 0
source/forms/ScpExplorer.dfm

@@ -291,6 +291,9 @@ inherited ScpExplorerForm: TScpExplorerForm
         object TBXItem90: TTBXItem
         object TBXItem90: TTBXItem
           Action = NonVisualDataModule.DuplicateSessionAction
           Action = NonVisualDataModule.DuplicateSessionAction
         end
         end
+        object TBXItem61: TTBXItem
+          Action = NonVisualDataModule.RenameSessionAction
+        end
         object TBXItem114: TTBXItem
         object TBXItem114: TTBXItem
           Action = NonVisualDataModule.SaveCurrentSessionAction2
           Action = NonVisualDataModule.SaveCurrentSessionAction2
         end
         end

+ 1 - 0
source/forms/ScpExplorer.h

@@ -314,6 +314,7 @@ __published:
   TTBXItem *TBXItem244;
   TTBXItem *TBXItem244;
   TTBXItem *TBXItem246;
   TTBXItem *TBXItem246;
   TTBXItem *TBXItem14;
   TTBXItem *TBXItem14;
+  TTBXItem *TBXItem61;
   void __fastcall RemoteDirViewUpdateStatusBar(TObject *Sender,
   void __fastcall RemoteDirViewUpdateStatusBar(TObject *Sender,
           const TStatusFileInfo &FileInfo);
           const TStatusFileInfo &FileInfo);
   void __fastcall UnixPathComboBoxBeginEdit(TTBEditItem *Sender,
   void __fastcall UnixPathComboBoxBeginEdit(TTBEditItem *Sender,

+ 1 - 0
source/resource/HelpWin.h

@@ -62,5 +62,6 @@
 #define HELP_FILTER                  "ui_filter"
 #define HELP_FILTER                  "ui_filter"
 #define HELP_LOGIN_AUTHORIZED_KEYS   "guide_public_key"
 #define HELP_LOGIN_AUTHORIZED_KEYS   "guide_public_key"
 #define HELP_READONLY_INI_FILE       "config#ini_readonly"
 #define HELP_READONLY_INI_FILE       "config#ini_readonly"
+#define HELP_SESSION_RENAME          "task_connection"
 
 
 #endif // TextsWin
 #endif // TextsWin

+ 2 - 0
source/resource/TextsWin.h

@@ -613,6 +613,8 @@
 #define EDITOR_READONLY         6011
 #define EDITOR_READONLY         6011
 #define PROGRESS_TIME_LEFT_CALCULATING 6012
 #define PROGRESS_TIME_LEFT_CALCULATING 6012
 #define COPY_PARAM_SAVE_PRESET  6013
 #define COPY_PARAM_SAVE_PRESET  6013
+#define RENAME_SESSION_TITLE    6014
+#define RENAME_SESSION_PROMPT   6015
 
 
 // 2xxx is reserved for TextsFileZilla.h
 // 2xxx is reserved for TextsFileZilla.h
 
 

+ 2 - 0
source/resource/TextsWin1.rc

@@ -616,6 +616,8 @@ BEGIN
         EDITOR_READONLY, "Read-only"
         EDITOR_READONLY, "Read-only"
         PROGRESS_TIME_LEFT_CALCULATING, "Calculating"
         PROGRESS_TIME_LEFT_CALCULATING, "Calculating"
         COPY_PARAM_SAVE_PRESET, "Save as &Preset..."
         COPY_PARAM_SAVE_PRESET, "Save as &Preset..."
+        RENAME_SESSION_TITLE, "Rename session"
+        RENAME_SESSION_PROMPT, "&New session name:"
 
 
         WIN_VARIABLE_STRINGS, "WIN_VARIABLE"
         WIN_VARIABLE_STRINGS, "WIN_VARIABLE"
         WINSCP_COPYRIGHT, "Copyright © 2000-2018 Martin Prikryl"
         WINSCP_COPYRIGHT, "Copyright © 2000-2018 Martin Prikryl"

+ 1 - 2
source/windows/TerminalManager.cpp

@@ -1599,9 +1599,8 @@ void __fastcall TTerminalManager::SaveWorkspace(TList * DataList)
   for (int Index = 0; Index < Count; Index++)
   for (int Index = 0; Index < Count; Index++)
   {
   {
     TManagedTerminal * ManagedTerminal = dynamic_cast<TManagedTerminal *>(Terminals[Index]);
     TManagedTerminal * ManagedTerminal = dynamic_cast<TManagedTerminal *>(Terminals[Index]);
-    TSessionData * Data = StoredSessions->SaveWorkspaceData(ManagedTerminal->StateData);
+    TSessionData * Data = StoredSessions->SaveWorkspaceData(ManagedTerminal->StateData, Index);
     DataList->Add(Data);
     DataList->Add(Data);
-    Data->Name = IntToHex(Index, 4);
   }
   }
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------