Browse Source

Including "Keep remote directory up to date" log into session log

Source commit: 77fae1a0143aa3070660d507188e0536b0c49728
Martin Prikryl 9 years ago
parent
commit
2f0ec1ce4a

+ 6 - 1
source/forms/CustomScpExplorer.cpp

@@ -4800,7 +4800,7 @@ bool __fastcall TCustomScpExplorerForm::DoSynchronizeDirectories(
       FLAGMASK(SynchronizeAllowSelectedOnly(), soAllowSelectedOnly);
     DebugAssert(FOnFeedSynchronizeError == NULL);
     Result = DoSynchronizeDialog(Params, &CopyParam, Controller.StartStop,
-      SaveSettings, Options, CopyParamAttrs, GetSynchronizeOptions,
+      SaveSettings, Options, CopyParamAttrs, GetSynchronizeOptions, SynchronizeSessionLog,
       FOnFeedSynchronizeError, UseDefaults);
     if (Result)
     {
@@ -4973,6 +4973,11 @@ bool __fastcall TCustomScpExplorerForm::SynchronizeAllowSelectedOnly()
      (HasDirView[osLocal] && (DirView(osLocal)->SelCount > 0)));
 }
 //---------------------------------------------------------------------------
+void __fastcall TCustomScpExplorerForm::SynchronizeSessionLog(const UnicodeString & Message)
+{
+  LogSynchronizeEvent(Terminal, Message);
+}
+//---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::GetSynchronizeOptions(
   int Params, TSynchronizeOptions & Options)
 {

+ 1 - 0
source/forms/CustomScpExplorer.h

@@ -394,6 +394,7 @@ protected:
     const UnicodeString RemoteDirectory, TSynchronizeMode Mode,
     const TCopyParamType & CopyParam, int Params, TSynchronizeChecklist ** Checklist,
     TSynchronizeOptions * Options);
+  void __fastcall SynchronizeSessionLog(const UnicodeString & Message);
   void __fastcall GetSynchronizeOptions(int Params, TSynchronizeOptions & Options);
   bool __fastcall SynchronizeAllowSelectedOnly();
   virtual void __fastcall BatchStart(void *& Storage);

+ 6 - 1
source/forms/Synchronize.cpp

@@ -31,13 +31,14 @@ bool __fastcall DoSynchronizeDialog(TSynchronizeParamType & Params,
   const TCopyParamType * CopyParams, TSynchronizeStartStopEvent OnStartStop,
   bool & SaveSettings, int Options, int CopyParamAttrs,
   TGetSynchronizeOptionsEvent OnGetOptions,
+  TSynchronizeSessionLog OnSynchronizeSessionLog,
   TFeedSynchronizeError & OnFeedSynchronizeError,
   bool Start)
 {
   bool Result;
   TSynchronizeDialog * Dialog = SafeFormCreate<TSynchronizeDialog>(Application);
 
-  Dialog->Init(OnStartStop, OnGetOptions, OnFeedSynchronizeError, Start);
+  Dialog->Init(OnStartStop, OnGetOptions, OnSynchronizeSessionLog, OnFeedSynchronizeError, Start);
 
   try
   {
@@ -91,11 +92,13 @@ __fastcall TSynchronizeDialog::TSynchronizeDialog(TComponent * Owner)
 //---------------------------------------------------------------------------
 void __fastcall TSynchronizeDialog::Init(TSynchronizeStartStopEvent OnStartStop,
   TGetSynchronizeOptionsEvent OnGetOptions,
+  TSynchronizeSessionLog OnSynchronizeSessionLog,
   TFeedSynchronizeError & OnFeedSynchronizeError,
   bool StartImmediately)
 {
   FOnStartStop = OnStartStop;
   FOnGetOptions = OnGetOptions;
+  FOnSynchronizeSessionLog = OnSynchronizeSessionLog;
   FOnFeedSynchronizeError = &OnFeedSynchronizeError;
   FStartImmediately = StartImmediately;
 }
@@ -375,6 +378,8 @@ void __fastcall TSynchronizeDialog::DoLogInternal(
       LogView->Repaint();
     }
   }
+
+  FOnSynchronizeSessionLog(Message);
 }
 //---------------------------------------------------------------------------
 void __fastcall TSynchronizeDialog::DoLog(TSynchronizeController * /*Controller*/,

+ 2 - 0
source/forms/Synchronize.h

@@ -77,6 +77,7 @@ private:
   TSynchronizeParamType FParams;
   TSynchronizeStartStopEvent FOnStartStop;
   TGetSynchronizeOptionsEvent FOnGetOptions;
+  TSynchronizeSessionLog FOnSynchronizeSessionLog;
   int FOptions;
   int FCopyParamAttrs;
   bool FSynchronizing;
@@ -125,6 +126,7 @@ public:
   __fastcall TSynchronizeDialog(TComponent * Owner);
   void __fastcall Init(TSynchronizeStartStopEvent OnStartStop,
     TGetSynchronizeOptionsEvent OnGetOptions,
+    TSynchronizeSessionLog OnSynchronizeSessionLog,
     TFeedSynchronizeError & OnFeedSynchronizeError, bool StartImmediately);
   virtual __fastcall ~TSynchronizeDialog();
 

+ 1 - 0
source/windows/ConsoleRunner.cpp

@@ -1724,6 +1724,7 @@ void __fastcall TConsoleRunner::SynchronizeControllerLog(
   const UnicodeString Message)
 {
   PrintMessage(Message);
+  LogSynchronizeEvent(FScript->Terminal, Message);
 }
 //---------------------------------------------------------------------------
 void __fastcall TConsoleRunner::SynchronizeControllerAbort(TObject * /*Sender*/,

+ 8 - 0
source/windows/SynchronizeController.cpp

@@ -267,3 +267,11 @@ void __fastcall TSynchronizeController::SynchronizeDirectoriesChange(
 {
   SynchronizeLog(slDirChange, FMTLOAD(SYNCHRONIZE_START, (Directories)));
 }
+//---------------------------------------------------------------------------
+void __fastcall LogSynchronizeEvent(TTerminal * Terminal, const UnicodeString & Message)
+{
+  if (Terminal != NULL)
+  {
+    Terminal->LogEvent(FORMAT("Keep up to date: %s", (Message)));
+  }
+}

+ 2 - 0
source/windows/SynchronizeController.h

@@ -83,4 +83,6 @@ private:
   void __fastcall SynchronizeDirectoriesChange(TObject * Sender, int Directories);
 };
 //---------------------------------------------------------------------------
+void __fastcall LogSynchronizeEvent(TTerminal * Terminal, const UnicodeString & Message);
+//---------------------------------------------------------------------------
 #endif

+ 3 - 0
source/windows/WinInterface.h

@@ -318,6 +318,8 @@ const soNoMinimize =       0x02;
 const soAllowSelectedOnly = 0x04;
 typedef void __fastcall (__closure *TGetSynchronizeOptionsEvent)
   (int Params, TSynchronizeOptions & Options);
+typedef void __fastcall (__closure *TSynchronizeSessionLog)
+  (const UnicodeString & Message);
 typedef void __fastcall (__closure *TFeedSynchronizeError)
   (const UnicodeString & Message, TStrings * MoreMessages, TQueryType Type,
    const UnicodeString & HelpKeyword);
@@ -325,6 +327,7 @@ bool __fastcall DoSynchronizeDialog(TSynchronizeParamType & Params,
   const TCopyParamType * CopyParams, TSynchronizeStartStopEvent OnStartStop,
   bool & SaveSettings, int Options, int CopyParamAttrs,
   TGetSynchronizeOptionsEvent OnGetOptions,
+  TSynchronizeSessionLog OnSynchronizeSessionLog,
   TFeedSynchronizeError & OnFeedSynchronizeError,
   bool Start);