-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathUTConfigDlg.cpp
More file actions
109 lines (96 loc) · 2.7 KB
/
UTConfigDlg.cpp
File metadata and controls
109 lines (96 loc) · 2.7 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: UTCONFIGDLG.CPP
** COMPONENT: The Application.
** DESCRIPTION: CUTConfigDlg class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "UTConfigDlg.hpp"
#include "UTCMGRApp.hpp"
#include "HelpTopics.h"
/******************************************************************************
**
** Local variables.
**
*******************************************************************************
*/
static const tchar* CFG_SECTION = TXT("Core.System");
static const tchar* FOLDER_CFG_ENTRY = TXT("CachePath");
static const tchar* EXPIRY_CFG_ENTRY = TXT("PurgeCacheDays");
/******************************************************************************
** Method: Default constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CUTConfigDlg::CUTConfigDlg()
: CDialog(IDD_UT_CONFIG)
, m_oIniFile(App.m_pProfile->m_strConfigFile)
{
DEFINE_CTRL_TABLE
CTRL(IDC_FOLDER, &m_ebFolder)
CTRL(IDC_EXPIRY, &m_ebExpiry)
END_CTRL_TABLE
}
/******************************************************************************
** Method: OnInitDialog()
**
** Description: Initialise the dialog.
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CUTConfigDlg::OnInitDialog()
{
// Load the current config.
m_ebFolder.Text(m_oIniFile.ReadString(CFG_SECTION, FOLDER_CFG_ENTRY, TXT("")));
m_ebExpiry.Text(m_oIniFile.ReadString(CFG_SECTION, EXPIRY_CFG_ENTRY, TXT("")));
// Initialise control string lengths.
m_ebFolder.TextLimit(MAX_PATH);
m_ebExpiry.TextLimit(4);
}
/******************************************************************************
** Method: OnOk()
**
** Description: User pressed OK.
**
** Parameters: None.
**
** Returns: true or false.
**
*******************************************************************************
*/
bool CUTConfigDlg::OnOk()
{
// Save changes.
m_oIniFile.WriteString(CFG_SECTION, FOLDER_CFG_ENTRY, m_ebFolder.Text());
m_oIniFile.WriteString(CFG_SECTION, EXPIRY_CFG_ENTRY, m_ebExpiry.Text());
return true;
}
/******************************************************************************
** Method: OnHelp()
**
** Description: Help requested for the dialog.
**
** Parameters: See HELPINFO.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CUTConfigDlg::OnHelp(HELPINFO& /*oInfo*/)
{
// Show the dialogs help topic.
App.m_oHelpFile.Topic(IDH_UTCFGDLG);
}