summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-12 21:21:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-12 21:21:25 +0300
commitb342481c3aca46514b86b6ff94fb87f43437d29e (patch)
treec9a8089243545f2fb2839c0b6320a54646ec4243
parentcdf4c110510a39c162b469ecbd6f69571019cf69 (diff)
DbxMdbx: menu item added for compacting
-rw-r--r--plugins/Dbx_mdbx/res/compact.icobin0 -> 5430 bytes
-rw-r--r--plugins/Dbx_mdbx/res/dbx_mdbx.rc1
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp3
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.h2
-rw-r--r--plugins/Dbx_mdbx/src/resource.h1
-rw-r--r--plugins/Dbx_mdbx/src/ui.cpp19
-rw-r--r--plugins/Dbx_mdbx/src/ui.h4
7 files changed, 26 insertions, 4 deletions
diff --git a/plugins/Dbx_mdbx/res/compact.ico b/plugins/Dbx_mdbx/res/compact.ico
new file mode 100644
index 0000000000..d9c35f5d6d
--- /dev/null
+++ b/plugins/Dbx_mdbx/res/compact.ico
Binary files differ
diff --git a/plugins/Dbx_mdbx/res/dbx_mdbx.rc b/plugins/Dbx_mdbx/res/dbx_mdbx.rc
index 03c0486fe6..53227006e2 100644
--- a/plugins/Dbx_mdbx/res/dbx_mdbx.rc
+++ b/plugins/Dbx_mdbx/res/dbx_mdbx.rc
@@ -108,6 +108,7 @@ END
// remains consistent on all systems.
IDI_ICONPASS ICON "pass.ico"
IDI_LOGO ICON "logo.ico"
+IDI_COMPACT ICON "compact.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index 2c3f8907b8..4ecf9fbe08 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -52,7 +52,8 @@ CDbxMDBX::~CDbxMDBX()
if (m_hwndTimer != nullptr)
::DestroyWindow(m_hwndTimer);
- DestroyServiceFunction(hService);
+ for (auto &it : hService)
+ DestroyServiceFunction(it);
UnhookEvent(hHook);
if (m_crypto)
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h
index 6d998f7d77..1eebe92b2c 100644
--- a/plugins/Dbx_mdbx/src/dbintf.h
+++ b/plugins/Dbx_mdbx/src/dbintf.h
@@ -171,7 +171,7 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject
MDBX_dbi m_dbSettings;
MDBX_cursor *m_curSettings;
- HANDLE hService, hHook;
+ HANDLE hService[2], hHook;
////////////////////////////////////////////////////////////////////////////
// contacts
diff --git a/plugins/Dbx_mdbx/src/resource.h b/plugins/Dbx_mdbx/src/resource.h
index 564189306d..ac0d874da2 100644
--- a/plugins/Dbx_mdbx/src/resource.h
+++ b/plugins/Dbx_mdbx/src/resource.h
@@ -10,6 +10,7 @@
#define IDD_CHANGEPASS 104
#define IDD_OPTIONS 105
#define IDD_SELECT_CRYPTOPROVIDER 106
+#define IDI_COMPACT 107
#define IDC_HEADERBAR 1001
#define IDC_LANG 1002
#define IDC_USERPASS 1003
diff --git a/plugins/Dbx_mdbx/src/ui.cpp b/plugins/Dbx_mdbx/src/ui.cpp
index c70823a7fb..a45fb02082 100644
--- a/plugins/Dbx_mdbx/src/ui.cpp
+++ b/plugins/Dbx_mdbx/src/ui.cpp
@@ -152,6 +152,13 @@ static INT_PTR ChangePassword(void* obj, WPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
+static INT_PTR CompactMe(void* obj, WPARAM, LPARAM)
+{
+ CDbxMDBX *db = (CDbxMDBX*)obj;
+ return db->Compact();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
static int OnOptionsInit(PVOID obj, WPARAM wParam, LPARAM)
{
@@ -186,10 +193,18 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "F7C5567C-D1EE-484B-B4F6-24677A5AAAEF");
SET_UID(mi, 0x50321866, 0xba1, 0x46dd, 0xb3, 0xa6, 0xc3, 0xcc, 0x55, 0xf2, 0x42, 0x9e);
+ mi.position = 1000000001;
mi.hIcolibItem = iconList[1].hIcolib;
mi.name.a = db->GetMenuTitle();
mi.pszService = MS_DB_CHANGEPASSWORD;
hSetPwdMenu = Menu_AddMainMenuItem(&mi);
+
+ SET_UID(mi, 0x98c0caf3, 0xBfe5, 0x4e31, 0xac, 0xf0, 0xab, 0x95, 0xb2, 0x9b, 0x9f, 0x73);
+ mi.position++;
+ mi.hIcolibItem = iconList[2].hIcolib;
+ mi.name.a = LPGEN("Compact");
+ mi.pszService = MS_DB_COMPACT;
+ hSetPwdMenu = Menu_AddMainMenuItem(&mi);
return 0;
}
@@ -197,6 +212,8 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
void CDbxMDBX::InitDialogs()
{
- hService = CreateServiceFunctionObj(MS_DB_CHANGEPASSWORD, ChangePassword, this);
+ hService[0] = CreateServiceFunctionObj(MS_DB_CHANGEPASSWORD, ChangePassword, this);
+ hService[1] = CreateServiceFunctionObj(MS_DB_COMPACT, CompactMe, this);
+
hHook = HookEventObj(ME_SYSTEM_MODULESLOADED, OnModulesLoaded, this);
}
diff --git a/plugins/Dbx_mdbx/src/ui.h b/plugins/Dbx_mdbx/src/ui.h
index 18b8441888..cfaf03b417 100644
--- a/plugins/Dbx_mdbx/src/ui.h
+++ b/plugins/Dbx_mdbx/src/ui.h
@@ -3,10 +3,12 @@
static IconItem iconList[] =
{
{ LPGEN("Logo"), "logo", IDI_LOGO },
- { LPGEN("Password"), "password", IDI_ICONPASS }
+ { LPGEN("Password"), "password", IDI_ICONPASS },
+ { LPGEN("Compact"), "compact", IDI_COMPACT }
};
#define MS_DB_CHANGEPASSWORD "DB/UI/ChangePassword"
+#define MS_DB_COMPACT "DB/UI/Compact"
class COptionsDialog : public CDlgBase
{