diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-05 21:20:12 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-05 21:20:12 +0000 |
commit | 3a686f86c91cb428e6c8f4534f7d2b72054ecf38 (patch) | |
tree | a544928d00c91b5f8a3cb6d2de5662dd4c36fda3 /protocols/VKontakte/src/vk_options.cpp | |
parent | aa31874392c484ccc7d8dc7d87f88e013c031219 (diff) |
VK: password dialog
git-svn-id: http://svn.miranda-ng.org/main/trunk@6359 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_options.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_options.cpp | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index a854a9f335..27d4a902f4 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -22,8 +22,73 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- return 0;
-};
+ CVkProto* ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ ppro = (CVkProto*)lParam;
+ SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
+
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
+
+ SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, 30, 0);
+ {
+ ptrT tszLogin( ppro->getTStringA("Login"));
+ if (tszLogin != NULL)
+ SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);
+
+ ptrT tszPassw( ppro->GetUserStoredPassword());
+ if (tszPassw != NULL)
+ SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_URL:
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.vk.com");
+ break;
+
+ case IDC_LOGIN:
+ case IDC_PASSWORD:
+ if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ TCHAR str[128];
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ ppro->setTString("Login", str);
+
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ ptrA szRawPasswd( mir_utf8encodeT(str));
+ if (szRawPasswd != NULL) {
+ CallService(MS_DB_CRYPT_ENCODESTRING, strlen(szRawPasswd), szRawPasswd);
+ ppro->setString("Password", szRawPasswd);
+ }
+ }
+ break;
+
+ case WM_CLOSE:
+ EndDialog(hwndDlg, 0);
+ break;
+
+ case WM_DESTROY:
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
+ break;
+ }
+
+ return FALSE;
+}
INT_PTR CVkProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
{
|