summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-04-03 18:25:32 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-04-03 18:25:32 +0000
commit2dda26c2d63fb543d06f046a5908ba43a5fd716e (patch)
tree6de64e4a536951e696ddb82b0dad8739938a1f58 /protocols
parentba077766bc39745326b3bbe65b5382fcc5bc2f51 (diff)
SkypeWeb: moved to core ui
git-svn-id: http://svn.miranda-ng.org/main/trunk@12590 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/SkypeWeb_12.vcxproj12
-rw-r--r--protocols/SkypeWeb/SkypeWeb_12.vcxproj.filters16
-rw-r--r--protocols/SkypeWeb/res/resource.rc16
-rw-r--r--protocols/SkypeWeb/src/common.h3
-rw-r--r--protocols/SkypeWeb/src/skype_accounts.cpp11
-rw-r--r--protocols/SkypeWeb/src/skype_dialogs.h50
-rw-r--r--protocols/SkypeWeb/src/skype_options.cpp94
-rw-r--r--protocols/SkypeWeb/src/skype_options.h30
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h6
9 files changed, 133 insertions, 105 deletions
diff --git a/protocols/SkypeWeb/SkypeWeb_12.vcxproj b/protocols/SkypeWeb/SkypeWeb_12.vcxproj
index 7f776adc57..32dcf3f02c 100644
--- a/protocols/SkypeWeb/SkypeWeb_12.vcxproj
+++ b/protocols/SkypeWeb/SkypeWeb_12.vcxproj
@@ -207,15 +207,17 @@
<ClInclude Include="src\requests\endpoint.h" />
<ClInclude Include="src\requests\login.h" />
<ClInclude Include="src\requests\logout.h" />
- <ClInclude Include="src\requests\messages.h" />
+ <ClInclude Include="src\requests\messages.h" />
<ClInclude Include="src\requests\profile.h" />
<ClInclude Include="src\requests\reg_info.h" />
<ClInclude Include="src\requests\status.h" />
- <ClInclude Include="src\requests\poll.h" />
- <ClInclude Include="src\requests\subscriptions.h" />
+ <ClInclude Include="src\requests\poll.h" />
+ <ClInclude Include="src\requests\subscriptions.h" />
<ClInclude Include="src\resource.h" />
+ <ClInclude Include="src\skype_dialogs.h" />
<ClInclude Include="src\skype_icons.h" />
<ClInclude Include="src\skype_menus.h" />
+ <ClInclude Include="src\skype_options.h" />
<ClInclude Include="src\skype_proto.h" />
<ClInclude Include="src\request_queue.h" />
<ClInclude Include="src\version.h" />
@@ -238,8 +240,8 @@
<ClCompile Include="src\skype_proto.cpp" />
<ClCompile Include="src\skype_contacts.cpp" />
<ClCompile Include="src\skype_utils.cpp" />
- <ClCompile Include="src\skype_polling.cpp" />
- <ClCompile Include="src\skype_poll_processing.cpp" />
+ <ClCompile Include="src\skype_polling.cpp" />
+ <ClCompile Include="src\skype_poll_processing.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc" />
diff --git a/protocols/SkypeWeb/SkypeWeb_12.vcxproj.filters b/protocols/SkypeWeb/SkypeWeb_12.vcxproj.filters
index e7e11629e4..ee77cf1361 100644
--- a/protocols/SkypeWeb/SkypeWeb_12.vcxproj.filters
+++ b/protocols/SkypeWeb/SkypeWeb_12.vcxproj.filters
@@ -63,15 +63,21 @@
<ClInclude Include="src\requests\status.h">
<Filter>Header Files\requests</Filter>
</ClInclude>
- <ClInclude Include="src\requests\subscriptions.h">
+ <ClInclude Include="src\requests\subscriptions.h">
<Filter>Header Files\requests</Filter>
</ClInclude>
<ClInclude Include="src\requests\poll.h">
<Filter>Header Files\requests</Filter>
- </ClInclude>
+ </ClInclude>
<ClInclude Include="src\requests\messages.h">
<Filter>Header Files\requests</Filter>
</ClInclude>
+ <ClInclude Include="src\skype_dialogs.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\skype_options.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\stdafx.cpp">
@@ -119,11 +125,11 @@
<ClCompile Include="src\skype_status.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\skype_polling.cpp">
+ <ClCompile Include="src\skype_polling.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\skype_poll_processing.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="src\skype_poll_processing.cpp">
+ <Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
diff --git a/protocols/SkypeWeb/res/resource.rc b/protocols/SkypeWeb/res/resource.rc
index b59bd87258..7a2074df00 100644
--- a/protocols/SkypeWeb/res/resource.rc
+++ b/protocols/SkypeWeb/res/resource.rc
@@ -108,7 +108,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Account",IDC_STATIC,7,7,296,63,NOT WS_VISIBLE
LTEXT "Skypename:",IDC_STATIC,12,19,69,11
- EDITTEXT IDC_SKYPENAME, 81, 17, 217, 12, ES_AUTOHSCROLL
+ EDITTEXT IDC_SKYPENAME,81,17,217,12,ES_AUTOHSCROLL
LTEXT "Password:",IDC_STATIC,12,34,69,8
EDITTEXT IDC_PASSWORD,81,33,217,12,ES_PASSWORD | ES_AUTOHSCROLL
LTEXT "Default group:",IDC_STATIC,12,51,69,12
@@ -139,26 +139,14 @@ GUIDELINES DESIGNINFO
BEGIN
IDD_ACCOUNT_MANAGER, DIALOG
BEGIN
- VERTGUIDE, 49
- BOTTOMMARGIN, 112
END
IDD_OPTIONS_MAIN, DIALOG
BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 303
- VERTGUIDE, 12
- VERTGUIDE, 81
- VERTGUIDE, 298
- TOPMARGIN, 7
- BOTTOMMARGIN, 228
END
- IDD_PASSWORD, DIALOG
+ IDD_PASSWORD_EDITOR, DIALOG
BEGIN
- RIGHTMARGIN, 204
- VERTGUIDE, 7
- BOTTOMMARGIN, 70
END
END
#endif // APSTUDIO_INVOKED
diff --git a/protocols/SkypeWeb/src/common.h b/protocols/SkypeWeb/src/common.h
index e2f4ef2f95..84060c4eba 100644
--- a/protocols/SkypeWeb/src/common.h
+++ b/protocols/SkypeWeb/src/common.h
@@ -36,6 +36,7 @@
#include <m_json.h>
#include <m_timezones.h>
#include <m_version.h>
+#include <m_gui.h>
struct CSkypeProto;
@@ -43,6 +44,8 @@ struct CSkypeProto;
#include "resource.h"
#include "skype_icons.h"
#include "skype_menus.h"
+#include "skype_dialogs.h"
+#include "skype_options.h"
#include "http_request.h"
#include "requests\login.h"
#include "requests\logout.h"
diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp
index 4b1ae6d536..6a383045f2 100644
--- a/protocols/SkypeWeb/src/skype_accounts.cpp
+++ b/protocols/SkypeWeb/src/skype_accounts.cpp
@@ -24,12 +24,8 @@ int CSkypeProto::UninitAccount(CSkypeProto *proto)
CSkypeProto* CSkypeProto::GetContactAccount(MCONTACT hContact)
{
for (int i = 0; i < Accounts.getCount(); i++)
- {
if (mir_strcmpi(GetContactProto(hContact), Accounts[i]->m_szModuleName) == 0)
- {
return Accounts[i];
- }
- }
return NULL;
}
@@ -42,10 +38,5 @@ int CSkypeProto::OnAccountLoaded(WPARAM, LPARAM)
INT_PTR CSkypeProto::OnAccountManagerInit(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_ACCOUNT_MANAGER),
- (HWND)lParam,
- CSkypeProto::MainOptionsProc,
- (LPARAM)this);
+ return (INT_PTR)(CSkypeOptionsMain::CreateAccountManagerPage(this, (HWND)lParam))->GetHwnd();
} \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_dialogs.h b/protocols/SkypeWeb/src/skype_dialogs.h
new file mode 100644
index 0000000000..ee834bcd35
--- /dev/null
+++ b/protocols/SkypeWeb/src/skype_dialogs.h
@@ -0,0 +1,50 @@
+#ifndef _SKYPE_DIALOGS_H_
+#define _SKYPE_DIALOGS_H_
+
+class CSkypeDlgBase : public CProtoDlgBase<CSkypeProto>
+{
+private:
+ typedef CProtoDlgBase<CSkypeProto> CSuper;
+
+protected:
+ __inline CSkypeDlgBase(CSkypeProto *proto, int idDialog, HWND parent, bool show_label = true) :
+ CSuper(proto, idDialog, parent, show_label) { }
+};
+
+class CSkypePasswordEditor : public CSkypeDlgBase
+{
+private:
+ typedef CSkypeDlgBase CSuper;
+
+ CCtrlEdit m_password;
+ CCtrlCheck m_savePermanently;
+
+ CCtrlButton m_ok;
+
+protected:
+ void OnInitDialog()
+ {
+ SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 20, 0);
+ }
+
+ void OnOk(CCtrlButton*)
+ {
+ /*if (m_savePermanently.Enabled())
+ m_proto->setString("Password", m_password.GetTextA());
+ if (m_proto->password != NULL)
+ mir_free(m_proto->password);
+ m_proto->password = mir_utf8encodeW(m_password.GetText());
+ */
+ EndDialog(m_hwnd, 1);
+ }
+
+public:
+ CSkypePasswordEditor(CSkypeProto *proto) :
+ CSuper(proto, IDD_PASSWORD_EDITOR, NULL, false), m_ok(this, IDOK),
+ m_password(this, IDC_PASSWORD), m_savePermanently(this, IDC_SAVEPERMANENTLY)
+ {
+ m_ok.OnClick = Callback(this, &CSkypePasswordEditor::OnOk);
+ }
+};
+
+#endif //_SKYPE_DIALOGS_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp
index ae8c1b9c4e..06cbbcf001 100644
--- a/protocols/SkypeWeb/src/skype_options.cpp
+++ b/protocols/SkypeWeb/src/skype_options.cpp
@@ -1,77 +1,30 @@
#include "common.h"
-INT_PTR CSkypeProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog, HWND hwndParent)
+ : CSuper(proto, idDialog, hwndParent, false),
+ m_skypename(this, IDC_SKYPENAME), m_password(this, IDC_PASSWORD),
+ m_group(this, IDC_GROUP)
{
- CSkypeProto *proto = (CSkypeProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
- switch (uMsg)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
- {
- proto = (CSkypeProto*)lParam;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
-
- ptrA login(proto->getStringA(SKYPE_SETTINGS_ID));
- SetDlgItemTextA(hwnd, IDC_SKYPENAME, login);
- SendDlgItemMessage(hwnd, IDC_SKYPENAME, EM_LIMITTEXT, 32, 0);
-
- ptrA password(proto->getStringA("Password"));
- SetDlgItemTextA(hwnd, IDC_PASSWORD, password);
- SendDlgItemMessage(hwnd, IDC_PASSWORD, EM_LIMITTEXT, 20, 0);
-
- ptrT group(proto->getTStringA(SKYPE_SETTINGS_GROUP));
- SetDlgItemText(hwnd, IDC_GROUP, group ? group : _T("Skype"));
- SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0);
- }
- return TRUE;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_SKYPENAME:
- case IDC_GROUP:
- case IDC_PASSWORD:
- if ((HWND)lParam == GetFocus())
- {
- if (HIWORD(wParam) != EN_CHANGE) return 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
- }
- }
- break;
-
- case WM_NOTIFY:
- if (((NMHDR*)lParam)->code == PSN_APPLY)
- {
- char skypename[32];
- GetDlgItemTextA(hwnd, IDC_SKYPENAME, skypename, SIZEOF(skypename));
- proto->setString(SKYPE_SETTINGS_ID, skypename);
+ CreateLink(m_skypename, SKYPE_SETTINGS_ID, _T(""));
+ CreateLink(m_password, "Password", _T(""));
+ CreateLink(m_group, SKYPE_SETTINGS_GROUP, _T("Skype"));
+}
- char password[20];
- GetDlgItemTextA(hwnd, IDC_PASSWORD, password, SIZEOF(password));
- proto->setString(SKYPE_SETTINGS_PASSWORD, password);
+void CSkypeOptionsMain::OnInitDialog()
+{
+ CSuper::OnInitDialog();
- TCHAR group[64];
- GetDlgItemText(hwnd, IDC_GROUP, group, SIZEOF(group));
- if (_tcslen(group) > 0)
- {
- proto->setTString(SKYPE_SETTINGS_GROUP, group);
- Clist_CreateGroup(0, group);
- }
- else
- {
- proto->delSetting(NULL, SKYPE_SETTINGS_GROUP);
- }
+ SendMessage(m_skypename.GetHwnd(), EM_LIMITTEXT, 32, 0);
+ SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 20, 0);
+ SendMessage(m_group.GetHwnd(), EM_LIMITTEXT, 64, 0);
+}
- return TRUE;
- }
- break;
- }
- return FALSE;
+void CSkypeOptionsMain::OnApply()
+{
+ TCHAR *group = m_group.GetText();
+ if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
+ Clist_CreateGroup(0, group);
}
int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
@@ -81,13 +34,16 @@ int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = g_hInstance;
odp.pszTitle = title;
- odp.dwInitParam = (LPARAM)this;
+ //odp.dwInitParam = (LPARAM)this;
odp.flags = ODPF_BOLDGROUPS;
odp.pszGroup = LPGEN("Network");
odp.pszTab = LPGEN("Account");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MAIN);
- odp.pfnDlgProc = MainOptionsProc;
+ odp.pfnDlgProc = CSkypeOptionsMain::DynamicDlgProc;
+ odp.dwInitParam = (LPARAM)&SkypeMainOptionsParam;
+ SkypeMainOptionsParam.create = CSkypeOptionsMain::CreateOptionsPage;
+ SkypeMainOptionsParam.param = this;
Options_AddPage(wParam, &odp);
mir_free(title);
diff --git a/protocols/SkypeWeb/src/skype_options.h b/protocols/SkypeWeb/src/skype_options.h
new file mode 100644
index 0000000000..56d08aedd8
--- /dev/null
+++ b/protocols/SkypeWeb/src/skype_options.h
@@ -0,0 +1,30 @@
+#ifndef _SKYPE_OPTIONS_H_
+#define _SKYPE_OPTIONS_H_
+
+class CSkypeOptionsMain : public CSkypeDlgBase
+{
+private:
+ typedef CSkypeDlgBase CSuper;
+
+ CCtrlEdit m_skypename;
+ CCtrlEdit m_password;
+ CCtrlEdit m_group;
+
+protected:
+ CSkypeOptionsMain(CSkypeProto *proto, int idDialog, HWND hwndParent = NULL);
+
+ void OnInitDialog();
+ void OnApply();
+
+public:
+ static CDlgBase *CreateAccountManagerPage(void *param, HWND owner)
+ {
+ CSkypeOptionsMain *page = new CSkypeOptionsMain((CSkypeProto*)param, IDD_ACCOUNT_MANAGER, owner);
+ page->Show();
+ return page;
+ }
+
+ static CDlgBase *CreateOptionsPage(void *param) { return new CSkypeOptionsMain((CSkypeProto*)param, IDD_OPTIONS_MAIN); }
+};
+
+#endif //_SKYPE_OPTIONS_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 5d86f4ce92..add8444093 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -3,8 +3,10 @@
typedef void(CSkypeProto::*SkypeResponseCallback)(const NETLIBHTTPREQUEST *response);
-struct CSkypeProto : public PROTO < CSkypeProto >
+struct CSkypeProto : public PROTO<CSkypeProto>
{
+ friend CSkypePasswordEditor;
+
public:
//////////////////////////////////////////////////////////////////////////////////////
@@ -116,7 +118,7 @@ private:
int OnInitStatusMenu();
// options
- static INT_PTR CALLBACK MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ CSkypeDlgBase::CreateParam SkypeMainOptionsParam;
int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);