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 "eapwizardpagenewpacstore.h" |
|
33 #include "eapwizard_p.h" |
|
34 #include "OstTraceDefinitions.h" |
|
35 #ifdef OST_TRACE_COMPILER_IN_USE |
|
36 #include "eapwizardpagenewpacstoreTraces.h" |
|
37 #endif |
|
38 |
|
39 |
|
40 /*! |
|
41 \class EapWizardPageNewPacStore |
|
42 \brief Implements EAP wizard page: New 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 EapWizardPageNewPacStore::EapWizardPageNewPacStore( |
|
60 EapWizardPrivate* parent) : |
|
61 EapWizardPage(parent), |
|
62 mDocumentLoader(NULL), |
|
63 mValidator(NULL), |
|
64 mWidget(NULL), |
|
65 mEditPasswordNew(NULL), |
|
66 mEditPasswordConfirm(NULL), |
|
67 mTitlePasswordNew(NULL), |
|
68 mTitlePasswordConfirm(NULL) |
|
69 { |
|
70 OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_EAPWIZARDPAGENEWPACSTORE_ENTRY ); |
|
71 OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_EAPWIZARDPAGENEWPACSTORE_EXIT ); |
|
72 } |
|
73 |
|
74 /*! |
|
75 Destructor. |
|
76 */ |
|
77 EapWizardPageNewPacStore::~EapWizardPageNewPacStore() |
|
78 { |
|
79 OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGENEWPACSTORE_EAPWIZARDPAGENEWPACSTORE_ENTRY ); |
|
80 OstTraceFunctionExit0( DUP1_EAPWIZARDPAGENEWPACSTORE_EAPWIZARDPAGENEWPACSTORE_EXIT ); |
|
81 } |
|
82 |
|
83 /*! |
|
84 See WlanWizardPage. |
|
85 */ |
|
86 HbWidget* EapWizardPageNewPacStore::initializePage() |
|
87 { |
|
88 OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_INITIALIZEPAGE_ENTRY ); |
|
89 if (!mWidget) { |
|
90 bool ok; |
|
91 mDocumentLoader.reset( |
|
92 new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); |
|
93 mDocumentLoader->load(":/docml/occ_eap_wizard_05_07.docml", &ok); |
|
94 Q_ASSERT(ok); |
|
95 |
|
96 loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); |
|
97 |
|
98 mWidget = qobject_cast<HbWidget*> (mDocumentLoader->findWidget("view")); |
|
99 Q_ASSERT(mWidget); |
|
100 |
|
101 mTitlePasswordNew = qobject_cast<HbLabel*> (mDocumentLoader->findWidget("setlabel_55")); |
|
102 Q_ASSERT(mTitlePasswordNew); |
|
103 |
|
104 mTitlePasswordConfirm = qobject_cast<HbLabel*> (mDocumentLoader->findWidget("setlabel_56")); |
|
105 Q_ASSERT(mTitlePasswordConfirm); |
|
106 |
|
107 mEditPasswordNew = qobject_cast<HbLineEdit*> (mDocumentLoader->findWidget("lineEditUsername")); |
|
108 Q_ASSERT(mEditPasswordNew); |
|
109 |
|
110 mEditPasswordConfirm = qobject_cast<HbLineEdit*> (mDocumentLoader->findWidget("lineEditPassword")); |
|
111 Q_ASSERT(mEditPasswordConfirm); |
|
112 |
|
113 mValidator.reset( |
|
114 mWizard->eapConfigurationInterface()->validatorPacStore( |
|
115 EapQtPacStoreConfig::PacStorePassword)); |
|
116 Q_ASSERT(mValidator.data()); |
|
117 |
|
118 mTitlePasswordNew->setPlainText(hbTrId("txt_occ_setlabel_new_pac_store_password")); |
|
119 mTitlePasswordConfirm->setPlainText(hbTrId("txt_occ_setlabel_confirm_password")); |
|
120 |
|
121 // Configure editors properties |
|
122 mValidator->updateEditor(mEditPasswordNew); |
|
123 mValidator->updateEditor(mEditPasswordConfirm); |
|
124 |
|
125 ok = connect( |
|
126 mWizard->wizardHelper()->mainWindow(), |
|
127 SIGNAL(orientationChanged(Qt::Orientation)), |
|
128 this, |
|
129 SLOT(loadDocmlSection(Qt::Orientation))); |
|
130 Q_ASSERT(ok); |
|
131 |
|
132 ok = connect( |
|
133 mEditPasswordNew, SIGNAL(textChanged(const QString &)), |
|
134 this, SLOT(textChanged(const QString &))); |
|
135 Q_ASSERT(ok); |
|
136 |
|
137 ok = connect( |
|
138 mEditPasswordConfirm, SIGNAL(textChanged(const QString &)), |
|
139 this, SLOT(textChanged(const QString &))); |
|
140 Q_ASSERT(ok); |
|
141 } |
|
142 OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_INITIALIZEPAGE_EXIT ); |
|
143 return mWidget; |
|
144 } |
|
145 |
|
146 /*! |
|
147 Loads the required orientation of docml. |
|
148 |
|
149 @param [in] orientation Orientation to be loaded. |
|
150 */ |
|
151 void EapWizardPageNewPacStore::loadDocmlSection(Qt::Orientation orientation) |
|
152 { |
|
153 OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_LOADDOCMLSECTION_ENTRY ); |
|
154 EapWizardPage::loadDocmlSection( |
|
155 mDocumentLoader.data(), |
|
156 orientation, |
|
157 ":/docml/occ_eap_wizard_05_07.docml", |
|
158 "portrait_section", |
|
159 "landscape_section"); |
|
160 OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_LOADDOCMLSECTION_EXIT ); |
|
161 } |
|
162 |
|
163 /*! |
|
164 See WlanWizardPage. |
|
165 |
|
166 Validates the content of the page. |
|
167 |
|
168 @return true if content is valid. |
|
169 */ |
|
170 bool EapWizardPageNewPacStore::showPage() |
|
171 { |
|
172 OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_SHOWPAGE_ENTRY ); |
|
173 bool valid = false; |
|
174 if (mValidator->validate(mEditPasswordNew->text()) == EapQtValidator::StatusOk && |
|
175 mEditPasswordNew->text() == mEditPasswordConfirm->text()) { |
|
176 valid = true; |
|
177 } |
|
178 OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_SHOWPAGE_EXIT ); |
|
179 return valid; |
|
180 } |
|
181 |
|
182 /*! |
|
183 See WlanWizardPage. |
|
184 |
|
185 @return next wizard page: EapWizardPage::PageUsernamePassword |
|
186 */ |
|
187 int EapWizardPageNewPacStore::nextId() const |
|
188 { |
|
189 OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_NEXTID_ENTRY ); |
|
190 mWizard->setConfigurations(EapWizardPrivate::PacStorePassword, mEditPasswordNew->text()); |
|
191 OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_NEXTID_EXIT ); |
|
192 return EapWizardPage::PageUsernamePassword; |
|
193 } |
|
194 |
|
195 /*! |
|
196 Slot for textChanged() signal from HbLineEdit. |
|
197 |
|
198 @param [in] text NOT USED. |
|
199 */ |
|
200 void EapWizardPageNewPacStore::textChanged(const QString &text) |
|
201 { |
|
202 OstTraceFunctionEntry0( EAPWIZARDPAGENEWPACSTORE_TEXTCHANGED_ENTRY ); |
|
203 Q_UNUSED(text); |
|
204 mWizard->wizardHelper()->enableNextButton(showPage()); |
|
205 OstTraceFunctionExit0( EAPWIZARDPAGENEWPACSTORE_TEXTCHANGED_EXIT ); |
|
206 } |
|