From 22fa808cca12864de4a914e6f8de72b3cbcd46af Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Thu, 18 Feb 2016 13:04:55 +0000 Subject: db3x_mmap: cryptoprovider select dialog git-svn-id: http://svn.miranda-ng.org/main/trunk@16302 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/res/db3x_mmap.rc | 51 +++++++++++++++++++++++++++++++++++--- plugins/Db3x_mmap/src/dbcrypt.cpp | 8 +++++- plugins/Db3x_mmap/src/resource.h | 12 ++++----- plugins/Db3x_mmap/src/stdafx.h | 4 +++ plugins/Db3x_mmap/src/ui.h | 37 +++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 plugins/Db3x_mmap/src/ui.h (limited to 'plugins/Db3x_mmap') diff --git a/plugins/Db3x_mmap/res/db3x_mmap.rc b/plugins/Db3x_mmap/res/db3x_mmap.rc index 3f12bcfe98..3bd874bacf 100644 --- a/plugins/Db3x_mmap/res/db3x_mmap.rc +++ b/plugins/Db3x_mmap/res/db3x_mmap.rc @@ -12,7 +12,52 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// English (United States) resources +// Русский (Россия) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +#pragma code_page(1251) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_SELECT_CRYPTOPROVIDER DIALOGEX 0, 0, 229, 76 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Select crypto provider" +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,15,23,199,30,CBS_DROPDOWN | CBS_SORT | WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_SELECT_CRYPTOPROVIDER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 222 + TOPMARGIN, 7 + BOTTOMMARGIN, 69 + END +END +#endif // APSTUDIO_INVOKED + +#endif // Русский (Россия) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Английский (США) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -93,8 +138,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" ///////////////////////////////////////////////////////////////////////////// // @@ -143,7 +188,7 @@ END #endif // APSTUDIO_INVOKED -#endif // English (United States) resources +#endif // Английский (США) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 7a1dbe996a..b2f72c50d6 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -144,7 +144,13 @@ int CDb3Mmap::InitCrypt() if (iNumProvs == 0) return 1; - pProvider = ppProvs[0]; //!!!!!!!!!!!!!!!!!! + if (iNumProvs > 1) + { + CSelectCryptoDialog dlg(ppProvs, iNumProvs); + dlg.DoModal(); + pProvider = dlg.GetSelected(); + } + else pProvider = ppProvs[0]; DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "Provider" }; dbcws.value.type = DBVT_BLOB; diff --git a/plugins/Db3x_mmap/src/resource.h b/plugins/Db3x_mmap/src/resource.h index be74c3e5e8..db0d501fcb 100644 --- a/plugins/Db3x_mmap/src/resource.h +++ b/plugins/Db3x_mmap/src/resource.h @@ -1,16 +1,15 @@ //{{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\Db3x_mmap\res\db3x_mmap.rc // - #define IDREMOVE 3 - #define IDI_ICONPASS 100 #define IDI_LOGO 101 #define IDD_LOGIN 102 #define IDD_NEWPASS 103 #define IDD_CHANGEPASS 104 #define IDD_OPTIONS 105 +#define IDD_SELECT_CRYPTOPROVIDER 106 #define IDC_HEADERBAR 1001 #define IDC_LANG 1002 #define IDC_USERPASS 1003 @@ -19,14 +18,15 @@ #define IDC_OLDPASS 1006 #define IDC_STANDARD 1007 #define IDC_TOTAL 1008 +#define IDC_SELECTCRYPT_COMBO 1010 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 106 +#define _APS_NEXT_RESOURCE_VALUE 107 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1009 +#define _APS_NEXT_CONTROL_VALUE 1011 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/plugins/Db3x_mmap/src/stdafx.h b/plugins/Db3x_mmap/src/stdafx.h index c316044348..e2784ab0c1 100644 --- a/plugins/Db3x_mmap/src/stdafx.h +++ b/plugins/Db3x_mmap/src/stdafx.h @@ -39,16 +39,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include "database.h" #include "dbintf.h" #include "resource.h" #include "version.h" + extern HINSTANCE g_hInst; extern LIST g_Dbs; extern DBSignature dbSignatureU, dbSignatureE, dbSignatureIM, dbSignatureSA, dbSignatureSD; +#include "ui.h" + #ifdef __GNUC__ #define mir_i64(x) (x##LL) #else diff --git a/plugins/Db3x_mmap/src/ui.h b/plugins/Db3x_mmap/src/ui.h new file mode 100644 index 0000000000..b818b64adf --- /dev/null +++ b/plugins/Db3x_mmap/src/ui.h @@ -0,0 +1,37 @@ + + +class CSelectCryptoDialog : public CDlgBase +{ + CCtrlCombo m_combo; + CRYPTO_PROVIDER **m_provs; + size_t m_provscount; + CRYPTO_PROVIDER *m_selected; +public: + CSelectCryptoDialog(CRYPTO_PROVIDER **provs, size_t count) : + CDlgBase(g_hInst, IDD_SELECT_CRYPTOPROVIDER), + m_combo(this, IDC_SELECTCRYPT_COMBO), + m_provs(provs), + m_provscount(count), + m_selected(nullptr) + { + } + void OnInitDialog() + { + for (size_t i = 0; i < m_provscount; i++) + { + CRYPTO_PROVIDER *prov = m_provs[i]; + m_combo.AddStringA(prov->pszName, i); + } + m_combo.SetCurSel(0); + } + void OnClose() + { + m_selected = m_provs[ m_combo.GetItemData(m_combo.GetCurSel()) ]; + } + + inline CRYPTO_PROVIDER* GetSelected() + { + return m_selected; + } + +}; \ No newline at end of file -- cgit v1.2.3