1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Bug fix: Failure when opening workspace with local-local tab in Explorer interface

Source commit: 9aac31d676695c9d23f7997c1d87bfd64b600692
This commit is contained in:
Martin Prikryl
2022-09-22 11:13:42 +00:00
parent c6482801d6
commit 43e8bfcc35
6 changed files with 26 additions and 11 deletions

View File

@@ -785,6 +785,7 @@ public:
virtual bool IsLocalBrowserMode();
bool CanCloseSession(TManagedTerminal * Session);
virtual UnicodeString __fastcall DefaultDownloadTargetDirectory() = 0;
virtual bool SupportedSession(TSessionData * SessionData) = 0;
void __fastcall NewSession(const UnicodeString & SessionUrl = L"");
virtual void NewTab(TOperationSide Side = osCurrent);

View File

@@ -2938,3 +2938,8 @@ UnicodeString TScpCommanderForm::GetNewTabHintDetails()
}
return Result;
}
//---------------------------------------------------------------------------
bool TScpCommanderForm::SupportedSession(TSessionData *)
{
return true;
}

View File

@@ -672,6 +672,7 @@ public:
virtual int GetNewTabActionImageIndex();
virtual int GetNewTabTabImageIndex(TOperationSide Side);
virtual UnicodeString __fastcall DefaultDownloadTargetDirectory();
virtual bool SupportedSession(TSessionData * SessionData);
__property double LeftPanelWidth = { read = GetLeftPanelWidth, write = SetLeftPanelWidth };
};

View File

@@ -417,3 +417,7 @@ void __fastcall TScpExplorerForm::UpdateImages()
UnixPathComboBox->SubMenuImages = ImageList;
}
//---------------------------------------------------------------------------
bool TScpExplorerForm::SupportedSession(TSessionData * SessionData)
{
return !SessionData->IsLocalBrowser;
}

View File

@@ -373,6 +373,7 @@ public:
virtual void __fastcall ChangePath(TOperationSide Side);
virtual void __fastcall GoToAddress();
virtual UnicodeString __fastcall DefaultDownloadTargetDirectory();
virtual bool SupportedSession(TSessionData * SessionData);
};
//---------------------------------------------------------------------------
#endif

View File

@@ -243,18 +243,21 @@ TManagedTerminal * __fastcall TTerminalManager::NewSessions(TList * DataList)
for (int Index = 0; Index < DataList->Count; Index++)
{
TSessionData * Data = reinterpret_cast<TSessionData *>(DataList->Items[Index]);
TManagedTerminal * Session = DoNewSession(Data);
// When opening workspace/folder, keep the sessions open, even if they fail to connect.
// We cannot detect a folder here, so we "guess" it by a session set size.
// After all, no one will have a folder with a one session only (while a workspace with one session is likely).
// And when when opening a folder with a one session only, it's not that big problem, if we treat it the same way
// as when opening the session only.
// Also closing a workspace session will remove the session from the workspace.
// While closing a folder session won't remove the session from the folder.
Session->Permanent = Data->IsWorkspace || (DataList->Count > 1);
if (Index == 0)
if (ScpExplorer->SupportedSession(Data))
{
Result = Session;
TManagedTerminal * Session = DoNewSession(Data);
// When opening workspace/folder, keep the sessions open, even if they fail to connect.
// We cannot detect a folder here, so we "guess" it by a session set size.
// After all, no one will have a folder with a one session only (while a workspace with one session is likely).
// And when when opening a folder with a one session only, it's not that big problem, if we treat it the same way
// as when opening the session only.
// Also closing a workspace session will remove the session from the workspace.
// While closing a folder session won't remove the session from the folder.
Session->Permanent = Data->IsWorkspace || (DataList->Count > 1);
if (Result == NULL)
{
Result = Session;
}
}
}
DoSessionListChanged();