-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPostnlConfigurationScreen.qml
287 lines (242 loc) · 7.04 KB
/
PostnlConfigurationScreen.qml
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
import QtQuick 2.1
import qb.components 1.0
import BasicUIControls 1.0;
Screen {
id: postnlConfigurationScreen
screenTitle: "Instellingen PostNL app"
onShown: {
enableSystrayToggle.isSwitchedOn = app.enableSystray;
enableUseCustomParcelNameToggle.isSwitchedOn = app.enableUseCustomParcelName;
postnlUseridLabel.inputText = app.postnlUserid;
postnlUpdateFrequencyInMinutesLabel.inputText = app.postnlUpdateFrequencyInMinutes;
postnlShowHistoryInMonthsLabel.inputText = app.postnlShowHistoryInMonths;
postnlPassword.inputText = "**********";
addCustomTopRightButton("Opslaan");
}
onCustomButtonClicked: {
app.saveSettings();
hide();
}
function validatePostnlUpdateFrequencyInMinutes(text, isFinalString) {
if (isFinalString) {
if (parseInt(text) < 20) return {title: "Te kort interval", content: "Minimum update interval is 20 minuten"};
}
if (isFinalString) {
if (parseInt(text) > 1440) return {title: "Te lang interval", content: "Maximum update interval is 1440 minuten (1 dag)"};
}
return null;
}
function savePostnlUpdateFrequencyInMinutes(text) {
if (text) {
app.postnlUpdateFrequencyInMinutes = text;
postnlUpdateFrequencyInMinutesLabel.inputText = text;
}
}
function validatePostnlShowHistoryInMonths(text, isFinalString) {
if (isFinalString) {
if (parseInt(text) < 1) return {title: "Te kleine waarde", content: "Minimum aantal maanden is 1"};
}
return null;
}
function savePostnlShowHistoryInMonths(text) {
if (text) {
app.postnlShowHistoryInMonths = text;
postnlShowHistoryInMonthsLabel.inputText = text;
app.postnlScreen.refreshScreen();
}
}
function savePostnlUserid(text) {
if (text) {
app.postnlUserid = text;
postnlUseridLabel.inputText = text;
}
}
function savePostnlPassword(text) {
if (text) {
app.postnlPassword = text;
}
}
EditTextLabel4421 {
id: postnlUseridLabel
width: isNxt ? 625 : 500
height: isNxt ? 44 : 35
leftTextAvailableWidth: isNxt ? 300 : 240
leftText: "PostNL Userid:"
x: isNxt ? 38 : 30
y: 10
anchors {
top: parent.top
topMargin: isNxt ? 30 : 24
}
onClicked: {
qkeyboard.open("Voer het userid in van uw PostNL account", postnlUseridLabel.inputText, savePostnlUserid)
}
}
IconButton {
id: postnlUseridButton;
width: isNxt ? 50 : 40
iconSource: "qrc:/tsc/edit.png"
anchors {
left: postnlUseridLabel.right
leftMargin: 6
top: postnlUseridLabel.top
}
bottomClickMargin: 3
onClicked: {
qkeyboard.open("Voer het userid in van uw PostNL account", postnlUseridLabel.inputText, savePostnlUserid)
}
}
EditTextLabel4421 {
id: postnlPassword
width: postnlUseridLabel.width
height: isNxt ? 44 : 35
leftTextAvailableWidth: isNxt ? 300 : 240
leftText: "Password:"
anchors {
left: postnlUseridLabel.left
top: postnlUseridLabel.bottom
topMargin: 6
}
onClicked: {
qkeyboard.open("Voer het wachtwoord in:", postnlPassword.inputText, savePostnlPassword)
}
}
Text {
id: enableSystrayLabel
width: isNxt ? 200 : 160
height: isNxt ? 45 : 36
text: "Icon in systray"
font.family: qfont.semiBold.name
font.pixelSize: isNxt ? 25 : 20
anchors {
left: postnlUseridButton.right
leftMargin: isNxt ? 10 : 8
top: postnlUseridLabel.top
}
}
OnOffToggle {
id: enableSystrayToggle
height: isNxt ? 45 : 36
anchors.left: enableSystrayLabel.right
anchors.leftMargin: 10
anchors.top: enableSystrayLabel.top
leftIsSwitchedOn: false
onSelectedChangedByUser: {
if (isSwitchedOn) {
app.enableSystray = true;
} else {
app.enableSystray = false;
}
}
}
IconButton {
id: postnlPasswordButton;
width: isNxt ? 50 : 40
iconSource: "qrc:/tsc/edit.png"
anchors {
left: postnlPassword.right
leftMargin: 6
top: postnlPassword.top
}
topClickMargin: 3
onClicked: {
qkeyboard.open("Voer het wachtwoord in:", postnlPassword.inputText, savePostnlPassword)
}
}
EditTextLabel4421 {
id: postnlUpdateFrequencyInMinutesLabel
width: postnlUseridLabel.width
height: isNxt ? 44 : 35
leftTextAvailableWidth: isNxt ? 300 : 240
leftText: "Verversinterval in min:"
x: isNxt ? 38 : 30
y: 10
anchors {
top: postnlPassword.bottom
topMargin: 6
}
onClicked: {
qnumKeyboard.open("Om de hoeveel minuten moet de inbox worden opgehaald?", postnlUpdateFrequencyInMinutesLabel.inputText, app.postnlUpdateFrequencyInMinutes, 1 , savePostnlUpdateFrequencyInMinutes, validatePostnlUpdateFrequencyInMinutes);
qnumKeyboard.maxTextLength = 3;
qnumKeyboard.state = "num_integer_clear_backspace";
}
}
IconButton {
id: postnlUpdateFrequencyInMinutesButton;
width: isNxt ? 50 : 40
iconSource: "qrc:/tsc/edit.png"
anchors {
left: postnlUpdateFrequencyInMinutesLabel.right
leftMargin: 6
top: postnlUpdateFrequencyInMinutesLabel.top
}
bottomClickMargin: 3
onClicked: {
qnumKeyboard.open("Om de hoeveel minuten moet de inbox worden opgehaald?", postnlUpdateFrequencyInMinutesLabel.inputText, app.postnlUpdateFrequencyInMinutes, 1 , savePostnlUpdateFrequencyInMinutes, validatePostnlUpdateFrequencyInMinutes);
qnumKeyboard.maxTextLength = 3;
qnumKeyboard.state = "num_integer_clear_backspace";
}
}
EditTextLabel4421 {
id: postnlShowHistoryInMonthsLabel
width: postnlUseridLabel.width
height: isNxt ? 44 : 35
leftTextAvailableWidth: isNxt ? 300 : 240
leftText: "Toon maanden historie:"
x: isNxt ? 38 : 30
y: 10
anchors {
top: postnlUpdateFrequencyInMinutesLabel.bottom
topMargin: 6
}
onClicked: {
qnumKeyboard.open("Hoeveel maanden historie moet er getoond worden?", postnlShowHistoryInMonthsLabel.inputText, app.postnlShowHistoryInMonths, 1 , savePostnlShowHistoryInMonths, validatePostnlShowHistoryInMonths);
qnumKeyboard.maxTextLength = 2;
qnumKeyboard.state = "num_integer_clear_backspace";
}
}
IconButton {
id: postnlShowHistoryInMonthsButton;
width: isNxt ? 50 : 40
iconSource: "qrc:/tsc/edit.png"
anchors {
left: postnlUpdateFrequencyInMinutesLabel.right
leftMargin: 6
top: postnlShowHistoryInMonthsLabel.top
}
bottomClickMargin: 3
onClicked: {
qnumKeyboard.open("Hoeveel maanden historie moet er getoond worden?", postnlShowHistoryInMonthsLabel.inputText, app.postnlShowHistoryInMonths, 1 , savePostnlShowHistoryInMonths, validatePostnlShowHistoryInMonths);
qnumKeyboard.state = "num_integer_clear_backspace";
}
}
Text {
id: enableUseCustomParcelNameLabel
width: postnlShowHistoryInMonthsLabel.width
height: isNxt ? 45 : 36
text: "Toon eigen naam pakket"
font.family: qfont.semiBold.name
font.pixelSize: isNxt ? 25 : 20
anchors {
left: postnlShowHistoryInMonthsLabel.left
leftMargin: isNxt ? 10 : 8
top: postnlShowHistoryInMonthsLabel.bottom
topMargin: 6
}
}
OnOffToggle {
id: enableUseCustomParcelNameToggle
height: isNxt ? 45 : 36
anchors.right: postnlShowHistoryInMonthsButton.right
anchors.leftMargin: 10
anchors.top: enableUseCustomParcelNameLabel.top
leftIsSwitchedOn: false
onSelectedChangedByUser: {
if (isSwitchedOn) {
app.enableUseCustomParcelName = true;
} else {
app.enableUseCustomParcelName = false;
}
}
}
}