144 lEmergencySupported = ESecUiEmergencyNotSupported; |
144 lEmergencySupported = ESecUiEmergencyNotSupported; |
145 if((queryType & ESecUiEmergencySupported)==ESecUiEmergencySupported) |
145 if((queryType & ESecUiEmergencySupported)==ESecUiEmergencySupported) |
146 { |
146 { |
147 lEmergencySupported = ESecUiEmergencySupported; |
147 lEmergencySupported = ESecUiEmergencySupported; |
148 } |
148 } |
149 qDebug() << "SecUiNotificationContentWidget::lEmergencySupported =" << lEmergencySupported; |
149 RDEBUG("lEmergencySupported", lEmergencySupported); |
150 } |
150 } |
151 |
151 |
152 if (parameters.contains(KQueryMinLength)) { |
152 if (parameters.contains(KQueryMinLength)) { |
153 qDebug() << "SecUiNotificationContentWidget::KQueryMinLength"; |
153 RDEBUG("KQueryMinLength", 0); |
154 lMinLength = parameters.value(KQueryMinLength).toUInt(); |
154 lMinLength = parameters.value(KQueryMinLength).toUInt(); |
155 qDebug() << lMinLength; |
155 RDEBUG("lMinLength", lMinLength); |
156 } |
156 } |
157 if (parameters.contains(KQueryMaxLength)) { |
157 if (parameters.contains(KQueryMaxLength)) { |
158 qDebug() << "SecUiNotificationContentWidget::KQueryMaxLength"; |
158 RDEBUG("KQueryMaxLength", 0); |
159 lMaxLength = parameters.value(KQueryMaxLength).toUInt(); |
159 lMaxLength = parameters.value(KQueryMaxLength).toUInt(); |
160 qDebug() << lMaxLength; |
160 RDEBUG("lMaxLength", lMaxLength); |
161 } |
161 } |
162 |
162 |
163 if (parameters.contains(KEmergency)) { |
163 if (parameters.contains(KEmergency)) { |
164 qDebug() << "SecUiNotificationContentWidget::KEmergency"; |
164 RDEBUG("KEmergency", 0); |
165 QString emergencyText = parameters.value(KEmergency).toString(); |
165 QString emergencyText = parameters.value(KEmergency).toString(); |
166 qDebug() << emergencyText; |
166 RDEBUGQT("emergencyText", emergencyText); |
167 if(!emergencyText.compare("emergencyYes")) |
167 if(!emergencyText.compare("emergencyYes")) |
168 { |
168 { |
169 qDebug() << "SecUiNotificationContentWidget::KEmergency emergencyYes"; |
169 RDEBUG("emergencyYes", 1); |
170 isEmergency = 1; |
170 isEmergency = 1; |
171 } |
171 } |
172 if(!emergencyText.compare("emergencyNo")) |
172 if(!emergencyText.compare("emergencyNo")) |
173 { |
173 { |
174 qDebug() << "SecUiNotificationContentWidget::KEmergency emergencyNo"; |
174 RDEBUG("emergencyNo", 0); |
175 isEmergency = 0; |
175 isEmergency = 0; |
176 } |
176 } |
177 } |
177 } |
178 |
178 |
179 |
179 |
180 // KCodeTop |
180 // KCodeTop |
181 if (parameters.contains(KCodeTop)) { |
181 if (parameters.contains(KCodeTop)) { |
182 qDebug() << "SecUiNotificationContentWidget::KCodeTop 1"; |
182 RDEBUG("KCodeTop", 0); |
183 codeTop = new HbLineEdit(""); // no default value |
183 codeTop = new HbLineEdit(""); // no default value |
184 qDebug() << "SecUiNotificationContentWidget::KCodeTop lMaxLength="; |
184 RDEBUG("queryType", queryType); |
185 qDebug() << lMaxLength; |
|
186 if(lMaxLength>2) |
|
187 codeTop->setMaxLength(lMaxLength); |
|
188 qDebug() << "SecUiNotificationContentWidget::KCodeTop queryType="; |
|
189 qDebug() << queryType; |
|
190 codeTop->setInputMethodHints(Qt::ImhDigitsOnly); // default |
185 codeTop->setInputMethodHints(Qt::ImhDigitsOnly); // default |
191 if (queryType & ESecUiAlphaSupported) |
186 if (queryType & ESecUiAlphaSupported) |
192 { |
187 { |
193 qDebug() << "SecUiNotificationContentWidget::KCodeTop setUpAsLatinAlphabetOnlyEditor"; |
188 RDEBUG("ESecUiAlphaSupported", ESecUiAlphaSupported); |
194 codeTop->setInputMethodHints(Qt::ImhNone); |
189 codeTop->setInputMethodHints(Qt::ImhNone); |
195 } |
190 } |
196 if (queryType & ESecUiSecretSupported) |
191 if (queryType & ESecUiSecretSupported) |
197 { |
192 { |
198 qDebug() << "SecUiNotificationContentWidget::KCodeTop ESecUiSecretSupported"; |
193 RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); |
199 codeTop->setEchoMode(HbLineEdit::PasswordEchoOnEdit); |
194 codeTop->setEchoMode(HbLineEdit::PasswordEchoOnEdit); |
200 // note that codeButtom is never in secret mode. This nevertheless is restricted by the caller. |
|
201 } |
195 } |
202 qDebug() << "SecUiNotificationContentWidget::KCodeTop 3"; |
196 RDEBUG("lMaxLength", lMaxLength); |
203 codeTop->setMaxLength(lMaxLength); |
197 if(lMaxLength>2) |
|
198 codeTop->setMaxLength(lMaxLength); |
204 |
199 |
205 if (parameters.contains(KDefaultCode)) { |
200 if (parameters.contains(KDefaultCode)) { |
206 qDebug() << "SecUiNotificationContentWidget::KDefaultCode"; |
201 RDEBUG("KDefaultCode", 0); |
207 QString defaultCode = parameters.value(KDefaultCode).toString(); |
202 QString defaultCode = parameters.value(KDefaultCode).toString(); |
208 qDebug() << defaultCode; |
203 RDEBUGQT("defaultCode", defaultCode); |
209 codeTop->setText(defaultCode); |
204 codeTop->setText(defaultCode); |
210 } |
205 } |
211 qDebug() << "SecUiNotificationContentWidget::KCodeTop 4"; |
206 RDEBUG("1", 1); |
212 |
207 |
213 connect(codeTop, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeTopChanged(const QString &))); |
208 connect(codeTop, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeTopChanged(const QString &))); |
214 connect(codeTop, SIGNAL(contentsChanged()), this, SIGNAL(codeTopContentChanged())); |
209 connect(codeTop, SIGNAL(contentsChanged()), this, SIGNAL(codeTopContentChanged())); |
215 |
210 |
216 if (parameters.contains(KDefaultCode)) { // this is done in this step so that the OK becomes valid (if rules are fulfilled) |
211 if (parameters.contains(KDefaultCode)) { // this is done in this step so that the OK becomes valid (if rules are fulfilled) |
217 qDebug() << "SecUiNotificationContentWidget::KDefaultCode"; |
212 RDEBUG("KDefaultCode", 0); |
218 QString defaultCode = parameters.value(KDefaultCode).toString(); |
213 QString defaultCode = parameters.value(KDefaultCode).toString(); |
219 qDebug() << defaultCode; |
214 RDEBUGQT("defaultCode", defaultCode); |
220 codeTop->setText(defaultCode); |
215 codeTop->setText(defaultCode); |
221 } |
216 } |
222 qDebug() << "SecUiNotificationContentWidget::KCodeTop 4"; |
217 RDEBUG("2", 2); |
223 |
218 |
224 if (parameters.contains(KDialogTitle)) { |
219 if (parameters.contains(KDialogTitle)) { |
225 QString titleText = parameters.value(KDialogTitle).toString(); |
220 QString titleText = parameters.value(KDialogTitle).toString(); |
226 QString titleAttempts = ""; |
221 QString titleAttempts = ""; |
227 if(titleText.indexOf('|')>0) |
222 if(titleText.indexOf('|')>0) |
228 { // if separator, take only first part |
223 { // if separator, take only first part |
229 titleText = titleText.left(titleText.indexOf('|')); |
224 titleText = titleText.left(titleText.indexOf('|')); |
230 } |
225 } |
231 if(titleText.indexOf('#')>0) |
226 if(titleText.indexOf('$')>0) |
232 { // if separator, take only first part |
227 { // if separator, take only first part |
233 titleAttempts = titleText.right(titleText.length()-titleText.indexOf('#')-1); |
228 // it comes translated alredy, from the client |
234 qDebug() << "SecUiNotificationDialog::titleAttempts=" << titleAttempts; |
229 titleAttempts = titleText.right(titleText.length()-titleText.indexOf('$')-1); |
|
230 RDEBUGQT("titleAttempts", titleAttempts); |
235 int nAttempts = titleAttempts.toInt(); |
231 int nAttempts = titleAttempts.toInt(); |
236 RDEBUG("nAttempts", nAttempts); |
232 RDEBUG("nAttempts", nAttempts); |
237 titleText = titleText.left(titleText.indexOf('#')); |
233 titleText = titleText.left(titleText.indexOf('$')); // this comes translated already |
238 if(nAttempts>0) |
234 if(nAttempts==1) // last attempt |
239 titleText = titleText + " attempts=" + QString::number(nAttempts); |
235 { |
240 } |
236 // This must be in a new line, to avoid problems with left-to-right writing |
|
237 titleAttempts = hbTrId("txt_pin_code_dpophead_last_attempt"); |
|
238 } |
|
239 else if(nAttempts>0) |
|
240 { |
|
241 titleAttempts = hbTrId("attempts") + "=" + QString::number(nAttempts); |
|
242 // TODO this requires %L1 localization using txt_pin_code_dpopinfo_ln_attempts_remaining |
|
243 } |
|
244 else if(nAttempts==0) |
|
245 { |
|
246 titleAttempts = ""; // something special for the last attempt ? |
|
247 } |
|
248 else |
|
249 { |
|
250 titleAttempts = ""; |
|
251 } |
|
252 } |
241 HbLabel *titleTop = new HbLabel(titleText); |
253 HbLabel *titleTop = new HbLabel(titleText); |
242 mainLayout->addItem(titleTop); |
254 mainLayout->addItem(titleTop); |
|
255 if (titleAttempts.length()>0 ) |
|
256 { |
|
257 HbLabel *titleTopAttemps = new HbLabel(titleAttempts); |
|
258 mainLayout->addItem(titleTopAttemps); |
|
259 } |
243 // in the dialog, it was setHeadingWidget(title); |
260 // in the dialog, it was setHeadingWidget(title); |
244 } |
261 } |
245 |
262 RDEBUG("3", 3); |
246 mainLayout->addItem(codeTop); |
263 mainLayout->addItem(codeTop); |
247 // double-query |
264 // double-query |
248 if (parameters.contains(KCodeBottom)) |
265 if (parameters.contains(KCodeBottom)) |
249 { |
266 { |
250 queryDual=1; |
267 queryDual=1; |
251 QString titleText = parameters.value(KDialogTitle).toString(); |
268 QString titleText = parameters.value(KDialogTitle).toString(); |
252 if(titleText.indexOf('|')>0) |
269 if(titleText.indexOf('|')>0) |
253 { // if no separator, don't create label |
270 { // if no separator, don't create label |
254 QString titleBottomStr = titleText.right(titleText.length()-titleText.indexOf('|')-1); |
271 QString titleBottomStr = titleText.right(titleText.length()-titleText.indexOf('|')-1); |
|
272 // no need to translate |
255 HbLabel *titleBottom = new HbLabel(titleBottomStr); |
273 HbLabel *titleBottom = new HbLabel(titleBottomStr); |
256 mainLayout->addItem(titleBottom); |
274 mainLayout->addItem(titleBottom); |
257 } |
275 } |
258 |
276 |
259 codeBottom = new HbLineEdit(""); // no default value |
277 codeBottom = new HbLineEdit(""); // no default value |
260 if(lMaxLength>2) |
278 if(lMaxLength>2) |
261 codeBottom->setMaxLength(lMaxLength); |
279 codeBottom->setMaxLength(lMaxLength); |
262 codeBottom->setInputMethodHints(Qt::ImhDigitsOnly); // default |
280 codeBottom->setInputMethodHints(Qt::ImhDigitsOnly); // default |
263 if (queryType & ESecUiAlphaSupported) |
281 if (queryType & ESecUiAlphaSupported) |
264 { |
282 { |
265 qDebug() << "SecUiNotificationContentWidget::KCodeBottom setUpAsLatinAlphabetOnlyEditor"; |
283 RDEBUG("setInputMethodHints", 0); |
266 codeBottom->setInputMethodHints(Qt::ImhNone); |
284 codeBottom->setInputMethodHints(Qt::ImhNone); |
267 } |
285 } |
268 qDebug() << "SecUiNotificationContentWidget::KCodeBottom 3"; |
286 if (queryType & ESecUiSecretSupported) |
|
287 { |
|
288 RDEBUG("ESecUiSecretSupported", 0); |
|
289 codeBottom->setEchoMode(HbLineEdit::PasswordEchoOnEdit); // this will also remove predictive, which is what we want |
|
290 } |
|
291 RDEBUG("connecting", 0); |
269 connect(codeBottom, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeBottomChanged(const QString &))); |
292 connect(codeBottom, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeBottomChanged(const QString &))); |
270 connect(codeBottom, SIGNAL(contentsChanged(const QString &)), this, SIGNAL(codeBottomChanged(const QString &))); |
293 connect(codeBottom, SIGNAL(contentsChanged(const QString &)), this, SIGNAL(codeBottomChanged(const QString &))); |
271 mainLayout->addItem(codeBottom); |
294 mainLayout->addItem(codeBottom); |
272 } |
295 } |
273 |
296 |
302 mainLayout->addItem(DialogText); |
325 mainLayout->addItem(DialogText); |
303 } |
326 } |
304 |
327 |
305 checkbox = new HbCheckBox("Caption"); |
328 checkbox = new HbCheckBox("Caption"); |
306 if (parameters.contains(KDefaultCode)) { |
329 if (parameters.contains(KDefaultCode)) { |
307 qDebug() << "SecUiNotificationContentWidget::KDefaultCode"; |
330 RDEBUG("KDefaultCode", 0); |
308 QStringList list1 = parameters.value(KDefaultCode).toString().split("|"); |
331 QStringList list1 = parameters.value(KDefaultCode).toString().split("|"); |
309 if (!list1.isEmpty() && list1.count()==2) { |
332 if (!list1.isEmpty() && list1.count()==2) { |
310 if (!list1[0].isNull() && !list1[0].isEmpty()) checkbox->setText(list1[0]); |
333 if (!list1[0].isNull() && !list1[0].isEmpty()) checkbox->setText(list1[0]); |
311 if (!list1[1].isNull() && !list1[1].isEmpty()) checkbox->setChecked(list1[1].toInt()); |
334 if (!list1[1].isNull() && !list1[1].isEmpty()) checkbox->setChecked(list1[1].toInt()); |
312 } |
335 } |
313 |
336 // TODO this needs localization |
314 } |
337 } |
315 mainLayout->addItem(checkbox); |
338 mainLayout->addItem(checkbox); |
316 } |
339 } |
317 |
340 |
318 if (parameters.contains(KMultiChecboxType) && parameters.contains(KDefaultCode)) |
341 if (parameters.contains(KMultiChecboxType) && parameters.contains(KDefaultCode)) |
319 { |
342 { |
320 qDebug() << "SecUiNotificationContentWidget::KMultiChecboxType"; |
343 RDEBUG("KMultiChecboxType", 0); |
321 QStringList list1 = parameters.value(KDefaultCode).toString().split("1\t"); |
344 QStringList list1 = parameters.value(KDefaultCode).toString().split("1\t"); |
322 if (!list1.isEmpty()) { |
345 if (!list1.isEmpty()) { |
323 listWidget = new HbListWidget(); |
346 listWidget = new HbListWidget(); |
324 for (int i = 0; (i < list1.count()); i++) |
347 for (int i = 0; (i < list1.count()); i++) |
325 if (!list1[i].isEmpty() && !list1[i].isNull()) { |
348 if (!list1[i].isEmpty() && !list1[i].isNull()) { |
326 HbListWidgetItem* modelItem = new HbListWidgetItem(); |
349 HbListWidgetItem* modelItem = new HbListWidgetItem(); |
327 modelItem->setData(QVariant(list1[i]), Qt::DisplayRole); |
350 modelItem->setData(QVariant(list1[i]), Qt::DisplayRole); |
|
351 // TODO this needs localization |
328 listWidget->addItem(modelItem); |
352 listWidget->addItem(modelItem); |
329 } |
353 } |
330 listWidget->setCurrentRow(0); |
354 listWidget->setCurrentRow(0); |
331 listWidget->setSelectionMode(HbAbstractItemView::MultiSelection); |
355 listWidget->setSelectionMode(HbAbstractItemView::MultiSelection); |
332 //listWidget->setClampingStyle(HbScrollArea::BounceBackClamping); |
356 //listWidget->setClampingStyle(HbScrollArea::BounceBackClamping); |