From b342481c3aca46514b86b6ff94fb87f43437d29e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 12 Apr 2018 21:21:25 +0300 Subject: DbxMdbx: menu item added for compacting --- plugins/Dbx_mdbx/src/dbintf.cpp | 3 ++- plugins/Dbx_mdbx/src/dbintf.h | 2 +- plugins/Dbx_mdbx/src/resource.h | 1 + plugins/Dbx_mdbx/src/ui.cpp | 19 ++++++++++++++++++- plugins/Dbx_mdbx/src/ui.h | 4 +++- 5 files changed, 25 insertions(+), 4 deletions(-) (limited to 'plugins/Dbx_mdbx/src') 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 { -- cgit v1.2.3