mirror of
https://github.com/winscp/winscp.git
synced 2026-10-24 02:28:55 +03:00
New tab hints + Shift clicking New Session command opens the Login dialog in new WinSCP instance, instead of possibly opening new instance of workspace
Source commit: 3d5979e81767aa6a60c47a34cc004249ce9c9b53
This commit is contained in:
@@ -11284,6 +11284,11 @@ UnicodeString TCustomScpExplorerForm::GetTabHintDetails(TManagedTerminal * ASess
|
||||
return Result;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
UnicodeString TCustomScpExplorerForm::GetNewTabHintDetails()
|
||||
{
|
||||
return LoadStr(NEW_REMOTE_TAB_HINT);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCustomScpExplorerForm::SessionsPageControlTabHint(TPageControl *, int Index, UnicodeString & Hint)
|
||||
{
|
||||
if (Index >= 0)
|
||||
@@ -11295,7 +11300,7 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlTabHint(TPageControl
|
||||
UnicodeString NewTabTabCaption = GetNewTabTabCaption();
|
||||
if (NewTabTabCaption != TabSheet->Caption)
|
||||
{
|
||||
Hint = NewTabTabCaption;
|
||||
Hint = NewTabTabCaption + L"|" + GetNewTabHintDetails();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -727,6 +727,7 @@ protected:
|
||||
void HandleDoNotShowCopyDialogAgain(bool DragDrop, bool DoNotShowAgain);
|
||||
void __fastcall UpdateDarkMode();
|
||||
virtual UnicodeString GetTabHintDetails(TManagedTerminal * ASession);
|
||||
virtual UnicodeString GetNewTabHintDetails();
|
||||
UnicodeString GetSessionPath(TManagedTerminal * ASession, TOperationSide Side);
|
||||
|
||||
public:
|
||||
|
||||
@@ -3034,7 +3034,7 @@ void __fastcall TPreferencesDialog::CustomIniFileStorageChanged()
|
||||
else if (Result == qaNo)
|
||||
{
|
||||
Configuration->ScheduleCustomIniFileStorageUse(GetCustomIniFileStorageName());
|
||||
ExecuteNewInstance(L"");
|
||||
ExecuteSelf(EmptyStr);
|
||||
TerminateApplication();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -433,7 +433,12 @@ void TScpCommanderForm::NewTab(TOperationSide Side)
|
||||
{
|
||||
if (Side == osCurrent)
|
||||
{
|
||||
Side = WinConfiguration->DefaultToNewRemoteTab ? osRemote : osLocal;
|
||||
bool Remote = WinConfiguration->DefaultToNewRemoteTab;
|
||||
if (IsKeyPressed(VK_CONTROL))
|
||||
{
|
||||
Remote = !Remote;
|
||||
}
|
||||
Side = Remote ? osRemote : osLocal;
|
||||
}
|
||||
|
||||
if (Side == osRemote)
|
||||
@@ -2879,3 +2884,18 @@ UnicodeString TScpCommanderForm::GetTabHintDetails(TManagedTerminal * ASession)
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
UnicodeString TScpCommanderForm::GetNewTabHintDetails()
|
||||
{
|
||||
UnicodeString Result;
|
||||
if (WinConfiguration->DefaultToNewRemoteTab)
|
||||
{
|
||||
Result = TCustomScpExplorerForm::GetNewTabHintDetails();
|
||||
Result = FMTLOAD(NEW_REMOTE_TAB_CTRL_HINT, (Result));
|
||||
}
|
||||
else
|
||||
{
|
||||
Result = LoadStr(NEW_LOCAL_TAB_HINT);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
@@ -636,6 +636,7 @@ protected:
|
||||
virtual void __fastcall NeedSession(bool Startup);
|
||||
void RestoreSessionLocalDirView(TDirView * ALocalDirView, const UnicodeString & LocalDirectory);
|
||||
virtual UnicodeString GetTabHintDetails(TManagedTerminal * ASession);
|
||||
virtual UnicodeString GetNewTabHintDetails();
|
||||
|
||||
public:
|
||||
__fastcall TScpCommanderForm(TComponent* Owner);
|
||||
|
||||
@@ -649,6 +649,9 @@
|
||||
#define COPY_LOCAL_MOVE_CAPTION 6039
|
||||
#define LOGIN_OPEN 6040
|
||||
#define LOGIN_LOGIN 6041
|
||||
#define NEW_LOCAL_TAB_HINT 6042
|
||||
#define NEW_REMOTE_TAB_HINT 6043
|
||||
#define NEW_REMOTE_TAB_CTRL_HINT 6044
|
||||
|
||||
// 2xxx is reserved for TextsFileZilla.h
|
||||
|
||||
|
||||
@@ -654,6 +654,9 @@ BEGIN
|
||||
COPY_LOCAL_MOVE_CAPTION, "Move"
|
||||
LOGIN_OPEN, "Open"
|
||||
LOGIN_LOGIN, "Login"
|
||||
NEW_LOCAL_TAB_HINT, "Click to open new local tab.\nHold down Ctrl key to open new remote tab."
|
||||
NEW_REMOTE_TAB_HINT, "Click to open new session in new remote tab.\nHold down Shift Key to open new session in new window."
|
||||
NEW_REMOTE_TAB_CTRL_HINT, "%s\nHold down Ctrl key to open new local tab."
|
||||
|
||||
WIN_VARIABLE_STRINGS, "WIN_VARIABLE"
|
||||
WINSCP_COPYRIGHT, "Copyright © 2000–2021 Martin Prikryl"
|
||||
|
||||
@@ -489,19 +489,24 @@ bool __fastcall OpenInNewWindow()
|
||||
return UseAlternativeFunction();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void ExecuteSelf(const UnicodeString & Params)
|
||||
{
|
||||
ExecuteShellChecked(Application->ExeName, Params);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall ExecuteNewInstance(const UnicodeString & Param, const UnicodeString & AdditionalParams)
|
||||
{
|
||||
UnicodeString Arg = Param;
|
||||
if (!Arg.IsEmpty())
|
||||
UnicodeString Arg;
|
||||
UnicodeString Space(L" ");
|
||||
if (!Param.IsEmpty())
|
||||
{
|
||||
Arg = FORMAT(L"\"%s\" %s", (Arg, TProgramParams::FormatSwitch(NEWINSTANCE_SWICH)));
|
||||
if (!AdditionalParams.IsEmpty())
|
||||
{
|
||||
Arg += L" " + AdditionalParams;
|
||||
}
|
||||
Arg = FORMAT(L"\"%s\"", (Param));
|
||||
AddToList(Arg, Param, Space);
|
||||
}
|
||||
AddToList(Arg, TProgramParams::FormatSwitch(NEWINSTANCE_SWICH), Space);
|
||||
AddToList(Arg, AdditionalParams, Space);
|
||||
|
||||
ExecuteShellChecked(Application->ExeName, Arg);
|
||||
ExecuteSelf(Arg);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
IShellLink * __fastcall CreateDesktopShortCut(const UnicodeString & Name,
|
||||
|
||||
@@ -17,6 +17,7 @@ void __fastcall ExecuteProcessCheckedAndWait(
|
||||
bool __fastcall IsKeyPressed(int VirtualKey);
|
||||
bool __fastcall UseAlternativeFunction();
|
||||
bool __fastcall OpenInNewWindow();
|
||||
void ExecuteSelf(const UnicodeString & Params);
|
||||
void __fastcall ExecuteNewInstance(const UnicodeString & Param, const UnicodeString & AdditionalParams = UnicodeString());
|
||||
IShellLink * __fastcall CreateAppDesktopShortCut(
|
||||
const UnicodeString & Name, const UnicodeString & Params, const UnicodeString & Description,
|
||||
|
||||
@@ -1070,6 +1070,7 @@ int __fastcall Execute()
|
||||
}
|
||||
}
|
||||
|
||||
bool NewInstance = Params->FindSwitch(NEWINSTANCE_SWICH);
|
||||
if (Params->ParamCount > 0)
|
||||
{
|
||||
AutoStartSession = Params->Param[1];
|
||||
@@ -1077,7 +1078,7 @@ int __fastcall Execute()
|
||||
|
||||
if ((ParamCommand == pcNone) &&
|
||||
(WinConfiguration->ExternalSessionInExistingInstance != OpenInNewWindow()) &&
|
||||
!Params->FindSwitch(NEWINSTANCE_SWICH) &&
|
||||
!NewInstance &&
|
||||
SendToAnotherInstance())
|
||||
{
|
||||
Configuration->Usage->Inc(L"SendToAnotherInstance");
|
||||
@@ -1102,6 +1103,10 @@ int __fastcall Execute()
|
||||
}
|
||||
Configuration->Usage->Inc(CounterName);
|
||||
}
|
||||
else if (NewInstance)
|
||||
{
|
||||
// no autostart
|
||||
}
|
||||
else if (WinConfiguration->EmbeddedSessions && StoredSessions->Count)
|
||||
{
|
||||
AutoStartSession = StoredSessions->Sessions[0]->Name;
|
||||
@@ -1120,7 +1125,7 @@ int __fastcall Execute()
|
||||
// from now flash message boxes on background
|
||||
SetOnForeground(false);
|
||||
|
||||
bool NeedSession = (ParamCommand != pcNone);
|
||||
bool NeedSession = NewInstance || (ParamCommand != pcNone);
|
||||
|
||||
bool Retry;
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user