summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/dialogs.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-02-09 16:02:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-02-09 16:02:23 +0000
commitff22a9442b5464ef0de4273bbdeb74ea1957bf17 (patch)
tree55ff04f178a17fe5999bb55b3aa1f245468bee9d /protocols/WhatsApp/src/dialogs.cpp
parentb7c78a98ba81a12e7f0e4772cc438b65ea3ca94b (diff)
options' dialog improvements
git-svn-id: http://svn.miranda-ng.org/main/trunk@12067 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/dialogs.cpp')
-rw-r--r--protocols/WhatsApp/src/dialogs.cpp52
1 files changed, 33 insertions, 19 deletions
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp
index 67c12c7475..17048df398 100644
--- a/protocols/WhatsApp/src/dialogs.cpp
+++ b/protocols/WhatsApp/src/dialogs.cpp
@@ -15,7 +15,9 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendDlgItemMessage(hwndDlg, IDC_PW, EM_LIMITTEXT, 3, 0);
SendDlgItemMessage(hwndDlg, IDC_PW2, EM_LIMITTEXT, 3, 0);
+
CheckDlgButton(hwndDlg, IDC_SSL, db_get_b(NULL, proto->m_szModuleName, WHATSAPP_KEY_SSL, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTORUN, proto->getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? BST_CHECKED : BST_UNCHECKED);
{
ptrA szStr(proto->getStringA(WHATSAPP_KEY_CC));
if (szStr != NULL)
@@ -27,18 +29,10 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
if ((szStr = proto->getStringA(WHATSAPP_KEY_NICK)) != NULL)
SetDlgItemTextA(hwndDlg, IDC_NICK, szStr);
}
+ SetDlgItemText(hwndDlg, IDC_DEFGROUP, proto->m_tszDefaultGroup);
EnableWindow(GetDlgItem(hwndDlg, IDC_PW), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PW2), FALSE);
-
- if (!proto->isOffline()) {
- SendDlgItemMessage(hwndDlg, IDC_CC, EM_SETREADONLY, 1, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOGIN, EM_SETREADONLY, 1, 0);
- SendDlgItemMessage(hwndDlg, IDC_NICK, EM_SETREADONLY, 1, 0);
- SendDlgItemMessage(hwndDlg, IDC_PW, EM_SETREADONLY, 1, 0);
- SendDlgItemMessage(hwndDlg, IDC_PW2, EM_SETREADONLY, 1, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SSL), FALSE);
- }
return TRUE;
case WM_COMMAND:
@@ -81,15 +75,24 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
}
}
- if (HIWORD(wParam) == EN_CHANGE && reinterpret_cast<HWND>(lParam) == GetFocus()) {
- switch (LOWORD(wParam)) {
- case IDC_CC:
- case IDC_LOGIN:
- case IDC_NICK:
- case IDC_SSL:
- case IDC_PW:
- case IDC_PW2:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ if (HWND(lParam) == GetFocus()) {
+ if (HIWORD(wParam) == EN_CHANGE) {
+ switch (LOWORD(wParam)) {
+ case IDC_CC:
+ case IDC_LOGIN:
+ case IDC_NICK:
+ case IDC_DEFGROUP:
+ case IDC_PW:
+ case IDC_PW2:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ }
+ else if (HIWORD(wParam) == BN_CLICKED) {
+ switch (LOWORD(wParam)) {
+ case IDC_AUTORUN:
+ case IDC_SSL:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
}
}
break;
@@ -97,7 +100,6 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
case WM_NOTIFY:
if (reinterpret_cast<NMHDR *>(lParam)->code == PSN_APPLY) {
char str[128];
-
GetDlgItemTextA(hwndDlg, IDC_CC, str, SIZEOF(str));
proto->setString(WHATSAPP_KEY_CC, str);
@@ -107,7 +109,19 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
GetDlgItemTextA(hwndDlg, IDC_NICK, str, SIZEOF(str));
proto->setString(WHATSAPP_KEY_NICK, str);
+ TCHAR tstr[100];
+ GetDlgItemText(hwndDlg, IDC_DEFGROUP, tstr, SIZEOF(tstr));
+ if (mir_tstrcmp(proto->m_tszDefaultGroup, tstr)) {
+ proto->m_tszDefaultGroup = mir_tstrdup(tstr);
+ proto->setTString(WHATSAPP_KEY_DEF_GROUP, tstr);
+ }
+
proto->setByte(WHATSAPP_KEY_SSL, IsDlgButtonChecked(hwndDlg, IDC_SSL));
+ proto->setByte(WHATSAPP_KEY_AUTORUNCHATS, IsDlgButtonChecked(hwndDlg, IDC_AUTORUN));
+
+ if (proto->isOnline())
+ MessageBox(NULL, TranslateT("Changes will be applied after protocol restart"), proto->m_tszUserName, MB_OK);
+
return TRUE;
}
break;