summaryrefslogtreecommitdiff
path: root/plugins/Db_autobackups
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-10-18 13:50:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-10-18 13:50:49 +0300
commitfdfc25f6b05b21bd300b93dba178cb79d09e2390 (patch)
tree4cef09bd4535c5b98af9f4fa3dfcc9586cc55e40 /plugins/Db_autobackups
parent7287b25120a081f769656c775e90b15baf88f53a (diff)
fixes #1623 (Add ability to adjust backup names)
Diffstat (limited to 'plugins/Db_autobackups')
-rw-r--r--plugins/Db_autobackups/res/db_autobackups.rc50
-rw-r--r--plugins/Db_autobackups/src/backup.cpp14
-rw-r--r--plugins/Db_autobackups/src/main.cpp1
-rw-r--r--plugins/Db_autobackups/src/options.cpp6
-rw-r--r--plugins/Db_autobackups/src/resource.h5
-rw-r--r--plugins/Db_autobackups/src/stdafx.h23
-rw-r--r--plugins/Db_autobackups/src/version.h2
7 files changed, 57 insertions, 44 deletions
diff --git a/plugins/Db_autobackups/res/db_autobackups.rc b/plugins/Db_autobackups/res/db_autobackups.rc
index 10921058ca..adf279adfc 100644
--- a/plugins/Db_autobackups/res/db_autobackups.rc
+++ b/plugins/Db_autobackups/res/db_autobackups.rc
@@ -23,34 +23,36 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
// Dialog
//
-IDD_OPTIONS DIALOGEX 0, 0, 271, 220
+IDD_OPTIONS DIALOGEX 0, 0, 271, 241
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,205,WS_GROUP
- PUSHBUTTON "Backup NOW",IDC_BUT_NOW,173,19,75,14
+ GROUPBOX "Automatic backups",IDC_STATIC,6,4,258,226,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,35,156,10
- CONTROL "When Miranda exits",IDC_RAD_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,51,156,10
- CONTROL "Every:",IDC_RAD_PERIODIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,67,43,10
- EDITTEXT IDC_ED_PERIOD,116,67,30,12,ES_NUMBER,WS_EX_RIGHT
- CONTROL "",SPIN_PERIOD,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,136,67,10,12
- COMBOBOX IDC_PT,148,67,46,30,CBS_DROPDOWNLIST | WS_TABSTOP
- RTEXT "Number of backups to keep:",IDC_STATIC,13,92,147,8
- EDITTEXT IDC_ED_NUMBACKUPS,164,90,36,12,ES_NUMBER,WS_EX_RIGHT
- CONTROL "",SPIN_NUMBACKUPS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,188,90,12,12
- LTEXT "Backup to folder:",IDC_STATIC,18,117,124,11
- EDITTEXT IDC_ED_FOLDER,17,130,177,13,ES_AUTOHSCROLL
- PUSHBUTTON "Browse...",IDC_BUT_BROWSE,199,129,49,14
+ 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
+ CONTROL "Every:",IDC_RAD_PERIODIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,58,43,10
+ EDITTEXT IDC_ED_PERIOD,116,58,30,12,ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",SPIN_PERIOD,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,136,58,10,12
+ COMBOBOX IDC_PT,148,58,46,30,CBS_DROPDOWNLIST | WS_TABSTOP
+ RTEXT "Number of backups to keep:",IDC_STATIC,13,85,147,8
+ EDITTEXT IDC_ED_NUMBACKUPS,164,83,36,12,ES_NUMBER,WS_EX_RIGHT
+ CONTROL "",SPIN_NUMBACKUPS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,188,83,12,12
+ LTEXT "Backup to folder:",IDC_STATIC,18,102,124,11
+ EDITTEXT IDC_ED_FOLDER,17,115,177,13,ES_AUTOHSCROLL
+ PUSHBUTTON "Browse...",IDC_BUT_BROWSE,199,114,49,14
CONTROL "Go to the ""Options -> Customize -> Folders"" to change settings",IDC_LNK_FOLDERS,
- "Hyperlink",NOT WS_VISIBLE | WS_TABSTOP,17,126,231,17
- CONTROL "Compress backup to zip-archive",IDC_CHK_USEZIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,149,231,10
- CONTROL "Backup profile folder",IDC_BACKUPPROFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,161,176,10
- CONTROL "Disable progress bar",IDC_CHK_NOPROG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,184,231,10
- CONTROL "Disable popups",IDC_CHK_NOPOPUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,172,231,11
- CONTROL "Use CloudFile",IDC_CLOUDFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,195,105,10
- COMBOBOX IDC_CLOUDFILESEVICE,131,194,117,30,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ "Hyperlink",NOT WS_VISIBLE | WS_TABSTOP,17,111,231,17
+ LTEXT "Backup file mask",IDC_STATIC,17,135,231,8
+ 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
+ PUSHBUTTON "Backup NOW",IDC_BUT_NOW,173,19,75,14
END
IDD_COPYPROGRESS DIALOGEX 0, 0, 186, 58
@@ -79,8 +81,8 @@ BEGIN
VERTGUIDE, 17
VERTGUIDE, 193
VERTGUIDE, 248
- TOPMARGIN, 38
- BOTTOMMARGIN, 209
+ TOPMARGIN, 4
+ BOTTOMMARGIN, 230
END
IDD_COPYPROGRESS, DIALOG
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index 3961618d31..3ff1be80ba 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -215,13 +215,19 @@ static int Backup(wchar_t *backup_filename)
bZip = g_plugin.use_zip != 0;
RotateBackups(backupfolder, dbname);
- SYSTEMTIME st;
- GetLocalTime(&st);
+ CMStringW wszFileName(VARSW(g_plugin.file_mask));
- wchar_t buffer[MAX_COMPUTERNAME_LENGTH + 1];
+ wchar_t buffer[MAX_PATH];
DWORD size = _countof(buffer);
GetComputerName(buffer, &size);
- mir_snwprintf(dest_file, L"%s\\%s_%02d.%02d.%02d@%02d-%02d-%02d_%s.%s", backupfolder, dbname, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, buffer, bZip ? L"zip" : L"dat");
+ wszFileName.Replace(L"%compname%", buffer);
+
+ SYSTEMTIME st;
+ GetLocalTime(&st);
+ mir_snwprintf(buffer, L"%02d.%02d.%02d@%02d-%02d-%02d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
+ wszFileName.Replace(L"%currtime%", buffer);
+
+ mir_snwprintf(dest_file, L"%s\\%s.%s", backupfolder, wszFileName.c_str(), bZip ? L"zip" : L"dat");
}
else {
wcsncpy_s(dest_file, backup_filename, _TRUNCATE);
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp
index 240e21adff..1e0fb8a867 100644
--- a/plugins/Db_autobackups/src/main.cpp
+++ b/plugins/Db_autobackups/src/main.cpp
@@ -26,6 +26,7 @@ CMPlugin::CMPlugin() :
period(MODULENAME, "Period", 1),
period_type(MODULENAME, "PeriodType", PT_DAYS),
num_backups(MODULENAME, "NumBackups", 3),
+ file_mask(MODULENAME, "FileMask", L"%miranda_profilename%.dat_%currtime%_%compname%"),
disable_progress(MODULENAME, "NoProgress", 0),
disable_popups(MODULENAME, "NoPopups", 0),
use_zip(MODULENAME, "UseZip", 0),
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp
index c3091ab006..9279200f20 100644
--- a/plugins/Db_autobackups/src/options.cpp
+++ b/plugins/Db_autobackups/src/options.cpp
@@ -18,6 +18,7 @@ class COptionsDlg : public CDlgBase
m_backup.Enable(bEnabled);
m_folder.Enable(bEnabled);
m_browseFolder.Enable(bEnabled);
+ m_filemask.Enable(bEnabled);
m_foldersPageLink.Enable(bEnabled);
m_disableProgress.Enable(bEnabled);
m_disablePopups.Enable(bEnabled);
@@ -110,7 +111,7 @@ class COptionsDlg : public CDlgBase
CCtrlButton m_backup;
CCtrlSpin m_period;
CCtrlCombo m_periodType;
- CCtrlEdit m_folder;
+ CCtrlEdit m_folder, m_filemask;
CCtrlButton m_browseFolder;
CCtrlHyperlink m_foldersPageLink;
CCtrlSpin m_numBackups;
@@ -130,7 +131,7 @@ public:
m_backupOnExit(this, IDC_RAD_EXIT), m_backupPeriodic(this, IDC_RAD_PERIODIC),
m_backup(this, IDC_BUT_NOW), m_backupProfile(this, IDC_BACKUPPROFILE),
m_period(this, SPIN_PERIOD), m_periodType(this, IDC_PT),
- m_folder(this, IDC_ED_FOLDER), m_browseFolder(this, IDC_BUT_BROWSE),
+ 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),
m_disableProgress(this, IDC_CHK_NOPROG), m_disablePopups(this, IDC_CHK_NOPOPUP),
m_useZip(this, IDC_CHK_USEZIP), m_useCloudFile(this, IDC_CLOUDFILE),
@@ -141,6 +142,7 @@ public:
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);
CreateLink(m_useCloudFile, g_plugin.use_cloudfile);
diff --git a/plugins/Db_autobackups/src/resource.h b/plugins/Db_autobackups/src/resource.h
index ed8683260b..27877575a0 100644
--- a/plugins/Db_autobackups/src/resource.h
+++ b/plugins/Db_autobackups/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by D:\Projects\c++\miranda-ng\plugins\Db_autobackups\res\db_autobackups.rc
+// Used by w:\miranda-ng\plugins\Db_autobackups\res\db_autobackups.rc
//
#define IDD_OPTIONS 101
#define IDI_BACKUP 270
@@ -24,6 +24,7 @@
#define IDC_CLOUDFILE 1674
#define IDC_BACKUPPROFILE 1675
#define IDC_CLOUDFILESEVICE 1676
+#define IDC_FILEMASK 1677
#define IDC_PROGRESSMESSAGE 0xDAED
#define IDC_PROGRESS 0xDEAD
@@ -33,7 +34,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 273
#define _APS_NEXT_COMMAND_VALUE 40018
-#define _APS_NEXT_CONTROL_VALUE 1677
+#define _APS_NEXT_CONTROL_VALUE 1678
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/Db_autobackups/src/stdafx.h b/plugins/Db_autobackups/src/stdafx.h
index 6a9336b47b..4a43f66e66 100644
--- a/plugins/Db_autobackups/src/stdafx.h
+++ b/plugins/Db_autobackups/src/stdafx.h
@@ -32,17 +32,18 @@ struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin();
- CMOption<BYTE> backup_types;
- CMOption<WORD> period;
- CMOption<BYTE> period_type;
- wchar_t folder[MAX_PATH];
- CMOption<WORD> num_backups;
- CMOption<BYTE> disable_progress;
- CMOption<BYTE> disable_popups;
- CMOption<BYTE> use_zip;
- CMOption<BYTE> backup_profile;
- CMOption<BYTE> use_cloudfile;
- CMOption<char*> cloudfile_service;
+ 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;
+ CMOption<BYTE> disable_popups;
+ CMOption<BYTE> use_zip;
+ CMOption<BYTE> backup_profile;
+ CMOption<BYTE> use_cloudfile;
+ CMOption<char*> cloudfile_service;
int Load() override;
};
diff --git a/plugins/Db_autobackups/src/version.h b/plugins/Db_autobackups/src/version.h
index a67a29943a..7b922e4db7 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 1
+#define __BUILD_NUM 2
#include <stdver.h>