summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_options.cpp
blob: 66446e1a389abf463cc6b6b874b6b89b8c0de882 (plain)
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
#include "common.h"

CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog, HWND hwndParent)
	: CSkypeDlgBase(proto, idDialog, hwndParent, false),
	m_skypename(this, IDC_SKYPENAME),
	m_password(this, IDC_PASSWORD),
	m_group(this, IDC_GROUP)
{
	//CreateLink(m_skypename, SKYPE_SETTINGS_ID, _T(""));
	//CreateLink(m_password, "Password", _T(""));
	CreateLink(m_group, SKYPE_SETTINGS_GROUP, _T("Skype"));
}

void CSkypeOptionsMain::OnInitDialog()
{
	CSkypeDlgBase::OnInitDialog();

	m_skypename.SetTextA(ptrA(m_proto->getStringA(SKYPE_SETTINGS_ID)));
	m_password.SetTextA(ptrA(m_proto->getStringA("Password")));
	SendMessage(m_skypename.GetHwnd(), EM_LIMITTEXT, 32, 0);
	SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 20, 0);
	SendMessage(m_group.GetHwnd(), EM_LIMITTEXT, 64, 0);
}


void CSkypeOptionsMain::OnApply()
{
	m_proto->setString(SKYPE_SETTINGS_ID, m_skypename.GetTextA());
	m_proto->setString("Password", m_password.GetTextA());

	TCHAR *group = m_group.GetText();
	if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
		Clist_CreateGroup(0, group);
}

int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
	char *title = mir_t2a(m_tszUserName);

	OPTIONSDIALOGPAGE odp = { sizeof(odp) };
	odp.hInstance = g_hInstance;
	odp.pszTitle = title;
	odp.flags = ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE;
	odp.pszGroup = LPGEN("Network");

	odp.pszTab = LPGEN("Account");
	odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MAIN);
	odp.pfnDlgProc = CSkypeOptionsMain::DynamicDlgProc;
	odp.dwInitParam = (LPARAM)&SkypeMainOptionsParam;
	SkypeMainOptionsParam.create = CSkypeOptionsMain::CreateOptionsPage;
	SkypeMainOptionsParam.param = this;
	Options_AddPage(wParam, &odp);

	mir_free(title);

	return 0;
}