diff options
author | George Hazan <ghazan@miranda.im> | 2021-04-02 15:20:10 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-04-02 15:20:15 +0300 |
commit | ff474015eef9bbd70db28c1c64f97297dec9182e (patch) | |
tree | ea9a4be0aa6bebc0ec8d010d24b3f66ee2d68a87 | |
parent | 196e2c40f83b9a73fc3bb53e3d9341bb7440ee51 (diff) |
fixes #2827 (Db_autobackups: обновлять подсказку о времени следующего резервного копирования после нажатия кнопки "Сейчас")
-rw-r--r-- | plugins/Db_autobackups/src/backup.cpp | 1 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/main.cpp | 1 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/options.cpp | 14 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/stdafx.h | 6 |
4 files changed, 21 insertions, 1 deletions
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 1ac63a7bab..fce17e44fd 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -266,6 +266,7 @@ static int Backup(wchar_t *backup_filename) UpdateWindow(progress_dialog);
}
g_plugin.setDword("LastBackupTimestamp", (DWORD)time(0));
+ NotifyEventHooks(g_plugin.hevBackup);
if (g_plugin.use_cloudfile) {
CFUPLOADDATA ui = { g_plugin.cloudfile_service, dest_file, L"Backups" };
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index fa7dc4199a..5fd1b5172c 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -173,6 +173,7 @@ int CMPlugin::Load() CreateServiceFunction(MS_AB_BACKUP, ABService);
CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
+ hevBackup = CreateHookableEvent(ME_AUTOBACKUP_DONE);
HookEvent(ME_OPT_INITIALISE, OptionsInit);
SetBackupTimer();
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index d0688efd59..f6f3808174 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -1,5 +1,7 @@ #include "stdafx.h"
+#define WM_BACKUP_DONE (WM_USER+1)
+
/////////////////////////////////////////////////////////////////////////////////////////
class COptionsDlg : public CDlgBase
@@ -113,6 +115,16 @@ class COptionsDlg : public CDlgBase CCtrlHyperlink m_foldersPageLink;
HWND m_hPathTip;
+ HANDLE m_hEvent;
+
+ UI_MESSAGE_MAP(COptionsDlg, CDlgBase);
+ UI_MESSAGE(WM_BACKUP_DONE, BackupDone);
+ UI_MESSAGE_MAP_END();
+
+ INT_PTR BackupDone(UINT, WPARAM, LPARAM)
+ {
+ onChange_Period(0);
+ }
public:
COptionsDlg() :
@@ -157,6 +169,8 @@ public: bool OnInitDialog() override
{
+ m_hEvent = HookEventMessage(ME_AUTOBACKUP_DONE, m_hwnd, WM_BACKUP_DONE);
+
m_disable.SetState(g_plugin.backup_types == BT_DISABLED);
m_backupOnStart.SetState(g_plugin.backup_types & BT_START ? TRUE : FALSE);
m_backupOnExit.SetState(g_plugin.backup_types & BT_EXIT ? TRUE : FALSE);
diff --git a/plugins/Db_autobackups/src/stdafx.h b/plugins/Db_autobackups/src/stdafx.h index 48ccefd7df..883372ea4d 100644 --- a/plugins/Db_autobackups/src/stdafx.h +++ b/plugins/Db_autobackups/src/stdafx.h @@ -37,10 +37,12 @@ struct CMPlugin : public PLUGIN<CMPlugin> {
CMPlugin();
+ HANDLE hevBackup;
+ wchar_t folder[MAX_PATH];
+
CMOption<BYTE> backup_types;
CMOption<WORD> period;
CMOption<BYTE> period_type;
- wchar_t folder[MAX_PATH];
CMOption<wchar_t*> file_mask;
CMOption<WORD> num_backups;
CMOption<BYTE> disable_progress;
@@ -60,6 +62,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> #define SUB_DIR L"\\AutoBackups"
#define DIR L"%miranda_userdata%"
+#define ME_AUTOBACKUP_DONE "Autobackup/Done"
+
int SetBackupTimer(void);
int OptionsInit(WPARAM wParam, LPARAM lParam);
void BackupStart(wchar_t *backup_filename);
|