summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src/options.cpp
blob: fbf410b520b9f9d7d0f17456f3a071137e367e78 (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
#include "stdafx.h"

CSubPluginsOptionsDlg::CSubPluginsOptionsDlg()
	: CPluginDlgBase(hInst, IDD_OPT_SUBPLUGINS, MODULENAME),
	m_enableKeepStatus(this, IDC_ENABLE_KEEPSTATUS),
	m_enableStartupStatus(this, IDC_ENABLE_STARTUPSTATUS),
	m_enableAdvancedAutoAway(this, IDC_ENABLE_ADVANCEDAUTOAWAY)
{
}

void CSubPluginsOptionsDlg::OnInitDialog()
{
	CDlgBase::OnInitDialog();

	wchar_t text[128];
	mir_snwprintf(text, L"Enable \"%s\" *", L"Keep status");
	m_enableKeepStatus.SetText(text);
	m_enableKeepStatus.SetState(IsSubPluginEnabled(KSMODULENAME));
	mir_snwprintf(text, L"Enable \"%s\" *", L"Startup status");
	m_enableStartupStatus.SetText(text);
	m_enableStartupStatus.SetState(IsSubPluginEnabled(SSMODULENAME));
	mir_snwprintf(text, L"Enable \"%s\" *", L"Advanced auto away");
	m_enableAdvancedAutoAway.SetText(text);
	m_enableAdvancedAutoAway.SetState(IsSubPluginEnabled(AAAMODULENAME));
}

void CSubPluginsOptionsDlg::OnApply()
{
	char setting[128];
	mir_snprintf(setting, "%s_enabled", KSMODULENAME);
	db_set_b(NULL, MODULENAME, setting, m_enableKeepStatus.GetState());
	mir_snprintf(setting, "%s_enabled", SSMODULENAME);
	db_set_b(NULL, MODULENAME, setting, m_enableStartupStatus.GetState());
	mir_snprintf(setting, "%s_enabled", AAAMODULENAME);
	db_set_b(NULL, MODULENAME, setting, m_enableAdvancedAutoAway.GetState());
}

int CSubPluginsOptionsDlg::OnOptionsInit(WPARAM wParam, LPARAM)
{
	OPTIONSDIALOGPAGE odp = { 0 };
	odp.hInstance = hInst;
	odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
	odp.szGroup.w = LPGENW("Status");
	odp.szTitle.w = LPGENW("Status manager");
	odp.pDialog = CSubPluginsOptionsDlg::CreateOptionsPage();
	Options_AddPage(wParam, &odp);

	return 0;
}