From 2297d8f2a8749ea9ffebbd13cdd9e903932fa3c8 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 27 Feb 2016 16:42:21 +0000 Subject: git-svn-id: http://svn.miranda-ng.org/main/trunk@16366 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_mdb/res/dbx_mdb.rc | 16 +++++++++++----- plugins/Dbx_mdb/src/dbcrypt.cpp | 11 ++++++++++- plugins/Dbx_mdb/src/resource.h | 11 ++++++----- plugins/Dbx_mdb/src/ui.h | 8 ++++++++ 4 files changed, 35 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/plugins/Dbx_mdb/res/dbx_mdb.rc b/plugins/Dbx_mdb/res/dbx_mdb.rc index 5b9d0e9858..5d9649518c 100644 --- a/plugins/Dbx_mdb/res/dbx_mdb.rc +++ b/plugins/Dbx_mdb/res/dbx_mdb.rc @@ -12,7 +12,7 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// English (United States) resources +// Английский (США) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -30,8 +30,10 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,113,55,50,14 PUSHBUTTON "Cancel",IDCANCEL,172,55,50,14 - COMBOBOX IDC_SELECTCRYPT_COMBO,16,14,199,30,CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP - LTEXT "",IDC_CRYPTOPROVIDER_DESCR,18,34,197,14,NOT WS_GROUP + COMBOBOX IDC_SELECTCRYPT_COMBO,16,12,199,30,CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP + LTEXT "",IDC_CRYPTOPROVIDER_DESCR,17,29,197,14,NOT WS_GROUP + CONTROL "Total encryption (Recommended only for paranoid users)",IDC_CHECK_TOTALCRYPT, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,14,45,89,24 END IDD_LOGIN DIALOGEX 0, 0, 190, 86 @@ -104,8 +106,8 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_LOGO ICON "logo.ico" IDI_ICONPASS ICON "pass.ico" +IDI_LOGO ICON "logo.ico" ///////////////////////////////////////////////////////////////////////////// // @@ -115,6 +117,10 @@ IDI_ICONPASS ICON "pass.ico" #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN + IDD_SELECT_CRYPTOPROVIDER, DIALOG + BEGIN + END + IDD_LOGIN, DIALOG BEGIN END @@ -154,7 +160,7 @@ END #endif // APSTUDIO_INVOKED -#endif // English (United States) resources +#endif // Английский (США) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Dbx_mdb/src/dbcrypt.cpp b/plugins/Dbx_mdb/src/dbcrypt.cpp index 31d7f69dda..e55d7f38aa 100644 --- a/plugins/Dbx_mdb/src/dbcrypt.cpp +++ b/plugins/Dbx_mdb/src/dbcrypt.cpp @@ -34,22 +34,31 @@ CRYPTO_PROVIDER* CDbxMdb::SelectProvider() CRYPTO_PROVIDER **ppProvs, *pProv; int iNumProvs; Crypto_EnumProviders(&iNumProvs, &ppProvs); + if (iNumProvs == 0) return nullptr; + bool bTotalCrypt = false; + if (iNumProvs > 1) { CSelectCryptoDialog dlg(ppProvs, iNumProvs); dlg.DoModal(); pProv = dlg.GetSelected(); + bTotalCrypt = dlg.TotalSelected(); } else pProv = ppProvs[0]; for (;; Remap()) { txn_ptr txn(m_pMdbEnv); + MDB_val key = { sizeof(DBKEY_PROVIDER), DBKEY_PROVIDER }, value = { mir_strlen(pProv->pszName) + 1, pProv->pszName }; - mdb_put(txn, m_dbCrypto, &key, &value, 0); + MDB_CHECK(mdb_put(txn, m_dbCrypto, &key, &value, 0), nullptr); + + key.mv_size = sizeof(DBKEY_IS_ENCRYPTED); key.mv_data = DBKEY_IS_ENCRYPTED; value.mv_size = sizeof(bool); value.mv_data = &bTotalCrypt; + MDB_CHECK(mdb_put(txn, m_dbCrypto, &key, &value, 0), nullptr); + if (txn.commit()) break; } diff --git a/plugins/Dbx_mdb/src/resource.h b/plugins/Dbx_mdb/src/resource.h index cd5530394c..2b197f31ef 100644 --- a/plugins/Dbx_mdb/src/resource.h +++ b/plugins/Dbx_mdb/src/resource.h @@ -1,10 +1,8 @@ //{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by D:\Myranda\plugins\Db3x_mmap\res\db3x_mmap.rc +// Включаемый файл, созданный в Microsoft Visual C++. +// Используется d:\Others\SVN\MirandaNG\trunk\plugins\Dbx_mdb\res\dbx_mdb.rc // - #define IDREMOVE 3 - #define IDI_ICONPASS 100 #define IDI_LOGO 101 #define IDD_LOGIN 102 @@ -22,13 +20,16 @@ #define IDC_TOTAL 1008 #define IDC_SELECTCRYPT_COMBO 1010 #define IDC_CRYPTOPROVIDER_DESCR 1011 +#define IDC_CHECK1 1012 +#define IDC_CHECK_TOTALCRYPT 1012 + // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 107 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1012 +#define _APS_NEXT_CONTROL_VALUE 1013 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/plugins/Dbx_mdb/src/ui.h b/plugins/Dbx_mdb/src/ui.h index c29659b3d2..4ee297e81f 100644 --- a/plugins/Dbx_mdb/src/ui.h +++ b/plugins/Dbx_mdb/src/ui.h @@ -48,9 +48,11 @@ class CSelectCryptoDialog : public CDlgBase { CCtrlCombo m_combo; CCtrlData m_descr; + CCtrlCheck m_chkTotalCrypt; CRYPTO_PROVIDER **m_provs; size_t m_provscount; CRYPTO_PROVIDER *m_selected; + bool m_bTotalEncryption; void OnInitDialog() { @@ -66,6 +68,7 @@ class CSelectCryptoDialog : public CDlgBase void OnClose() { m_selected = m_provs[ m_combo.GetItemData(m_combo.GetCurSel()) ]; + m_bTotalEncryption = m_chkTotalCrypt.GetState() != 0; } void OnComboChanged(CCtrlCombo*) @@ -78,6 +81,7 @@ public: CDlgBase(g_hInst, IDD_SELECT_CRYPTOPROVIDER), m_combo(this, IDC_SELECTCRYPT_COMBO), m_descr(this, IDC_CRYPTOPROVIDER_DESCR), + m_chkTotalCrypt(this, IDC_CHECK_TOTALCRYPT), m_provs(provs), m_provscount(count), m_selected(nullptr) @@ -89,6 +93,10 @@ public: { return m_selected; } + inline bool TotalSelected() + { + return m_bTotalEncryption; + } }; struct DlgChangePassParam -- cgit v1.2.3