diff options
author | George Hazan <george.hazan@gmail.com> | 2015-02-09 16:02:23 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-02-09 16:02:23 +0000 |
commit | ff22a9442b5464ef0de4273bbdeb74ea1957bf17 (patch) | |
tree | 55ff04f178a17fe5999bb55b3aa1f245468bee9d /protocols/WhatsApp/src | |
parent | b7c78a98ba81a12e7f0e4772cc438b65ea3ca94b (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')
-rw-r--r-- | protocols/WhatsApp/src/dialogs.cpp | 52 | ||||
-rw-r--r-- | protocols/WhatsApp/src/proto.cpp | 4 | ||||
-rw-r--r-- | protocols/WhatsApp/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/resource.h | 6 |
4 files changed, 40 insertions, 24 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;
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index ba47afa2e6..93847e1747 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -329,7 +329,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, INT_PTR WhatsAppProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_WHATSAPOPTIONS),
+ return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI),
(HWND)lParam, WhatsAppAccountProc, (LPARAM)this);
}
@@ -344,7 +344,7 @@ int WhatsAppProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.position = 1;
odp.ptszGroup = LPGENT("Network");
odp.ptszTab = LPGENT("Account");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_WHATSAPOPTIONS);
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.pfnDlgProc = WhatsAppAccountProc;
Options_AddPage(wParam, &odp);
return 0;
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index a74ed810a3..1c1ddb3192 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -118,6 +118,7 @@ public: std::vector<string> m_szInviteJids;
map<std::string, WAChatInfo*> m_chats;
mir_cs m_csChats;
+ ptrT m_tszDefaultGroup;
void ChatLogMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
void NickListMenuHook(WAChatInfo *pInfo, GCHOOK *gch);
@@ -175,7 +176,6 @@ private: WAConnection *m_pConnection;
Mutex connMutex;
time_t m_tLastWriteTime;
- ptrT m_tszDefaultGroup;
std::vector<unsigned char> m_Challenge;
std::string m_szPhoneNumber;
diff --git a/protocols/WhatsApp/src/resource.h b/protocols/WhatsApp/src/resource.h index 64b7b1359a..7558d8f549 100644 --- a/protocols/WhatsApp/src/resource.h +++ b/protocols/WhatsApp/src/resource.h @@ -4,8 +4,9 @@ //
#define IDD_INPUTBOX 102
#define IDR_REGISTERUTILITY 103
-#define IDD_WHATSAPOPTIONS 104
+#define IDD_ACCMGRUI 104
#define IDD_GROUPCHAT_INVITE 105
+#define IDD_OPTIONS 106
#define IDI_WHATSAPP 203
#define IDI_ADD_GROUP 206
#define IDI_RENAME_GROUP 208
@@ -26,6 +27,7 @@ #define IDC_TEXT 1014
#define IDC_INVITE 1015
#define IDC_AUTORUN 1016
+#define IDC_DEFGROUP 1017
// Next default values for new objects
//
@@ -33,7 +35,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1017
+#define _APS_NEXT_CONTROL_VALUE 1018
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
|