1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * EAP Wizard Page: Certificate Authority Selection. |
15 * EAP Wizard Page: Certificate Authority Selection. |
16 * |
16 */ |
17 */ |
|
18 |
17 |
19 // System includes |
18 // System includes |
|
19 |
20 #include <HbDocumentLoader> |
20 #include <HbDocumentLoader> |
21 #include <HbMainWindow> |
21 #include <HbMainWindow> |
22 #include <HbWidget> |
22 #include <HbWidget> |
23 #include <HbRadioButtonList> |
23 #include <HbRadioButtonList> |
24 #include <HbLabel> |
24 #include <HbLabel> |
|
25 |
25 #include <eapqtpluginhandle.h> |
26 #include <eapqtpluginhandle.h> |
26 #include <eapqtplugininfo.h> |
27 #include <eapqtplugininfo.h> |
27 #include <eapqtconfiginterface.h> |
28 #include <eapqtconfiginterface.h> |
28 #include <eapqtcertificateinfo.h> |
29 #include <eapqtcertificateinfo.h> |
29 |
30 |
30 // User includes |
31 // User includes |
|
32 |
31 #include "wlanwizardhelper.h" |
33 #include "wlanwizardhelper.h" |
32 #include "eapwizard_p.h" |
34 #include "eapwizard_p.h" |
33 #include "eapwizardpagecertca.h" |
35 #include "eapwizardpagecertca.h" |
|
36 |
34 #include "OstTraceDefinitions.h" |
37 #include "OstTraceDefinitions.h" |
35 #ifdef OST_TRACE_COMPILER_IN_USE |
38 #ifdef OST_TRACE_COMPILER_IN_USE |
36 #include "eapwizardpagecertcaTraces.h" |
39 #include "eapwizardpagecertcaTraces.h" |
37 #endif |
40 #endif |
38 |
41 |
61 mDocumentLoader(NULL), |
64 mDocumentLoader(NULL), |
62 mWidget(NULL), |
65 mWidget(NULL), |
63 mTitle(NULL), |
66 mTitle(NULL), |
64 mCertList(NULL) |
67 mCertList(NULL) |
65 { |
68 { |
66 OstTraceFunctionEntry0( EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY ); |
69 OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY); |
67 OstTraceFunctionExit0( EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT ); |
70 OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT); |
68 } |
71 } |
69 |
72 |
70 /*! |
73 /*! |
71 Destructor. |
74 Destructor. |
72 */ |
75 */ |
73 EapWizardPageCertCa::~EapWizardPageCertCa() |
76 EapWizardPageCertCa::~EapWizardPageCertCa() |
74 { |
77 { |
75 OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY ); |
78 OstTraceFunctionEntry0(DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY); |
76 OstTraceFunctionExit0( DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT ); |
79 OstTraceFunctionExit0(DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT); |
77 } |
80 } |
78 |
81 |
79 /*! |
82 /*! |
80 See WlanWizardPage. |
83 See WlanWizardPage. |
81 */ |
84 */ |
82 HbWidget* EapWizardPageCertCa::initializePage() |
85 HbWidget* EapWizardPageCertCa::initializePage() |
83 { |
86 { |
84 OstTraceFunctionEntry0( EAPWIZARDPAGECERTCA_INITIALIZEPAGE_ENTRY ); |
87 OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_INITIALIZEPAGE_ENTRY); |
|
88 |
85 if (!mWidget) { |
89 if (!mWidget) { |
86 mDocumentLoader.reset( new HbDocumentLoader( |
90 mDocumentLoader.reset( new HbDocumentLoader( |
87 mWizard->wizardHelper()->mainWindow()) ); |
91 mWizard->wizardHelper()->mainWindow()) ); |
88 |
92 |
89 bool ok; |
93 bool ok; |
119 confIf->updateCertificates(); |
123 confIf->updateCertificates(); |
120 mCerts = confIf->certificateAuthorityCertificates(); |
124 mCerts = confIf->certificateAuthorityCertificates(); |
121 |
125 |
122 QStringList list; |
126 QStringList list; |
123 list << hbTrId("txt_occ_setlabel_val_select_automatically"); |
127 list << hbTrId("txt_occ_setlabel_val_select_automatically"); |
124 |
|
125 for (int i = 0; i < mCerts.count(); ++i) { |
128 for (int i = 0; i < mCerts.count(); ++i) { |
126 // TODO: workaround for BBHA-863EJN |
129 list << mCerts.at(i).value(EapQtCertificateInfo::CertificateLabel).toString(); |
127 // graphics memory runs out for long lists and items |
|
128 QString tmp(mCerts.at(i).value( |
|
129 EapQtCertificateInfo::CertificateLabel).toString()); |
|
130 tmp.truncate(10); |
|
131 list << tmp; |
|
132 } |
130 } |
133 |
131 |
134 // If certificate list has been changed update the content otherwise do not |
132 // If certificate list has been changed update the content otherwise do not |
135 // change it |
133 // change it |
136 if (list != mCertList->items()) { |
134 if (list != mCertList->items()) { |
137 mCertList->setItems(list); |
135 mCertList->setItems(list); |
138 // Automatic is selected by default |
136 // Automatic is selected by default |
139 mCertList->setSelected(IndexForAutomatic); |
137 mCertList->setSelected(IndexForAutomatic); |
140 } |
138 } |
141 OstTraceFunctionExit0( EAPWIZARDPAGECERTCA_INITIALIZEPAGE_EXIT ); |
139 |
|
140 OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_INITIALIZEPAGE_EXIT); |
142 return mWidget; |
141 return mWidget; |
143 } |
142 } |
144 |
143 |
145 /*! |
144 /*! |
146 Loads the required orientation of docml. |
145 Loads the required orientation of docml. |
147 |
146 |
148 @param [in] orientation Orientation to be loaded. |
147 @param [in] orientation Orientation to be loaded. |
149 */ |
148 */ |
150 void EapWizardPageCertCa::loadDocmlSection(Qt::Orientation orientation) |
149 void EapWizardPageCertCa::loadDocmlSection(Qt::Orientation orientation) |
151 { |
150 { |
152 OstTraceFunctionEntry0( EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_ENTRY ); |
151 OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_ENTRY); |
|
152 |
153 EapWizardPage::loadDocmlSection( |
153 EapWizardPage::loadDocmlSection( |
154 mDocumentLoader.data(), |
154 mDocumentLoader.data(), |
155 orientation, |
155 orientation, |
156 ":/docml/occ_eap_wizard_01_02_04.docml", |
156 ":/docml/occ_eap_wizard_01_02_04.docml", |
157 "portrait_section", |
157 "portrait_section", |
158 "landscape_section"); |
158 "landscape_section"); |
159 OstTraceFunctionExit0( EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_EXIT ); |
159 |
|
160 OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_EXIT); |
160 } |
161 } |
161 |
162 |
162 /*! |
163 /*! |
163 See WlanWizardPage. |
164 See WlanWizardPage. |
164 |
165 |
166 - EapWizardPage::PageCertificateUser: For EAP-TLS |
167 - EapWizardPage::PageCertificateUser: For EAP-TLS |
167 - EapWizardPage::PageIdentity: For EAP-TTLS and PEAP |
168 - EapWizardPage::PageIdentity: For EAP-TTLS and PEAP |
168 */ |
169 */ |
169 int EapWizardPageCertCa::nextId() const |
170 int EapWizardPageCertCa::nextId() const |
170 { |
171 { |
171 OstTraceFunctionEntry0( EAPWIZARDPAGECERTCA_NEXTID_ENTRY ); |
172 OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_NEXTID_ENTRY); |
|
173 |
172 int id = WlanWizardPage::PageNone; |
174 int id = WlanWizardPage::PageNone; |
173 bool ok; |
175 bool ok; |
174 int type = mWizard->configurations(EapWizardPrivate::OuterType).toInt(&ok); |
176 int type = mWizard->configurations(EapWizardPrivate::OuterType).toInt(&ok); |
175 Q_ASSERT(ok); |
177 Q_ASSERT(ok); |
176 |
178 |
177 if (type == EapQtPluginHandle::PluginEapTls) { |
179 if (type == EapQtPluginHandle::PluginEapTls) { |
178 id = EapWizardPage::PageCertificateUser; |
180 id = EapWizardPage::PageCertificateUser; |
179 } else { |
181 } else { |
180 Q_ASSERT(type == EapQtPluginHandle::PluginEapTtls || |
182 Q_ASSERT( |
|
183 type == EapQtPluginHandle::PluginEapTtls || |
181 type == EapQtPluginHandle::PluginPeap); |
184 type == EapQtPluginHandle::PluginPeap); |
182 id = EapWizardPage::PageIdentity; |
185 id = EapWizardPage::PageIdentity; |
183 } |
186 } |
184 |
187 |
185 int selected = mCertList->selected(); |
188 int selected = mCertList->selected(); |
186 if (selected == IndexForAutomatic) { |
189 if (selected == IndexForAutomatic) { |
187 mWizard->setConfigurations(EapWizardPrivate::CertificateCa, QVariant()); |
190 mWizard->setConfigurations( |
|
191 EapWizardPrivate::CertificateCa, |
|
192 QVariant()); |
188 } else { |
193 } else { |
189 mWizard->setConfigurations( |
194 mWizard->setConfigurations( |
190 EapWizardPrivate::CertificateCa, qVariantFromValue(mCerts.at( |
195 EapWizardPrivate::CertificateCa, |
191 selected - AmountOfNonCertItems))); |
196 qVariantFromValue(mCerts.at(selected - AmountOfNonCertItems))); |
192 } |
197 } |
193 |
198 |
194 OstTraceFunctionExit0( EAPWIZARDPAGECERTCA_NEXTID_EXIT ); |
199 OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_NEXTID_EXIT); |
195 return id; |
200 return id; |
196 } |
201 } |