Browse Source

When path to an existing local directory is specified on the Download options dialog without an operation mask, a noop operation mask is implied

(cherry picked from commit 5b2b1a0a736dec9cd9b0ed3411bba893d93b86f6)

Source commit: 1174f059f17b051c9bf93aeef9d1f7902e1afc82
Martin Prikryl 5 years ago
parent
commit
9eecdd468e
3 changed files with 15 additions and 5 deletions
  1. 13 5
      source/forms/Copy.cpp
  2. 1 0
      source/forms/Copy.dfm
  3. 1 0
      source/forms/Copy.h

+ 13 - 5
source/forms/Copy.cpp

@@ -403,6 +403,8 @@ void __fastcall TCopyDialog::FormCloseQuery(TObject * /*Sender*/,
 {
   if (ModalResult == DefaultResult(this))
   {
+    ExitActiveControl(this);
+
     if (!RemotePaths() && ((FOptions & coTemp) == 0))
     {
       UnicodeString Dir = Directory;
@@ -438,11 +440,6 @@ void __fastcall TCopyDialog::FormCloseQuery(TObject * /*Sender*/,
       CanClose =
         (MessageDialog(Message, qtConfirmation, qaOK | qaCancel, HELP_NONE) != qaCancel);
     }
-
-    if (CanClose)
-    {
-      ExitActiveControl(this);
-    }
   }
 }
 //---------------------------------------------------------------------------
@@ -574,3 +571,14 @@ void __fastcall TCopyDialog::ShortCutHintLabelClick(TObject * /*Sender*/)
   DoPreferencesDialog(pmCommander);
 }
 //---------------------------------------------------------------------------
+void __fastcall TCopyDialog::LocalDirectoryEditExit(TObject *)
+{
+  if (!RemotePaths())
+  {
+    if (DirectoryExistsFix(LocalDirectoryEdit->Text))
+    {
+      LocalDirectoryEdit->Text = IncludeTrailingBackslash(LocalDirectoryEdit->Text) + AnyMask;
+    }
+  }
+}
+//---------------------------------------------------------------------------

+ 1 - 0
source/forms/Copy.dfm

@@ -43,6 +43,7 @@ object CopyDialog: TCopyDialog
     TabOrder = 0
     Text = 'LocalDirectoryEdit'
     OnChange = ControlChange
+    OnExit = LocalDirectoryEditExit
   end
   object RemoteDirectoryEdit: THistoryComboBox
     Left = 46

+ 1 - 0
source/forms/Copy.h

@@ -45,6 +45,7 @@ __published:
   void __fastcall TransferSettingsButtonDropDownClick(TObject *Sender);
   void __fastcall NeverShowAgainCheckClick(TObject *Sender);
   void __fastcall ShortCutHintLabelClick(TObject *Sender);
+  void __fastcall LocalDirectoryEditExit(TObject *Sender);
 private:
   bool FDefaultToRemote;
   bool FToRemote;