summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-09-10 19:43:01 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-09-10 19:43:01 +0300
commit8ae4a1dc21b72aea5dac2ae1badd91238682ae45 (patch)
tree82a51fb9c4f032c6226503b26b16848bd9a4583c /plugins/PluginUpdater/src
parent22c5c5accc245edf6ec0e0c1366b60b8bd060e4f (diff)
Plugin Updater: new option to tune the number of backups to keep (3 by default)
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r--plugins/PluginUpdater/src/Options.cpp6
-rw-r--r--plugins/PluginUpdater/src/PluginUpdater.cpp3
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp2
-rw-r--r--plugins/PluginUpdater/src/resource.h4
-rw-r--r--plugins/PluginUpdater/src/stdafx.h2
5 files changed, 12 insertions, 5 deletions
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index 63f8d3894a..b052cb06d0 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -72,6 +72,7 @@ wchar_t* GetDefaultUrl()
class COptionsDlg : public CDlgBase
{
+ CCtrlSpin spinBackups;
CCtrlCombo cmbPeriod;
CCtrlCheck chkPeriod, chkStable, chkStableSym, chkTrunk, chkTrunkSym, chkCustom;
CCtrlCheck chkHttps, chkPlatform, chkStartup, chkAutoRestart, chkOnlyOnce, chkBackup, chkSilent;
@@ -124,7 +125,9 @@ public:
chkTrunkSym(this, IDC_TRUNK_SYMBOLS),
chkStable(this, IDC_STABLE),
chkStableSym(this, IDC_STABLE_SYMBOLS),
- chkCustom(this, IDC_CUSTOM)
+ chkCustom(this, IDC_CUSTOM),
+
+ spinBackups(this, IDC_BACKUPS_SPIN, 10, 1)
{
CreateLink(chkHttps, g_plugin.bUseHttps);
CreateLink(chkBackup, g_plugin.bBackup);
@@ -133,6 +136,7 @@ public:
CreateLink(chkStartup, g_plugin.bUpdateOnStartup);
CreateLink(chkOnlyOnce, g_plugin.bOnlyOnceADay);
CreateLink(chkAutoRestart, g_plugin.bAutoRestart);
+ CreateLink(spinBackups, g_plugin.iNumberBackups);
chkPlatform.OnChange = chkHttps.OnChange = Callback(this, &COptionsDlg::onChange_Url);
chkPeriod.OnChange = Callback(this, &COptionsDlg::onChange_Period);
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp
index 108bac717b..176844452a 100644
--- a/plugins/PluginUpdater/src/PluginUpdater.cpp
+++ b/plugins/PluginUpdater/src/PluginUpdater.cpp
@@ -59,7 +59,8 @@ CMPlugin::CMPlugin() :
// other settings
iPeriod(MODULENAME, "Period", 1),
- iPeriodMeasure(MODULENAME, "PeriodMeasure", 1)
+ iPeriodMeasure(MODULENAME, "PeriodMeasure", 1),
+ iNumberBackups(MODULENAME, "NumberOfBackups", 3)
{
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 72d7e5fd4a..8794b2b1e0 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -458,7 +458,7 @@ void CreateWorkFolders(TFileName &wszTempFolder, TFileName &wszBackupFolder)
} while (FindNextFileW(hFind, &fdata));
// remove all folders with lesser dates if there're more than 10 folders
- while (arNames.getCount() > 9) {
+ while (arNames.getCount() >= g_plugin.iNumberBackups) {
SafeDeleteDirectory(arNames[0]);
arNames.remove(00);
}
diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h
index 9105bba95a..a31fb28440 100644
--- a/plugins/PluginUpdater/src/resource.h
+++ b/plugins/PluginUpdater/src/resource.h
@@ -64,6 +64,8 @@
#define IDC_ERR_BG 1061
#define IDC_INFO_MESSAGES_BG 1062
#define IDC_AUTORESTART 1063
+#define IDC_NUMBER_BACKUPS 1064
+#define IDC_BACKUPS_SPIN 1066
// Next default values for new objects
//
@@ -71,7 +73,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40075
-#define _APS_NEXT_CONTROL_VALUE 1064
+#define _APS_NEXT_CONTROL_VALUE 1067
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h
index ed46c7c286..3e9f3e1b72 100644
--- a/plugins/PluginUpdater/src/stdafx.h
+++ b/plugins/PluginUpdater/src/stdafx.h
@@ -169,7 +169,7 @@ struct CMPlugin : public PLUGIN<CMPlugin>
// common options
CMOption<bool> bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bSilentMode, bBackup, bChangePlatform, bUseHttps, bAutoRestart;
- CMOption<int> iPeriod, iPeriodMeasure;
+ CMOption<int> iPeriod, iPeriodMeasure, iNumberBackups;
// popup options
CMOption<BYTE> PopupDefColors, PopupLeftClickAction, PopupRightClickAction;