summaryrefslogtreecommitdiff
path: root/plugins/Db_autobackups/src
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/src
parent7287b25120a081f769656c775e90b15baf88f53a (diff)
fixes #1623 (Add ability to adjust backup names)
Diffstat (limited to 'plugins/Db_autobackups/src')
-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
6 files changed, 31 insertions, 20 deletions
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>