39
|
1 |
/*
|
53
|
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: Certificate Authority Selection.
|
|
16 |
*/
|
39
|
17 |
|
|
18 |
// System includes
|
53
|
19 |
|
39
|
20 |
#include <HbDocumentLoader>
|
|
21 |
#include <HbMainWindow>
|
|
22 |
#include <HbWidget>
|
|
23 |
#include <HbRadioButtonList>
|
|
24 |
#include <HbLabel>
|
53
|
25 |
|
39
|
26 |
#include <eapqtpluginhandle.h>
|
|
27 |
#include <eapqtplugininfo.h>
|
|
28 |
#include <eapqtconfiginterface.h>
|
|
29 |
#include <eapqtcertificateinfo.h>
|
|
30 |
|
|
31 |
// User includes
|
53
|
32 |
|
39
|
33 |
#include "wlanwizardhelper.h"
|
|
34 |
#include "eapwizard_p.h"
|
|
35 |
#include "eapwizardpagecertca.h"
|
53
|
36 |
|
43
|
37 |
#include "OstTraceDefinitions.h"
|
|
38 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
39 |
#include "eapwizardpagecertcaTraces.h"
|
|
40 |
#endif
|
|
41 |
|
39
|
42 |
|
|
43 |
/*!
|
|
44 |
\class EapWizardPageCertCa
|
|
45 |
\brief Implements EAP wizard page: Certificate Authority selection
|
|
46 |
*/
|
|
47 |
|
|
48 |
// External function prototypes
|
|
49 |
|
|
50 |
// Local constants
|
|
51 |
|
|
52 |
// ======== LOCAL FUNCTIONS ========
|
|
53 |
|
|
54 |
// ======== MEMBER FUNCTIONS ========
|
|
55 |
|
|
56 |
|
|
57 |
/*!
|
|
58 |
Constructor.
|
43
|
59 |
|
39
|
60 |
@param [in] parent Pointer to EAP Wizard private implementation.
|
|
61 |
*/
|
|
62 |
EapWizardPageCertCa::EapWizardPageCertCa(EapWizardPrivate* parent) :
|
|
63 |
EapWizardPage(parent),
|
|
64 |
mDocumentLoader(NULL),
|
|
65 |
mWidget(NULL),
|
|
66 |
mTitle(NULL),
|
|
67 |
mCertList(NULL)
|
|
68 |
{
|
53
|
69 |
OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY);
|
|
70 |
OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT);
|
39
|
71 |
}
|
|
72 |
|
|
73 |
/*!
|
|
74 |
Destructor.
|
|
75 |
*/
|
|
76 |
EapWizardPageCertCa::~EapWizardPageCertCa()
|
|
77 |
{
|
53
|
78 |
OstTraceFunctionEntry0(DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY);
|
|
79 |
OstTraceFunctionExit0(DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT);
|
39
|
80 |
}
|
|
81 |
|
|
82 |
/*!
|
|
83 |
See WlanWizardPage.
|
|
84 |
*/
|
|
85 |
HbWidget* EapWizardPageCertCa::initializePage()
|
|
86 |
{
|
53
|
87 |
OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_INITIALIZEPAGE_ENTRY);
|
|
88 |
|
39
|
89 |
if (!mWidget) {
|
|
90 |
mDocumentLoader.reset( new HbDocumentLoader(
|
|
91 |
mWizard->wizardHelper()->mainWindow()) );
|
43
|
92 |
|
39
|
93 |
bool ok;
|
|
94 |
mDocumentLoader->load(":/docml/occ_eap_wizard_01_02_04.docml", &ok);
|
|
95 |
Q_ASSERT(ok);
|
43
|
96 |
|
39
|
97 |
loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation());
|
43
|
98 |
|
39
|
99 |
mWidget = qobject_cast<HbWidget*> (
|
|
100 |
mDocumentLoader->findWidget("occ_eap_wizard_01"));
|
|
101 |
Q_ASSERT(mWidget);
|
|
102 |
|
|
103 |
mCertList = qobject_cast<HbRadioButtonList*> (
|
|
104 |
mDocumentLoader->findWidget("list"));
|
|
105 |
Q_ASSERT(mCertList);
|
43
|
106 |
|
39
|
107 |
mTitle = qobject_cast<HbLabel*> (mDocumentLoader->findWidget("title"));
|
|
108 |
Q_ASSERT(mTitle);
|
43
|
109 |
|
39
|
110 |
mTitle->setPlainText(
|
|
111 |
hbTrId("txt_occ_title_select_authority_certificate"));
|
43
|
112 |
|
39
|
113 |
ok = connect(
|
|
114 |
mWizard->wizardHelper()->mainWindow(),
|
|
115 |
SIGNAL(orientationChanged(Qt::Orientation)),
|
|
116 |
this,
|
|
117 |
SLOT(loadDocmlSection(Qt::Orientation)));
|
|
118 |
Q_ASSERT(ok);
|
|
119 |
}
|
43
|
120 |
|
39
|
121 |
EapQtConfigInterface* confIf = mWizard->eapConfigurationInterface();
|
|
122 |
// ignore return value
|
|
123 |
confIf->updateCertificates();
|
|
124 |
mCerts = confIf->certificateAuthorityCertificates();
|
|
125 |
|
|
126 |
QStringList list;
|
|
127 |
list << hbTrId("txt_occ_setlabel_val_select_automatically");
|
43
|
128 |
for (int i = 0; i < mCerts.count(); ++i) {
|
53
|
129 |
list << mCerts.at(i).value(EapQtCertificateInfo::CertificateLabel).toString();
|
39
|
130 |
}
|
43
|
131 |
|
39
|
132 |
// If certificate list has been changed update the content otherwise do not
|
|
133 |
// change it
|
|
134 |
if (list != mCertList->items()) {
|
|
135 |
mCertList->setItems(list);
|
|
136 |
// Automatic is selected by default
|
|
137 |
mCertList->setSelected(IndexForAutomatic);
|
|
138 |
}
|
53
|
139 |
|
|
140 |
OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_INITIALIZEPAGE_EXIT);
|
39
|
141 |
return mWidget;
|
|
142 |
}
|
|
143 |
|
|
144 |
/*!
|
|
145 |
Loads the required orientation of docml.
|
43
|
146 |
|
39
|
147 |
@param [in] orientation Orientation to be loaded.
|
|
148 |
*/
|
|
149 |
void EapWizardPageCertCa::loadDocmlSection(Qt::Orientation orientation)
|
|
150 |
{
|
53
|
151 |
OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_ENTRY);
|
|
152 |
|
39
|
153 |
EapWizardPage::loadDocmlSection(
|
|
154 |
mDocumentLoader.data(),
|
|
155 |
orientation,
|
|
156 |
":/docml/occ_eap_wizard_01_02_04.docml",
|
|
157 |
"portrait_section",
|
|
158 |
"landscape_section");
|
53
|
159 |
|
|
160 |
OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_EXIT);
|
39
|
161 |
}
|
|
162 |
|
|
163 |
/*!
|
|
164 |
See WlanWizardPage.
|
43
|
165 |
|
39
|
166 |
@return next wizard page:
|
|
167 |
- EapWizardPage::PageCertificateUser: For EAP-TLS
|
|
168 |
- EapWizardPage::PageIdentity: For EAP-TTLS and PEAP
|
|
169 |
*/
|
|
170 |
int EapWizardPageCertCa::nextId() const
|
|
171 |
{
|
53
|
172 |
OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_NEXTID_ENTRY);
|
|
173 |
|
39
|
174 |
int id = WlanWizardPage::PageNone;
|
|
175 |
bool ok;
|
|
176 |
int type = mWizard->configurations(EapWizardPrivate::OuterType).toInt(&ok);
|
|
177 |
Q_ASSERT(ok);
|
|
178 |
|
|
179 |
if (type == EapQtPluginHandle::PluginEapTls) {
|
|
180 |
id = EapWizardPage::PageCertificateUser;
|
|
181 |
} else {
|
53
|
182 |
Q_ASSERT(
|
|
183 |
type == EapQtPluginHandle::PluginEapTtls ||
|
39
|
184 |
type == EapQtPluginHandle::PluginPeap);
|
|
185 |
id = EapWizardPage::PageIdentity;
|
|
186 |
}
|
|
187 |
|
|
188 |
int selected = mCertList->selected();
|
|
189 |
if (selected == IndexForAutomatic) {
|
53
|
190 |
mWizard->setConfigurations(
|
|
191 |
EapWizardPrivate::CertificateCa,
|
|
192 |
QVariant());
|
39
|
193 |
} else {
|
|
194 |
mWizard->setConfigurations(
|
53
|
195 |
EapWizardPrivate::CertificateCa,
|
|
196 |
qVariantFromValue(mCerts.at(selected - AmountOfNonCertItems)));
|
39
|
197 |
}
|
|
198 |
|
53
|
199 |
OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_NEXTID_EXIT);
|
39
|
200 |
return id;
|
|
201 |
}
|