summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_options.cpp
blob: 8d94d0fc4d6325476ccbb6fd303bc24df8d689e6 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
Copyright (c) 2015 Miranda NG project (http://miranda-ng.org)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation version 2
of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "common.h"

CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog)
	: CSkypeDlgBase(proto, idDialog, false),
	m_skypename(this, IDC_SKYPENAME),
	m_password(this, IDC_PASSWORD),
	m_group(this, IDC_GROUP),
	m_autosync(this, IDC_AUTOSYNC),
	m_localtime(this, IDC_LOCALTIME)
{
	CreateLink(m_group, SKYPE_SETTINGS_GROUP, _T("Skype"));
	CreateLink(m_autosync, "AutoSync", DBVT_BYTE, 1);
	CreateLink(m_localtime, "UseLocalTime", DBVT_BYTE, 0);
}

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());
	ptrT group(m_group.GetText());
	if (mir_tstrlen(group) > 0 && !Clist_GroupExists(group))
		Clist_CreateGroup(0, group);
}

/////////////////////////////////////////////////////////////////////////////////

int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
{
	OPTIONSDIALOGPAGE odp = { sizeof(odp) };
	odp.hInstance = g_hInstance;
	odp.ptszTitle = m_tszUserName;
	odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
	odp.ptszGroup = LPGENT("Network");

	odp.ptszTab = LPGENT("Account");
	odp.pDialog = CSkypeOptionsMain::CreateOptionsPage(this);
	Options_AddPage(wParam, &odp);

	return 0;
}