diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-09-22 10:12:27 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-09-22 10:12:27 +0000 |
commit | 9e5810f34a7d813ea9d4c3026f06898d6fe7dc0b (patch) | |
tree | 930cc8c89ce54ab712b443198b5666d61376ad51 /protocols/MRA | |
parent | 72d66c9021da32e6b955586679dc4a5183947034 (diff) |
MRA:
added multiaccounts dialog
git-svn-id: http://svn.miranda-ng.org/main/trunk@1631 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/Mra.h | 2 | ||||
-rw-r--r-- | protocols/MRA/MraProto.cpp | 7 | ||||
-rw-r--r-- | protocols/MRA/MraProto.h | 1 | ||||
-rw-r--r-- | protocols/MRA/Mra_options.cpp | 66 | ||||
-rw-r--r-- | protocols/MRA/resource.rc | 22 |
5 files changed, 78 insertions, 20 deletions
diff --git a/protocols/MRA/Mra.h b/protocols/MRA/Mra.h index d47c967fa8..c699229704 100644 --- a/protocols/MRA/Mra.h +++ b/protocols/MRA/Mra.h @@ -268,4 +268,6 @@ DWORD GetMraStatusFromMiradaStatus (DWORD dwMirandaStatus, DWORD dwXStatusMi DWORD GetMiradaStatusFromMraStatus (DWORD dwMraStatus, DWORD dwXStatusMra, DWORD *pdwXStatusMir);
DWORD GetMraXStatusIDFromMraUriStatus (LPSTR lpszStatusUri, size_t dwStatusUriSize);
+INT_PTR CALLBACK DlgProcAccount(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+
#endif // !defined(AFX_MRA_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
diff --git a/protocols/MRA/MraProto.cpp b/protocols/MRA/MraProto.cpp index d0c0a22348..304a8499f5 100644 --- a/protocols/MRA/MraProto.cpp +++ b/protocols/MRA/MraProto.cpp @@ -36,6 +36,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : CreateObjectSvc(PS_SET_LISTENINGTO, &CMraProto::MraSetListeningTo);
+ CreateObjectSvc(PS_CREATEACCMGRUI, &CMraProto::SvcCreateAccMgrUI);
CreateObjectSvc(PS_GETAVATARCAPS, &CMraProto::MraGetAvatarCaps);
CreateObjectSvc(PS_GETAVATARINFOT, &CMraProto::MraGetAvatarInfo);
CreateObjectSvc(PS_GETMYAVATART, &CMraProto::MraGetMyAvatar);
@@ -115,6 +116,12 @@ CMraProto::~CMraProto() DeleteCriticalSection(&csCriticalSectionSend);
}
+int CMraProto::SvcCreateAccMgrUI(WPARAM wParam,LPARAM lParam)
+{
+ return (int)CreateDialogParam(masMraSettings.hInstance, MAKEINTRESOURCE(IDD_MRAACCOUNT),
+ (HWND)lParam, DlgProcAccount, LPARAM(this) );
+}
+
int CMraProto::OnModulesLoaded(WPARAM, LPARAM)
{
hHookExtraIconsApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &CMraProto::MraExtraIconsApply);
diff --git a/protocols/MRA/MraProto.h b/protocols/MRA/MraProto.h index 852a58911c..44d8eb9c34 100644 --- a/protocols/MRA/MraProto.h +++ b/protocols/MRA/MraProto.h @@ -84,6 +84,7 @@ struct CMraProto : public PROTO_INTERFACE, public MZeroedObject virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt);
virtual int __cdecl SendAwayMsg(HANDLE hContact, HANDLE hProcess, const char* msg);
virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR* msg);
+ virtual int __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM);
virtual int __cdecl UserIsTyping(HANDLE hContact, int type);
diff --git a/protocols/MRA/Mra_options.cpp b/protocols/MRA/Mra_options.cpp index e85405b859..ad4c70711a 100644 --- a/protocols/MRA/Mra_options.cpp +++ b/protocols/MRA/Mra_options.cpp @@ -50,6 +50,56 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA return FALSE;
}
+INT_PTR CALLBACK DlgProcAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ CMraProto *ppro = (CMraProto*)GetWindowLongPtr(hWndDlg, GWLP_USERDATA);
+ WCHAR szBuff[MAX_EMAIL_LEN];
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hWndDlg);
+ SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam);
+ ppro = (CMraProto*)lParam;
+
+ if ( ppro->mraGetStaticStringW(NULL, "e-mail", szBuff, SIZEOF(szBuff), NULL))
+ SET_DLG_ITEM_TEXTW(hWndDlg, IDC_LOGIN, szBuff);
+
+ SET_DLG_ITEM_TEXTW(hWndDlg, IDC_PASSWORD, (LPWSTR)L"");
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_NEW_ACCOUNT_LINK:
+ CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)MRA_REGISTER_URL);
+ return TRUE;
+ }
+ if ( HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_LOGIN:
+ case IDC_PASSWORD:
+ SendMessage(GetParent(hWndDlg), PSM_CHANGED, 0, 0);
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ GET_DLG_ITEM_TEXT(hWndDlg, IDC_LOGIN, szBuff, SIZEOF(szBuff));
+ ppro->mraSetStringW(NULL, "e-mail", szBuff);
+
+ if (GET_DLG_ITEM_TEXTA(hWndDlg, IDC_PASSWORD, (LPSTR)szBuff, SIZEOF(szBuff))) {
+ ppro->SetPassDB((LPSTR)szBuff, lstrlenA((LPSTR)szBuff));
+ SecureZeroMemory(szBuff, sizeof(szBuff));
+ }
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -177,31 +227,31 @@ int CMraProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) odp.cbSize = sizeof(odp);
odp.dwInitParam = (LPARAM)this;
odp.hInstance = masMraSettings.hInstance;
- odp.pszTitle = m_szModuleName;
- odp.pszGroup = LPGEN("Network");
- odp.flags = ODPF_BOLDGROUPS;
+ odp.ptszTitle = m_tszUserName;
+ odp.ptszGroup = LPGENT("Network");
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
- odp.pszTab = LPGEN("Account");
+ odp.ptszTab = LPGENT("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ACCOUNT);
odp.pfnDlgProc = DlgProcOptsAccount;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Connections");
+ odp.ptszTab = LPGENT("Connections");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONNECTIONS);
odp.pfnDlgProc = DlgProcOptsConnections;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Anti spam");
+ odp.ptszTab = LPGENT("Anti spam");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ANTISPAM);
odp.pfnDlgProc = MraAntiSpamDlgProcOpts;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Files");
+ odp.ptszTab = LPGENT("Files");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILES);
odp.pfnDlgProc = MraFilesQueueDlgProcOpts;
Options_AddPage(wParam, &odp);
- odp.pszTab = LPGEN("Avatars");
+ odp.ptszTab = LPGENT("Avatars");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AVATRS);
odp.pfnDlgProc = MraAvatarsQueueDlgProcOpts;
Options_AddPage(wParam, &odp);
diff --git a/protocols/MRA/resource.rc b/protocols/MRA/resource.rc index 567e030e86..1ce0bb141f 100644 --- a/protocols/MRA/resource.rc +++ b/protocols/MRA/resource.rc @@ -53,19 +53,17 @@ IDI_MRA_WORLD ICON "Icons\\my world.ico" // Dialog
//
-IDD_MRAACCOUNT DIALOGEX 0, 0, 200, 101
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Mail.ru Account Setup"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
+IDD_MRAACCOUNT DIALOGEX 0, 0, 186, 134
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- EDITTEXT IDC_LOGIN, 91, 34, 102, 13, ES_AUTOHSCROLL | NOT WS_BORDER, WS_EX_STATICEDGE
- EDITTEXT IDC_PASSWORD, 91, 54, 102, 13, ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_BORDER, WS_EX_STATICEDGE
- DEFPUSHBUTTON "OK", IDOK, 87, 80, 50, 14
- PUSHBUTTON "Cancel", IDCANCEL, 143, 80, 50, 14
- CONTROL "Create new account", IDC_REGISTER, "Hyperlink", WS_TABSTOP, 7, 82, 74, 10
- LTEXT "Please enter your Mail.ru account details to continue:", IDC_STATIC, 7, 9, 186, 20
- LTEXT "Mail.ru e-mail:", IDC_STATIC, 9, 37, 77, 8
- LTEXT "Password:", IDC_STATIC, 9, 57, 77, 8
+ LTEXT "E-mail:",IDC_STATIC,0,0,53,12
+ EDITTEXT IDC_LOGIN,54,0,131,12,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,0,16,53,12
+ EDITTEXT IDC_PASSWORD,54,16,131,12,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Create a new account",IDC_NEW_ACCOUNT_LINK,
+ "Hyperlink",WS_TABSTOP,0,40,174,12
END
IDD_OPT_CONNECTIONS DIALOGEX 0, 0, 295, 230
|