diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-07 13:28:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-07 13:28:16 +0300 |
commit | e0d320c3b272bb21655bccfd26e4bd03fe69fd34 (patch) | |
tree | 7917af8801d9c6084534290d9168a415b35864ff | |
parent | 00f5e35c664bd8b2b1b00de3353aa0c3e70f5423 (diff) |
fixes #1888 (DbAutobackuper: move "Disable popups" option to Popus section)
-rw-r--r-- | plugins/Db_autobackups/res/db_autobackups.rc | 13 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/backup.cpp | 5 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/main.cpp | 34 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/options.cpp | 7 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/resource.h | 1 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/stdafx.h | 2 | ||||
-rw-r--r-- | plugins/Db_autobackups/src/version.h | 2 |
7 files changed, 44 insertions, 20 deletions
diff --git a/plugins/Db_autobackups/res/db_autobackups.rc b/plugins/Db_autobackups/res/db_autobackups.rc index bb700851b8..ba0cbfab69 100644 --- a/plugins/Db_autobackups/res/db_autobackups.rc +++ b/plugins/Db_autobackups/res/db_autobackups.rc @@ -23,12 +23,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // Dialog
//
-IDD_OPTIONS DIALOGEX 0, 0, 271, 241
+IDD_OPTIONS DIALOGEX 0, 0, 271, 229
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Automatic backups",IDC_STATIC,6,4,258,226,WS_GROUP
+ GROUPBOX "Automatic backups",IDC_STATIC,6,4,258,215,WS_GROUP
CONTROL "Disabled",IDC_RAD_DISABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,19,128,10
CONTROL "When Miranda starts",IDC_RAD_START,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,32,153,10
CONTROL "When Miranda exits",IDC_RAD_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,45,156,10
@@ -48,10 +48,9 @@ BEGIN EDITTEXT IDC_FILEMASK,17,145,231,14,ES_AUTOHSCROLL
CONTROL "Compress backup to zip-archive",IDC_CHK_USEZIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,165,231,10
CONTROL "Backup profile folder",IDC_BACKUPPROFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,177,176,10
- CONTROL "Disable progress bar",IDC_CHK_NOPROG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,201,231,10
- CONTROL "Disable popups",IDC_CHK_NOPOPUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,188,231,11
- CONTROL "Use CloudFile",IDC_CLOUDFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,213,105,10
- COMBOBOX IDC_CLOUDFILESEVICE,131,211,117,30,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Disable progress bar",IDC_CHK_NOPROG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,191,231,10
+ CONTROL "Use CloudFile",IDC_CLOUDFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,203,105,10
+ COMBOBOX IDC_CLOUDFILESEVICE,131,201,117,30,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Backup NOW",IDC_BUT_NOW,173,19,75,14
END
@@ -82,7 +81,7 @@ BEGIN VERTGUIDE, 193
VERTGUIDE, 248
TOPMARGIN, 4
- BOTTOMMARGIN, 230
+ BOTTOMMARGIN, 219
END
IDD_COPYPROGRESS, DIALOG
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index e36c994ea6..2d6eface9e 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -28,15 +28,16 @@ static LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM static void ShowPopup(const wchar_t *ptszText, wchar_t *ptszHeader, wchar_t *ptszPath)
{
- POPUPDATAW ppd = { 0 };
+ if (g_plugin.bTerminated)
+ return;
+ POPUPDATAW ppd = {};
wcsncpy_s(ppd.lpwzText, ptszText, _TRUNCATE);
wcsncpy_s(ppd.lpwzContactName, ptszHeader, _TRUNCATE);
if (ptszPath != nullptr)
ppd.PluginData = (void*)mir_wstrdup(ptszPath);
ppd.PluginWindowProc = DlgProcPopup;
ppd.lchIcon = IcoLib_GetIcon(iconList[0].szName);
-
PUAddPopupW(&ppd);
}
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 1e0fb8a867..e0522f1c18 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -2,6 +2,7 @@ CMPlugin g_plugin;
+HGENMENU g_hPopupMenu;
HANDLE hFolder;
char g_szMirVer[100];
@@ -38,6 +39,16 @@ CMPlugin::CMPlugin() : /////////////////////////////////////////////////////////////////////////////////////////
+static void UpdateMenuIcons()
+{
+ if (g_plugin.disable_popups)
+ Menu_ModifyItem(g_hPopupMenu, LPGENW("Enable &AutoBackups notification"), Skin_LoadIcon(SKINICON_OTHER_NOPOPUP));
+ else
+ Menu_ModifyItem(g_hPopupMenu, LPGENW("Disable &AutoBackups notification"), Skin_LoadIcon(SKINICON_OTHER_POPUP));
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR ABService(WPARAM, LPARAM)
{
BackupStart(nullptr);
@@ -74,11 +85,19 @@ static int FoldersGetBackupPath(WPARAM, LPARAM) return 0;
}
+static INT_PTR OnTogglePopups(WPARAM, LPARAM)
+{
+ g_plugin.disable_popups = !g_plugin.disable_popups;
+ UpdateMenuIcons();
+ return 0;
+}
+
static int ModulesLoad(WPARAM, LPARAM)
{
CMenuItem mi(&g_plugin);
mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Database"), 500100000);
+ // Main menu items
SET_UID(mi, 0x1439b1db, 0x7d95, 0x495b, 0xbf, 0x5, 0x3d, 0x21, 0xc1, 0xeb, 0xf7, 0x58);
mi.name.a = LPGEN("Backup profile");
mi.pszService = MS_AB_BACKUP;
@@ -93,6 +112,15 @@ static int ModulesLoad(WPARAM, LPARAM) mi.position = 500100001;
Menu_AddMainMenuItem(&mi);
+ // Popup menu item
+ SET_UID(mi, 0xe9250a75, 0x30da, 0x42f2, 0x85, 0x27, 0x54, 0x24, 0x62, 0x59, 0x9e, 0xae);
+ mi.position = 0;
+ mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0);
+ mi.pszService = "DbAutoBackup/EnableDisableMenuCommand";
+ g_hPopupMenu = Menu_AddMainMenuItem(&mi);
+ UpdateMenuIcons();
+ CreateServiceFunction(mi.pszService, &OnTogglePopups);
+
if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) {
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath);
FoldersGetBackupPath(0, 0);
@@ -114,10 +142,10 @@ static int ModulesLoad(WPARAM, LPARAM) // for setting changed event not cleared. the backup on exit function will write to the db, calling those hooks.
static int PreShutdown(WPARAM, LPARAM)
{
- if (g_plugin.backup_types & BT_EXIT) {
- g_plugin.disable_popups = 1; // Don't try to show popups on exit
+ g_plugin.bTerminated = true;
+
+ if (g_plugin.backup_types & BT_EXIT)
BackupStart(nullptr);
- }
return 0;
}
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 760ed9832a..d473220897 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -21,7 +21,6 @@ class COptionsDlg : public CDlgBase m_filemask.Enable(bEnabled);
m_foldersPageLink.Enable(bEnabled);
m_disableProgress.Enable(bEnabled);
- m_disablePopups.Enable(bEnabled);
m_useZip.Enable(bEnabled);
periodText.Enable(bEnabled);
m_period.Enable(bEnabled);
@@ -116,7 +115,6 @@ class COptionsDlg : public CDlgBase CCtrlHyperlink m_foldersPageLink;
CCtrlSpin m_numBackups;
CCtrlCheck m_disableProgress;
- CCtrlCheck m_disablePopups;
CCtrlCheck m_useZip;
CCtrlCheck m_backupProfile;
CCtrlCheck m_useCloudFile;
@@ -133,14 +131,13 @@ public: m_period(this, SPIN_PERIOD, 60, 1), m_periodType(this, IDC_PT),
m_folder(this, IDC_ED_FOLDER), m_browseFolder(this, IDC_BUT_BROWSE), m_filemask(this, IDC_FILEMASK),
m_foldersPageLink(this, IDC_LNK_FOLDERS, nullptr), m_numBackups(this, SPIN_NUMBACKUPS, 9999, 1),
- m_disableProgress(this, IDC_CHK_NOPROG), m_disablePopups(this, IDC_CHK_NOPOPUP),
+ m_disableProgress(this, IDC_CHK_NOPROG),
m_useZip(this, IDC_CHK_USEZIP), m_useCloudFile(this, IDC_CLOUDFILE),
m_cloudFileService(this, IDC_CLOUDFILESEVICE)
{
CreateLink(m_period, g_plugin.period);
CreateLink(m_numBackups, g_plugin.num_backups);
CreateLink(m_disableProgress, g_plugin.disable_progress);
- CreateLink(m_disablePopups, g_plugin.disable_popups);
CreateLink(m_useZip, g_plugin.use_zip);
CreateLink(m_filemask, g_plugin.file_mask);
CreateLink(m_backupProfile, g_plugin.backup_profile);
@@ -194,8 +191,6 @@ public: CreateToolTip(tszTooltipText, TranslateT("Variables"));
}
- m_disablePopups.Show();
-
m_useCloudFile.Enable(ServiceExists(MS_CLOUDFILE_UPLOAD));
if (ServiceExists(MS_CLOUDFILE_ENUMSERVICES)) {
m_cloudFileService.Enable();
diff --git a/plugins/Db_autobackups/src/resource.h b/plugins/Db_autobackups/src/resource.h index 27877575a0..7f267cb442 100644 --- a/plugins/Db_autobackups/src/resource.h +++ b/plugins/Db_autobackups/src/resource.h @@ -19,7 +19,6 @@ #define IDC_LNK_FOLDERS 1669
#define IDC_CHK_NOPROG 1670
#define IDC_BUT_NOW 1671
-#define IDC_CHK_NOPOPUP 1672
#define IDC_CHK_USEZIP 1673
#define IDC_CLOUDFILE 1674
#define IDC_BACKUPPROFILE 1675
diff --git a/plugins/Db_autobackups/src/stdafx.h b/plugins/Db_autobackups/src/stdafx.h index 94584b3e26..6441129c37 100644 --- a/plugins/Db_autobackups/src/stdafx.h +++ b/plugins/Db_autobackups/src/stdafx.h @@ -19,6 +19,7 @@ namespace fs = std::experimental::filesystem; #include <m_langpack.h>
#include <m_options.h>
#include <m_popup.h>
+#include <m_skin.h>
#include <m_icolib.h>
#include <m_autobackups.h>
#include <m_gui.h>
@@ -33,6 +34,7 @@ struct CMPlugin : public PLUGIN<CMPlugin> {
CMPlugin();
+ bool bTerminated;
CMOption<BYTE> backup_types;
CMOption<WORD> period;
CMOption<BYTE> period_type;
diff --git a/plugins/Db_autobackups/src/version.h b/plugins/Db_autobackups/src/version.h index 1f2b15fa60..4f3f7f9111 100644 --- a/plugins/Db_autobackups/src/version.h +++ b/plugins/Db_autobackups/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
|