1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
#include "common.h"
INT_PTR CSkypeProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
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);
char password[20];
GetDlgItemTextA(hwnd, IDC_PASSWORD, password, SIZEOF(password));
proto->setString(SKYPE_SETTINGS_PASSWORD, password);
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);
}
return TRUE;
}
break;
}
return FALSE;
}
int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
char *title = mir_t2a(m_tszUserName);
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = g_hInstance;
odp.pszTitle = title;
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;
Options_AddPage(wParam, &odp);
mir_free(title);
return 0;
}
|