|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Control Panel QT UI for PAC store configuration |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * %version: 6 % |
|
21 */ |
|
22 |
|
23 // System includes |
|
24 #include <HbMessageBox> |
|
25 #include <HbInputDialog> |
|
26 #include <HbAction> |
|
27 #include <HbLineEdit> |
|
28 #include <cpsettingformitemdata.h> |
|
29 #include <cpitemdatahelper.h> |
|
30 #include <eapqtvalidator.h> |
|
31 #include <eapqtpacstoreconfig.h> |
|
32 |
|
33 // User includes |
|
34 #include "cpeaptlsmethodsui.h" |
|
35 #include "cpeappacstoreui.h" |
|
36 |
|
37 /*! |
|
38 * \class CpEapPacStoreUi |
|
39 * \brief Implementes PAC Store configuration group. |
|
40 */ |
|
41 |
|
42 // External function prototypes |
|
43 |
|
44 // Local constants |
|
45 |
|
46 /*! |
|
47 * First lineEdit of the dialog |
|
48 */ |
|
49 static const int FirstRow = 0; |
|
50 /* |
|
51 * Second lineEdit of the dialog |
|
52 */ |
|
53 static const int SecondRow = 1; |
|
54 |
|
55 // ======== LOCAL FUNCTIONS ======== |
|
56 |
|
57 // ======== MEMBER FUNCTIONS ======== |
|
58 |
|
59 /*! |
|
60 * Constructor. |
|
61 * |
|
62 * @param [in] configIf Pointer to EapQtConfigInterface |
|
63 */ |
|
64 |
|
65 CpEapPacStoreUi::CpEapPacStoreUi(EapQtConfigInterface *configIf) : |
|
66 mConfigIf(configIf), |
|
67 mItemDataHelper(NULL), |
|
68 mPacStoreGroup(NULL), |
|
69 mPacStorePassword(NULL), |
|
70 mResetPacStore(NULL), |
|
71 mPacStorePasswordState(0), |
|
72 mExistPasswordDialog(NULL), |
|
73 mNewPasswordDialog(NULL), |
|
74 mMessageBox(NULL) |
|
75 { |
|
76 qDebug("CpEapPacStoreUi::CpEapPacStoreUi()"); |
|
77 } |
|
78 |
|
79 /*! |
|
80 * Destructor. |
|
81 */ |
|
82 CpEapPacStoreUi::~CpEapPacStoreUi() |
|
83 { |
|
84 qDebug("CpEapPacStoreUi::~CpEapPacStoreUi()"); |
|
85 |
|
86 } |
|
87 |
|
88 /*! |
|
89 * Returns PAC store UI group |
|
90 * |
|
91 * @param [in] dataHelper CpItemDataHelper to add Connections |
|
92 * |
|
93 * @return PAC store group |
|
94 */ |
|
95 CpSettingFormItemData* CpEapPacStoreUi::uiInstance( |
|
96 CpItemDataHelper &dataHelpper) |
|
97 { |
|
98 //Store the address of the Data Helper |
|
99 mItemDataHelper = &dataHelpper; |
|
100 |
|
101 mPacStoreGroup.reset(new CpSettingFormItemData( |
|
102 HbDataFormModelItem::GroupItem, |
|
103 hbTrId("txt_occ_subhead_pac_store"))); |
|
104 mPacStoreGroup->setContentWidgetData("objectName", "CpEapPacStoreUiGroupItem"); |
|
105 |
|
106 // Read PAC Store configuration |
|
107 bool configurationRead = mConfigIf->readPacStoreConfiguration( |
|
108 mPacStoreConfig); |
|
109 if (!configurationRead) { |
|
110 // Use default value - PAC store password prompt |
|
111 qDebug("CpEapPacStoreUi::uiInstance - read PAC store configuration failed."); |
|
112 } |
|
113 |
|
114 // Create PAC store password selection comboBox |
|
115 createPacStorePassword(); |
|
116 |
|
117 // Create Reset PAC store button |
|
118 createResetPacStore(); |
|
119 |
|
120 return mPacStoreGroup.take(); |
|
121 } |
|
122 |
|
123 /*! |
|
124 * Creates PAC store password selection comboBox |
|
125 */ |
|
126 void CpEapPacStoreUi::createPacStorePassword() |
|
127 { |
|
128 qDebug("CpEapPacStoreUi::createPacStorePassword()"); |
|
129 // Create PAC store password comboBox |
|
130 mPacStorePassword = new CpSettingFormItemData( |
|
131 HbDataFormModelItem::ComboBoxItem, |
|
132 hbTrId("txt_occ_setlabel_pac_store_password")); |
|
133 mPacStoreGroup->appendChild(mPacStorePassword); |
|
134 mPacStorePassword->setContentWidgetData( |
|
135 "objectName", |
|
136 "CpEapPacStoreUiPassword"); |
|
137 |
|
138 // Add items to comboBox List |
|
139 QStringList items; |
|
140 items << hbTrId("txt_occ_setlabel_pac_store_password_val_prompt") |
|
141 << hbTrId("txt_occ_setlabel_pac_store_password_val_user_defin"); |
|
142 mPacStorePassword->setContentWidgetData("items", items); |
|
143 |
|
144 // Initialize selection from PAC store configuration |
|
145 if (mPacStoreConfig.value(EapQtPacStoreConfig::PacStoreState).toInt() |
|
146 == EapQtPacStoreConfig::PacStoreStatePasswordStored) { |
|
147 mPacStorePassword->setContentWidgetData("currentIndex", PacStorePasswordUserDefined); |
|
148 mPacStorePasswordState = PacStorePasswordUserDefined; |
|
149 } else { |
|
150 mPacStorePassword->setContentWidgetData("currentIndex", PacStorePasswordPrompt); |
|
151 mPacStorePasswordState = PacStorePasswordPrompt; |
|
152 } |
|
153 |
|
154 // Connect signal for password state changed |
|
155 mItemDataHelper->addConnection(mPacStorePassword, SIGNAL(currentIndexChanged(int)), this, |
|
156 SLOT(pacStorePasswordChanged(int))); |
|
157 } |
|
158 |
|
159 /*! |
|
160 * Creates reset PAC store button |
|
161 */ |
|
162 void CpEapPacStoreUi::createResetPacStore() |
|
163 { |
|
164 qDebug("CpEapPacStoreUi::createResetPacStore()"); |
|
165 |
|
166 // Create button |
|
167 mResetPacStore = new CpSettingFormItemData( |
|
168 HbDataFormModelItem::ToggleValueItem, |
|
169 hbTrId("")); |
|
170 mPacStoreGroup->appendChild(mResetPacStore); |
|
171 mResetPacStore->setContentWidgetData( |
|
172 "objectName", |
|
173 "CpEapPacStoreUiResetPacStore"); |
|
174 |
|
175 // Define text for the button |
|
176 mResetPacStore->setContentWidgetData("text", |
|
177 hbTrId("txt_occ_button_reset_pac_store")); |
|
178 mResetPacStore->setContentWidgetData("additionalText", |
|
179 hbTrId("txt_occ_button_reset_pac_store")); |
|
180 |
|
181 // Connect signal for button pressed |
|
182 mItemDataHelper->addConnection( |
|
183 mResetPacStore, |
|
184 SIGNAL(valueChanged(QPersistentModelIndex, QVariant)), |
|
185 this, |
|
186 SLOT(resetPacStoreButtonPressed(QPersistentModelIndex, QVariant))); |
|
187 } |
|
188 |
|
189 /*! |
|
190 * Set PAC store password state. |
|
191 * This is called when state changed has failed and state shall be restored. |
|
192 * |
|
193 * @param [in] state Pac store password state: Prompt/Userd defined. |
|
194 */ |
|
195 void CpEapPacStoreUi::setPacStorePasswordState(const PacStorePasswordIndexes state) |
|
196 { |
|
197 // Remove signal connection while state is restored |
|
198 mItemDataHelper->removeConnection(mPacStorePassword, SIGNAL(currentIndexChanged(int)), this, |
|
199 SLOT(pacStorePasswordChanged(int))); |
|
200 mPacStorePassword->setContentWidgetData("currentIndex", state); |
|
201 // Restore connection |
|
202 mItemDataHelper->addConnection(mPacStorePassword, SIGNAL(currentIndexChanged(int)), this, |
|
203 SLOT(pacStorePasswordChanged(int))); |
|
204 mPacStorePasswordState = state; |
|
205 } |
|
206 |
|
207 /*! |
|
208 * Show PAC store password query when PAC store already exists |
|
209 */ |
|
210 void CpEapPacStoreUi::showExistPasswordQuery() |
|
211 { |
|
212 qDebug("CpEapPacStoreUi::showExistPasswordQuery()"); |
|
213 |
|
214 // Create dialog |
|
215 QScopedPointer<HbInputDialog> existPasswordDialog(new HbInputDialog()); |
|
216 existPasswordDialog->setObjectName("CpEapPacStoreUiExistPasswordDialog"); |
|
217 existPasswordDialog->setAttribute(Qt::WA_DeleteOnClose); |
|
218 existPasswordDialog->setPromptText(hbTrId("txt_occ_dialog_pac_store_password")); |
|
219 existPasswordDialog->setInputMode(HbInputDialog::TextInput); |
|
220 |
|
221 // Add validator |
|
222 mValidatorPacStore.reset( |
|
223 mConfigIf->validatorPacStore( |
|
224 EapQtPacStoreConfig::PacStorePasswordConfirmation)); |
|
225 Q_ASSERT(mValidatorPacStore.data()); |
|
226 mValidatorPacStore->updateEditor(existPasswordDialog->lineEdit()); |
|
227 |
|
228 // Set Password echo mode |
|
229 existPasswordDialog->setEchoMode(HbLineEdit::Password); |
|
230 |
|
231 // Configurate buttons |
|
232 existPasswordDialog->clearActions(); |
|
233 HbAction *okAction = new HbAction( |
|
234 hbTrId("txt_common_button_ok"), |
|
235 existPasswordDialog.data()); |
|
236 existPasswordDialog->addAction(okAction); |
|
237 okAction->setObjectName("CpEapPacStoreUiExistPasswordDialogOkAction"); |
|
238 bool connected = connect(okAction, |
|
239 SIGNAL(triggered()), |
|
240 this, |
|
241 SLOT(completeExistPasswordQuery())); |
|
242 Q_ASSERT(connected); |
|
243 HbAction *cancelAction = new HbAction( |
|
244 hbTrId("txt_common_button_cancel"), |
|
245 existPasswordDialog.data()); |
|
246 existPasswordDialog->addAction(cancelAction); |
|
247 cancelAction->setObjectName("CpEapPacStoreUiExistPasswordDialogCancelAction"); |
|
248 connected = connect(cancelAction, |
|
249 SIGNAL(triggered()), |
|
250 this, |
|
251 SLOT(cancelPasswordQuery())); |
|
252 Q_ASSERT(connected); |
|
253 |
|
254 // Take the ownership of the dialog from QScopedPointer |
|
255 mExistPasswordDialog = existPasswordDialog.take(); |
|
256 |
|
257 // Show dialog |
|
258 mExistPasswordDialog->show(); |
|
259 } |
|
260 |
|
261 /*! |
|
262 * Show create PAC store password query when no PAC store exists |
|
263 */ |
|
264 void CpEapPacStoreUi::showNewPasswordQuery() |
|
265 { |
|
266 qDebug("CpEapPacStoreUi::showNewPasswordQuery()"); |
|
267 |
|
268 // Create dialog |
|
269 QScopedPointer<HbInputDialog> newPasswordDialog(new HbInputDialog()); |
|
270 newPasswordDialog->setObjectName("CpEapPacStoreUiNewPasswordDialog"); |
|
271 newPasswordDialog->setAttribute(Qt::WA_DeleteOnClose); |
|
272 newPasswordDialog->setAdditionalRowVisible(true); |
|
273 newPasswordDialog->setPromptText( |
|
274 hbTrId("txt_occ_dialog_create_password_for_encrypted_pac_s"), |
|
275 FirstRow); |
|
276 newPasswordDialog->setPromptText( |
|
277 hbTrId("txt_occ_dialog_verify_password"), |
|
278 SecondRow); |
|
279 newPasswordDialog->setInputMode(HbInputDialog::TextInput); |
|
280 |
|
281 // Add validators |
|
282 mValidatorPacStore.reset( |
|
283 mConfigIf->validatorPacStore( |
|
284 EapQtPacStoreConfig::PacStorePassword)); |
|
285 Q_ASSERT(mValidatorPacStore.data()); |
|
286 mValidatorPacStore->updateEditor(newPasswordDialog->lineEdit(FirstRow)); |
|
287 mValidatorPacStore->updateEditor(newPasswordDialog->lineEdit(SecondRow)); |
|
288 |
|
289 // Set Password echo mode |
|
290 newPasswordDialog->setEchoMode(HbLineEdit::Password, FirstRow); |
|
291 newPasswordDialog->setEchoMode(HbLineEdit::Password, SecondRow); |
|
292 |
|
293 // Configure buttons |
|
294 newPasswordDialog->clearActions(); |
|
295 HbAction *okAction = new HbAction( |
|
296 hbTrId("txt_common_button_ok"), |
|
297 newPasswordDialog.data()); |
|
298 newPasswordDialog->addAction(okAction); |
|
299 okAction->setObjectName("CpEapPacStoreUiNewPasswordDialogOkAction"); |
|
300 bool connected = connect(okAction, |
|
301 SIGNAL(triggered()), |
|
302 this, |
|
303 SLOT(completeNewPasswordQuery())); |
|
304 Q_ASSERT(connected); |
|
305 HbAction *cancelAction = new HbAction( |
|
306 hbTrId("txt_common_button_cancel"), |
|
307 newPasswordDialog.data()); |
|
308 newPasswordDialog->addAction(cancelAction); |
|
309 cancelAction->setObjectName("CpEapPacStoreUiNewPasswordDialogCancelAction"); |
|
310 connected = connect(cancelAction, |
|
311 SIGNAL(triggered()), |
|
312 this, |
|
313 SLOT(cancelPasswordQuery())); |
|
314 |
|
315 // Take the ownership of the dialog from QScopedPointer |
|
316 mNewPasswordDialog = newPasswordDialog.take(); |
|
317 |
|
318 // Show dialog |
|
319 mNewPasswordDialog->show(); |
|
320 } |
|
321 |
|
322 /*! |
|
323 * Shows message box with "OK" button using given text. |
|
324 * |
|
325 * @param [in] type Message box type |
|
326 * @param [in] text Text to be shown |
|
327 */ |
|
328 void CpEapPacStoreUi::showMessageBox( |
|
329 HbMessageBox::MessageBoxType type, |
|
330 const QString &text) |
|
331 { |
|
332 // Create a message box |
|
333 mMessageBox = QSharedPointer<HbMessageBox>(new HbMessageBox(type)); |
|
334 mMessageBox->setObjectName("CpEapPacStoreUiMessageBox"); |
|
335 mMessageBox->setText(text); |
|
336 mMessageBox->setModal(true); |
|
337 mMessageBox->setTimeout(HbPopup::NoTimeout); |
|
338 mMessageBox->open(); |
|
339 } |
|
340 |
|
341 /*! |
|
342 * This slot is called when PAC Store password state has been changed |
|
343 * |
|
344 * @param [in] value New state of password (prompt/user defined) |
|
345 */ |
|
346 void CpEapPacStoreUi::pacStorePasswordChanged(int value) |
|
347 { |
|
348 qDebug("CpEapPacStoreUi::pacStorePasswordChanged()"); |
|
349 |
|
350 if (mPacStorePasswordState != value) { |
|
351 // Value is really changed |
|
352 if (value == PacStorePasswordPrompt) { |
|
353 // Prompt |
|
354 qDebug("CpEapPacStoreUi::pacStorePasswordChanged - Prompt"); |
|
355 |
|
356 //Show message box to confirm the PAC store password clearing |
|
357 HbMessageBox *questionBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
|
358 questionBox->setObjectName("CpEapPacStoreUiClearPasswordQuestion"); |
|
359 questionBox->setText(hbTrId("txt_occ_info_pac_store_password_will_no_longer_be")); |
|
360 questionBox->setModal(true); |
|
361 questionBox->setTimeout(HbPopup::NoTimeout); |
|
362 questionBox->setAttribute(Qt::WA_DeleteOnClose); |
|
363 questionBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); |
|
364 questionBox->open(this,SLOT(clearPacStorePasswordConfirmed(int))); |
|
365 } else { |
|
366 //User defined |
|
367 Q_ASSERT(value == PacStorePasswordUserDefined); |
|
368 qDebug("CpEapPacStoreUi::pacStorePasswordChanged - User defined"); |
|
369 // Read from PAC store config if PAC store exists |
|
370 EapQtPacStoreConfig pacStoreConfig; |
|
371 bool configurationRead = mConfigIf->readPacStoreConfiguration( |
|
372 pacStoreConfig); |
|
373 if (!configurationRead) { |
|
374 qDebug("CpEapPacStoreUi::pacStorePasswordChanged - read PAC store configuration failed."); |
|
375 } |
|
376 |
|
377 if (pacStoreConfig.value(EapQtPacStoreConfig::PacStoreState).toInt() |
|
378 == EapQtPacStoreConfig::PacStoreStatePasswordRequired) { |
|
379 // PAC store exists, show 'PAC store password' query |
|
380 qDebug("CpEapPacStoreUi::pacStorePasswordChanged - Exist password query"); |
|
381 showExistPasswordQuery(); |
|
382 } else if (pacStoreConfig.value(EapQtPacStoreConfig::PacStoreState).toInt() |
|
383 == EapQtPacStoreConfig::PacStoreStateStoreNotExists) { |
|
384 // PAC store doesn't exist, show create password query |
|
385 qDebug("CpEapPacStoreUi::pacStorePasswordChanged - Create new password"); |
|
386 showNewPasswordQuery(); |
|
387 } else { |
|
388 // If password already stored no prompt needed |
|
389 qDebug("CpEapPacStoreUi::pacStorePasswordChanged - Password stored"); |
|
390 } |
|
391 } |
|
392 } |
|
393 } |
|
394 |
|
395 /*! |
|
396 * Slot for handling "Reset PAC store" button presses. |
|
397 * |
|
398 * @param [in] index Obsolete parameter, not needed |
|
399 * @param [in] value Obsolete parameter, not needed |
|
400 */ |
|
401 void CpEapPacStoreUi::resetPacStoreButtonPressed( |
|
402 QPersistentModelIndex index, |
|
403 QVariant value) |
|
404 { |
|
405 qDebug("CpEapPacStoreUi::resetPacStoreButtonPressed"); |
|
406 |
|
407 Q_UNUSED(index); |
|
408 Q_UNUSED(value); |
|
409 |
|
410 //Show message box to confirm the PAC store resetting |
|
411 HbMessageBox *questionBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
|
412 questionBox->setObjectName("CpEapPacStoreUiRestPacStoreQuestion"); |
|
413 questionBox->setText(hbTrId("txt_occ_info_remove_pac_store_all_credentials_wil")); |
|
414 questionBox->setModal(true); |
|
415 questionBox->setTimeout(HbPopup::NoTimeout); |
|
416 questionBox->setAttribute(Qt::WA_DeleteOnClose); |
|
417 questionBox->setStandardButtons(HbMessageBox::Yes | HbMessageBox::No); |
|
418 questionBox->open(this,SLOT(resetPacStoreConfirmed(int))); |
|
419 } |
|
420 |
|
421 /*! |
|
422 * Slot for clear PAC store Password after confirmed. |
|
423 * |
|
424 * @param [in] action User action |
|
425 */ |
|
426 void CpEapPacStoreUi::clearPacStorePasswordConfirmed(int action) |
|
427 { |
|
428 qDebug("CpEapPacStoreUi::clearPacStorePasswordConfirmed()"); |
|
429 if (action == HbMessageBox::Yes) { |
|
430 // User Clicked Yes |
|
431 // Clear PAC store password |
|
432 EapQtPacStoreConfig pacStoreConfig; |
|
433 pacStoreConfig.setValue(EapQtPacStoreConfig::PacStoreSavePassword, false); |
|
434 bool status = mConfigIf->savePacStoreConfiguration( |
|
435 pacStoreConfig); |
|
436 qDebug("CpEapPacStoreUi::clearPacStorePasswordConfirmed - status: %d", status); |
|
437 mPacStorePasswordState = PacStorePasswordPrompt; |
|
438 // Show error note to user |
|
439 if (!status) { |
|
440 // Show error note to user |
|
441 showMessageBox( |
|
442 HbMessageBox::MessageTypeWarning, |
|
443 hbTrId("txt_occ_info_unable_to_save_setting")); |
|
444 } |
|
445 } else { |
|
446 // User Clicked No |
|
447 Q_ASSERT(action == HbMessageBox::No); |
|
448 // Set PAC store password back to 'User defined' |
|
449 setPacStorePasswordState(PacStorePasswordUserDefined); |
|
450 } |
|
451 } |
|
452 |
|
453 /*! |
|
454 * Slot for reset PAC store after confirmed. |
|
455 * |
|
456 * @param [in] action User action |
|
457 */ |
|
458 void CpEapPacStoreUi::resetPacStoreConfirmed(int action) |
|
459 { |
|
460 qDebug("CpEapPacStoreUi::resetPacStoreConfirmed()"); |
|
461 if (action == HbMessageBox::Yes) { |
|
462 // User Clicked Yes |
|
463 // Reset PAC Store |
|
464 EapQtPacStoreConfig pacStoreConfig; |
|
465 pacStoreConfig.setValue(EapQtPacStoreConfig::PacStoreReset, true); |
|
466 bool status = mConfigIf->savePacStoreConfiguration( |
|
467 pacStoreConfig); |
|
468 qDebug("CpEapPacStoreUi::resetPacStoreConfirmed - reset status: %d", status); |
|
469 if (!status) { |
|
470 // Show error note to user |
|
471 showMessageBox( |
|
472 HbMessageBox::MessageTypeWarning, |
|
473 hbTrId("txt_occ_info_unable_to_save_setting")); |
|
474 } |
|
475 |
|
476 // Set PAC store password selection to 'Prompt' |
|
477 setPacStorePasswordState(PacStorePasswordPrompt); |
|
478 } else { |
|
479 // User Clicked No |
|
480 Q_ASSERT(action == HbMessageBox::No); |
|
481 // Do nothing (don't reset PAC store) |
|
482 qDebug("CpEapPacStoreUi::resetPacStoreConfirmed - Do not reset."); |
|
483 } |
|
484 } |
|
485 |
|
486 /*! |
|
487 * Slot for confirm given PAC store password when PAC store exists |
|
488 */ |
|
489 void CpEapPacStoreUi::completeExistPasswordQuery() |
|
490 { |
|
491 qDebug("CpEapPacStoreUi::completeExistPasswordQuery()"); |
|
492 QString password = mExistPasswordDialog->value().toString(); |
|
493 if (mValidatorPacStore->validate(password) == EapQtValidator::StatusOk) { |
|
494 qDebug("CpEapPacStoreUi::completeExistPasswordQuery() - save password"); |
|
495 // Password is OK, save it |
|
496 EapQtPacStoreConfig pacStoreConfig; |
|
497 pacStoreConfig.setValue(EapQtPacStoreConfig::PacStorePassword, password); |
|
498 pacStoreConfig.setValue(EapQtPacStoreConfig::PacStoreSavePassword, true); |
|
499 bool status = mConfigIf->savePacStoreConfiguration( |
|
500 pacStoreConfig); |
|
501 qDebug("CpEapPacStoreUi::completeExistPasswordQuery - save status: %d", status); |
|
502 if (status) { |
|
503 mPacStorePasswordState = PacStorePasswordUserDefined; |
|
504 } else { |
|
505 setPacStorePasswordState(PacStorePasswordPrompt); |
|
506 // Show error note to user |
|
507 showMessageBox( |
|
508 HbMessageBox::MessageTypeWarning, |
|
509 hbTrId("txt_occ_info_unable_to_save_setting")); |
|
510 } |
|
511 |
|
512 } else { |
|
513 // Existing password cannot be changed |
|
514 // Set PAC store password selection back to 'Prompt' |
|
515 setPacStorePasswordState(PacStorePasswordPrompt); |
|
516 // Show info popup |
|
517 HbMessageBox *infoBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
|
518 infoBox->setObjectName("CpEapPacStoreUiPasswordCannotChangeInfo"); |
|
519 infoBox->setText(hbTrId("txt_occ_info_existing_password_cannot_be_changed")); |
|
520 infoBox->setModal(true); |
|
521 infoBox->setTimeout(HbPopup::NoTimeout); |
|
522 infoBox->setAttribute(Qt::WA_DeleteOnClose); |
|
523 infoBox->setStandardButtons(HbMessageBox::Ok); |
|
524 infoBox->open(); |
|
525 } |
|
526 } |
|
527 |
|
528 /*! |
|
529 * Slot for save given PAC store password when no PAC store exists |
|
530 */ |
|
531 void CpEapPacStoreUi::completeNewPasswordQuery() |
|
532 { |
|
533 qDebug("CpEapPacStoreUi::completeNewPasswordQuery()"); |
|
534 QString password = mNewPasswordDialog->value(0).toString(); |
|
535 QString passwordConfirm = mNewPasswordDialog->value(1).toString(); |
|
536 |
|
537 if (password == passwordConfirm && |
|
538 mValidatorPacStore->validate(password) == EapQtValidator::StatusOk) { |
|
539 // Password is OK, save it |
|
540 qDebug("CpEapPacStoreUi::completeNewPasswordQuery() - password OK. Save it."); |
|
541 EapQtPacStoreConfig pacStoreConfig; |
|
542 pacStoreConfig.setValue(EapQtPacStoreConfig::PacStorePassword, password); |
|
543 pacStoreConfig.setValue(EapQtPacStoreConfig::PacStoreSavePassword, true); |
|
544 bool status = mConfigIf->savePacStoreConfiguration( |
|
545 pacStoreConfig); |
|
546 qDebug("CpEapPacStoreUi::completeNewPasswordQuery - save status: %d", status); |
|
547 if (status) { |
|
548 mPacStorePasswordState = PacStorePasswordUserDefined; |
|
549 } else { |
|
550 setPacStorePasswordState(PacStorePasswordPrompt); |
|
551 // Show error note to user |
|
552 showMessageBox( |
|
553 HbMessageBox::MessageTypeWarning, |
|
554 hbTrId("txt_occ_info_unable_to_save_setting")); |
|
555 } |
|
556 } else { |
|
557 // Password is not OK, show info popup |
|
558 qDebug("CpEapPacStoreUi::completeNewPasswordQuery() - password Not OK. Show popup."); |
|
559 HbMessageBox *infoBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
|
560 infoBox->setObjectName("CpEapPacStoreUiInvalidPasswordInfo"); |
|
561 if (password != passwordConfirm) { |
|
562 infoBox->setText(hbTrId("txt_occ_info_passwords_do_not_match_try_again")); |
|
563 } else { |
|
564 infoBox->setText(hbTrId("txt_occ_info_invalid_input")); |
|
565 } |
|
566 infoBox->setModal(true); |
|
567 infoBox->setTimeout(HbPopup::NoTimeout); |
|
568 infoBox->setAttribute(Qt::WA_DeleteOnClose); |
|
569 infoBox->setStandardButtons(HbMessageBox::Ok); |
|
570 infoBox->open(this,SLOT(invalidPasswordInfoClosed(int))); |
|
571 } |
|
572 } |
|
573 |
|
574 /*! |
|
575 * This function is called when user selects CANCEL from |
|
576 * PAC store password or New PAC store password query popup. |
|
577 * PAC store password selection is changed back to 'Prompt'. |
|
578 */ |
|
579 void CpEapPacStoreUi::cancelPasswordQuery() |
|
580 { |
|
581 qDebug("CpEapPacStoreUi::cancelPasswordQuery()"); |
|
582 // Set PAC store password selection back to 'Prompt' |
|
583 setPacStorePasswordState(PacStorePasswordPrompt); |
|
584 } |
|
585 |
|
586 /*! |
|
587 * This function is called when user selects OK from |
|
588 * 'Passwords do not match' or 'Invalid input' information popup. |
|
589 * New PAC store password query dialog is shown again |
|
590 * |
|
591 * @param [in] action Obsolete parameter, not needed |
|
592 */ |
|
593 void CpEapPacStoreUi::invalidPasswordInfoClosed(int action) |
|
594 { |
|
595 qDebug("CpEapPacStoreUi::invalidPasswordInfoClosed() - Show query again."); |
|
596 Q_UNUSED(action); |
|
597 |
|
598 showNewPasswordQuery(); |
|
599 } |