Browse Source

Bug 1440: Implement "Beep when work finishes" also for "Keep remote directory up to date"

https://winscp.net/tracker/1440

Source commit: a9c656c078b8993b6c38a3ffbe208f96b2a5a20c
Martin Prikryl 9 years ago
parent
commit
853cc03088
1 changed files with 12 additions and 0 deletions
  1. 12 0
      source/forms/CustomScpExplorer.cpp

+ 12 - 0
source/forms/CustomScpExplorer.cpp

@@ -4934,6 +4934,8 @@ void __fastcall TCustomScpExplorerForm::Synchronize(const UnicodeString LocalDir
   BatchStart(BatchStorage);
   FAutoOperation = true;
 
+  bool AnyOperation = false;
+  TDateTime StartTime = Now();
   TSynchronizeChecklist * AChecklist = NULL;
   try
   {
@@ -4956,6 +4958,12 @@ void __fastcall TCustomScpExplorerForm::Synchronize(const UnicodeString LocalDir
       FSynchronizeProgressForm->Start();
     }
 
+    for (int Index = 0; !AnyOperation && (Index < AChecklist->Count); Index++)
+    {
+      AnyOperation = AChecklist->Item[Index]->Checked;
+    }
+
+    // No need to call if !AnyOperation
     Terminal->SynchronizeApply(AChecklist, LocalDirectory, RemoteDirectory,
       &CopyParam, Params | spNoConfirmation, TerminalSynchronizeDirectory);
   }
@@ -4974,6 +4982,10 @@ void __fastcall TCustomScpExplorerForm::Synchronize(const UnicodeString LocalDir
     SAFE_DESTROY(FSynchronizeProgressForm);
     BatchEnd(BatchStorage);
     ReloadLocalDirectory();
+    if (AnyOperation)
+    {
+      OperationComplete(StartTime);
+    }
   }
 }
 //---------------------------------------------------------------------------