diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-03 18:31:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-03 18:31:26 +0000 |
commit | c2a98771e0d195ca4d5be500f4c8ba9fd012d676 (patch) | |
tree | 1c99fcc878fbf0c72fa0f4140ad0390cc6d235fe /plugins/Popup/src | |
parent | 5ae20d4da68c98c2a0d851b4b45da9181e61781c (diff) |
- settings convertor for Popup+;
- various DBCONTACTENUMSETTINGS initialization garbage
git-svn-id: http://svn.miranda-ng.org/main/trunk@5922 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src')
-rw-r--r-- | plugins/Popup/src/config.cpp | 46 | ||||
-rw-r--r-- | plugins/Popup/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/Popup/src/version.h | 2 |
3 files changed, 48 insertions, 2 deletions
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 66fba97b46..79fad37a1d 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -127,4 +127,48 @@ void PopupPreview() if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause
PUShowMessageT(TranslateT("This is an error message"), (DWORD)SM_ERROR|0x80000000);
-}
\ No newline at end of file +}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+struct EnumProcParam
+{
+ LPCSTR szModule, szNewModule;
+};
+
+static int EnumProc(const char *szSetting, LPARAM lParam)
+{
+ EnumProcParam* param = (EnumProcParam*)lParam;
+
+ DBVARIANT dbv;
+ if ( !db_get(NULL, param->szModule, szSetting, &dbv)) {
+ db_set(NULL, param->szNewModule, szSetting, &dbv);
+ db_free(&dbv);
+ }
+ return 0;
+}
+
+static void CopyModule(const char *szModule, const char *szNewModule)
+{
+ EnumProcParam param = { szModule, szNewModule };
+
+ DBCONTACTENUMSETTINGS dbces = { 0 };
+ dbces.pfnEnumProc = EnumProc;
+ dbces.szModule = szModule;
+ dbces.lParam = (LPARAM)¶m;
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+
+ CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
+}
+
+void UpgradeDb()
+{
+ if (db_get_b(NULL, "Compatibility", "Popup+ Opts", 0) == 1)
+ return;
+
+ CopyModule("PopUp", "Popup");
+ CopyModule("PopUpCLASS", "PopupCLASS");
+ CopyModule("PopUpNotifications", "PopupNotifications");
+
+ db_set_b(NULL, "Compatibility", "Popup+ Opts", 1);
+}
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index c74ca3551e..880d92c0c3 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -36,6 +36,7 @@ WORD SETTING_MAXIMUMWIDTH_MAX = GetSystemMetrics(SM_CXSCREEN); //===== Options =====
static int OptionsInitialize(WPARAM,LPARAM);
+void UpgradeDb();
//===== Initializations =====
static int OkToExit(WPARAM,LPARAM);
@@ -365,6 +366,7 @@ MIRAPI int Load(void) RegisterOptPrevBox();
// Register in DBEditor++
+ UpgradeDb();
db_set_s(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h index 5249a5a35a..f7d477b703 100644 --- a/plugins/Popup/src/version.h +++ b/plugins/Popup/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 1
-#define __BUILD_NUM 7
+#define __BUILD_NUM 8
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
|