|
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 * EAP Wizard Page: New PAC store password |
|
16 * |
|
17 */ |
|
18 |
|
19 // System includes |
|
20 #include <HbDocumentLoader> |
|
21 #include <HbMainWindow> |
|
22 #include <HbWidget> |
|
23 #include <HbLineEdit> |
|
24 #include <HbLabel> |
|
25 #include <eapqtexpandedeaptype.h> |
|
26 #include <eapqtconfiginterface.h> |
|
27 #include <eapqtconfig.h> |
|
28 #include <eapqtvalidator.h> |
|
29 |
|
30 // User includes |
|
31 #include "wlanwizardhelper.h" |
|
32 #include "eapwizardpagepacstorepasswordconfirm.h" |
|
33 #include "eapwizard_p.h" |
|
34 #include "OstTraceDefinitions.h" |
|
35 #ifdef OST_TRACE_COMPILER_IN_USE |
|
36 #include "eapwizardpagepacstorepasswordconfirmTraces.h" |
|
37 #endif |
|
38 |
|
39 |
|
40 /*! |
|
41 \class EapWizardPagePacStorePasswordConfirm |
|
42 \brief Implements EAP wizard page: Confirm PAC store password |
|
43 */ |
|
44 |
|
45 // External function prototypes |
|
46 |
|
47 // Local constants |
|
48 |
|
49 // ======== LOCAL FUNCTIONS ======== |
|
50 |
|
51 // ======== MEMBER FUNCTIONS ======== |
|
52 |
|
53 |
|
54 /*! |
|
55 Constructor. |
|
56 |
|
57 @param [in] parent Pointer to EAP Wizard private implementation. |
|
58 */ |
|
59 EapWizardPagePacStorePasswordConfirm::EapWizardPagePacStorePasswordConfirm( |
|
60 EapWizardPrivate* parent) : |
|
61 EapWizardPage(parent), |
|
62 mDocumentLoader(NULL), |
|
63 mValidator(NULL), |
|
64 mWidget(NULL), |
|
65 mEditPasswordConfirm(NULL), |
|
66 mLabelError(NULL) |
|
67 { |
|
68 OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_ENTRY ); |
|
69 OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EXIT ); |
|
70 } |
|
71 |
|
72 /*! |
|
73 Destructor. |
|
74 */ |
|
75 EapWizardPagePacStorePasswordConfirm::~EapWizardPagePacStorePasswordConfirm() |
|
76 { |
|
77 OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_ENTRY ); |
|
78 OstTraceFunctionExit0( DUP1_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EXIT ); |
|
79 } |
|
80 |
|
81 /*! |
|
82 See WlanWizardPage. |
|
83 */ |
|
84 HbWidget* EapWizardPagePacStorePasswordConfirm::initializePage() |
|
85 { |
|
86 OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_INITIALIZEPAGE_ENTRY ); |
|
87 if (!mWidget) { |
|
88 bool ok; |
|
89 mDocumentLoader.reset( |
|
90 new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); |
|
91 mDocumentLoader->load(":/docml/occ_eap_wizard_08.docml", &ok); |
|
92 Q_ASSERT(ok); |
|
93 |
|
94 loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); |
|
95 |
|
96 mWidget = qobject_cast<HbWidget*> (mDocumentLoader->findWidget("view")); |
|
97 Q_ASSERT(mWidget); |
|
98 |
|
99 mEditPasswordConfirm = qobject_cast<HbLineEdit*> (mDocumentLoader->findWidget( |
|
100 "lineEditPasswordConfirm")); |
|
101 Q_ASSERT(mEditPasswordConfirm); |
|
102 |
|
103 mLabelError = qobject_cast<HbLabel*> (mDocumentLoader->findWidget("labelError")); |
|
104 Q_ASSERT(mLabelError); |
|
105 |
|
106 mValidator.reset( |
|
107 mWizard->eapConfigurationInterface()->validatorPacStore( |
|
108 EapQtPacStoreConfig::PacStorePasswordConfirmation)); |
|
109 Q_ASSERT(mValidator.data()); |
|
110 |
|
111 mLabelError->setPlainText(""); |
|
112 // Configurate editor properties and configurations |
|
113 mValidator->updateEditor(mEditPasswordConfirm); |
|
114 |
|
115 mEditPasswordConfirm->installEventFilter(this); |
|
116 |
|
117 ok = connect( |
|
118 mWizard->wizardHelper()->mainWindow(), |
|
119 SIGNAL(orientationChanged(Qt::Orientation)), |
|
120 this, |
|
121 SLOT(loadDocmlSection(Qt::Orientation))); |
|
122 Q_ASSERT(ok); |
|
123 } |
|
124 |
|
125 OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_INITIALIZEPAGE_EXIT ); |
|
126 return mWidget; |
|
127 } |
|
128 |
|
129 |
|
130 /*! |
|
131 Loads the required orientation of docml. |
|
132 |
|
133 @param [in] orientation Orientation to be loaded. |
|
134 */ |
|
135 void EapWizardPagePacStorePasswordConfirm::loadDocmlSection(Qt::Orientation orientation) |
|
136 { |
|
137 OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_LOADDOCMLSECTION_ENTRY ); |
|
138 EapWizardPage::loadDocmlSection( |
|
139 mDocumentLoader.data(), |
|
140 orientation, |
|
141 ":/docml/occ_eap_wizard_08.docml", |
|
142 "portrait_section", |
|
143 "landscape_section"); |
|
144 OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_LOADDOCMLSECTION_EXIT ); |
|
145 } |
|
146 |
|
147 /*! |
|
148 See WlanWizardPage. |
|
149 |
|
150 @return next wizard page: |
|
151 - EapWizardPage::PageUsernamePassword: When password is ok |
|
152 - WlanWizardPage::PageNone: When password is not ok |
|
153 */ |
|
154 int EapWizardPagePacStorePasswordConfirm::nextId() const |
|
155 { |
|
156 OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_NEXTID_ENTRY ); |
|
157 int id; |
|
158 if (mValidator->validate(mEditPasswordConfirm->text()) == |
|
159 EapQtValidator::StatusOk) { |
|
160 |
|
161 mWizard->setConfigurations( |
|
162 EapWizardPrivate::PacStorePassword, |
|
163 mEditPasswordConfirm->text()); |
|
164 |
|
165 id = EapWizardPage::PageUsernamePassword; |
|
166 } else { |
|
167 id = WlanWizardPage::PageNone; |
|
168 mLabelError->setPlainText(hbTrId("txt_occ_info_incorrect_password")); |
|
169 } |
|
170 |
|
171 OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_NEXTID_EXIT ); |
|
172 return id; |
|
173 } |
|
174 |
|
175 /*! |
|
176 See WlanWizardPage::showPage(). |
|
177 |
|
178 Sets the focus to line editor, opens virtual keyboard. |
|
179 |
|
180 @return true, content is valid always. |
|
181 */ |
|
182 bool EapWizardPagePacStorePasswordConfirm::showPage() |
|
183 { |
|
184 OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_SHOWPAGE_ENTRY ); |
|
185 mEditPasswordConfirm->setFocus(); |
|
186 OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_SHOWPAGE_EXIT ); |
|
187 return true; |
|
188 } |
|
189 |
|
190 /*! |
|
191 Event filter for HbLineEdit. When editor gets focus a possible error text |
|
192 is cleared. |
|
193 |
|
194 @param [in] obj Pointer to object to where the event is sent |
|
195 @param [in] event Event |
|
196 */ |
|
197 bool EapWizardPagePacStorePasswordConfirm::eventFilter( |
|
198 QObject *obj, QEvent *event) |
|
199 { |
|
200 OstTraceFunctionEntry0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EVENTFILTER_ENTRY ); |
|
201 if (obj == mEditPasswordConfirm && event->type() == QEvent::FocusIn) { |
|
202 mLabelError->setPlainText(""); |
|
203 } |
|
204 OstTraceFunctionExit0( EAPWIZARDPAGEPACSTOREPASSWORDCONFIRM_EVENTFILTER_EXIT ); |
|
205 return false; |
|
206 } |