summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-12-08 22:54:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-12-08 22:54:21 +0000
commit3c001302667561bb3c3458ed0a78699e5e93be82 (patch)
treebd15d845c29ca1b391ae40154e66844b088ba088 /plugins/Db3x_mmap/src
parent04186af283b3bfa0278e9ad8b223a5c70f3d8158 (diff)
mmap options dialog
git-svn-id: http://svn.miranda-ng.org/main/trunk@7100 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src')
-rw-r--r--plugins/Db3x_mmap/src/commonheaders.h1
-rw-r--r--plugins/Db3x_mmap/src/resource.h10
-rw-r--r--plugins/Db3x_mmap/src/ui.cpp47
3 files changed, 54 insertions, 4 deletions
diff --git a/plugins/Db3x_mmap/src/commonheaders.h b/plugins/Db3x_mmap/src/commonheaders.h
index 9cbdf6dc0e..471aa33453 100644
--- a/plugins/Db3x_mmap/src/commonheaders.h
+++ b/plugins/Db3x_mmap/src/commonheaders.h
@@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_langpack.h>
#include <m_clist.h>
#include <m_icolib.h>
+#include <m_options.h>
#include <m_crypto.h>
#include "database.h"
diff --git a/plugins/Db3x_mmap/src/resource.h b/plugins/Db3x_mmap/src/resource.h
index 071a0af2e6..be74c3e5e8 100644
--- a/plugins/Db3x_mmap/src/resource.h
+++ b/plugins/Db3x_mmap/src/resource.h
@@ -10,21 +10,23 @@
#define IDD_LOGIN 102
#define IDD_NEWPASS 103
#define IDD_CHANGEPASS 104
-
+#define IDD_OPTIONS 105
#define IDC_HEADERBAR 1001
#define IDC_LANG 1002
#define IDC_USERPASS 1003
#define IDC_USERPASS1 1004
#define IDC_USERPASS2 1005
#define IDC_OLDPASS 1006
+#define IDC_STANDARD 1007
+#define IDC_TOTAL 1008
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 103
+#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_CONTROL_VALUE 1009
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp
index 8e98974c09..3e50702048 100644
--- a/plugins/Db3x_mmap/src/ui.cpp
+++ b/plugins/Db3x_mmap/src/ui.cpp
@@ -244,6 +244,51 @@ static INT_PTR ChangePassword(void* obj, LPARAM, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
+INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ CDb3Mmap *db = (CDb3Mmap *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+
+ db = (CDb3Mmap*)lParam;
+ CheckRadioButton(hwndDlg, IDC_STANDARD, IDC_TOTAL, IDC_STANDARD + db->isEncrypted());
+ return TRUE;
+
+ case WM_COMMAND:
+ if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_TOTAL) == (BOOL)db->isEncrypted())
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+static int OnOptionsInit(PVOID obj, WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
+ odp.position = -790000000;
+ odp.hInstance = g_hInst;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pszTitle = LPGEN("Database");
+ odp.pfnDlgProc = DlgProcOptions;
+ odp.dwInitParam = (LPARAM)obj;
+ Options_AddPage(wParam, &odp);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
void CDb3Mmap::UpdateMenuItem()
{
CLISTMENUITEM mi = { sizeof(mi) };
@@ -259,6 +304,8 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
Icon_Register(g_hInst, LPGEN("Database"), iconList, SIZEOF(iconList), "mmap");
+ HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, db);
+
// main menu item
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszName = LPGEN("Database");