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

Bug fix: Master password prompt was not added to task bar when opening session from commandline

Source commit: aee96444b70c678c682a592174fcef43ab2e5714
This commit is contained in:
Martin Prikryl
2023-06-30 09:36:09 +00:00
parent 247565d23b
commit 1413e93add

View File

@@ -1246,8 +1246,9 @@ bool __fastcall IsCustomShortCut(TShortCut ShortCut)
class TMasterPasswordDialog : public TCustomDialog
{
public:
__fastcall TMasterPasswordDialog(bool Current);
__fastcall TMasterPasswordDialog(TComponent * AOwner);
void Init(bool Current);
bool __fastcall Execute(UnicodeString & CurrentPassword, UnicodeString & NewPassword);
protected:
@@ -1260,9 +1261,15 @@ private:
TPasswordEdit * ConfirmEdit;
};
//---------------------------------------------------------------------------
__fastcall TMasterPasswordDialog::TMasterPasswordDialog(bool Current) :
TCustomDialog(Current ? HELP_MASTER_PASSWORD_CURRENT : HELP_MASTER_PASSWORD_CHANGE)
// Need to have an Owner argument for SafeFormCreate
__fastcall TMasterPasswordDialog::TMasterPasswordDialog(TComponent *) :
TCustomDialog(EmptyStr)
{
}
//---------------------------------------------------------------------------
void TMasterPasswordDialog::Init(bool Current)
{
HelpKeyword = Current ? HELP_MASTER_PASSWORD_CURRENT : HELP_MASTER_PASSWORD_CHANGE;
Caption = LoadStr(MASTER_PASSWORD_CAPTION);
CurrentEdit = new TPasswordEdit(this);
@@ -1359,9 +1366,11 @@ static bool __fastcall DoMasterPasswordDialog(bool Current,
UnicodeString & NewPassword)
{
bool Result;
TMasterPasswordDialog * Dialog = new TMasterPasswordDialog(Current);
// This can be a standalone dialog when opening session from commandline
TMasterPasswordDialog * Dialog = SafeFormCreate<TMasterPasswordDialog>();
try
{
Dialog->Init(Current);
UnicodeString CurrentPassword;
Result = Dialog->Execute(CurrentPassword, NewPassword);
if (Result)