31
|
1 |
/*
|
39
|
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 |
* WLAN Wizard Page: SSID Selection.
|
|
16 |
*/
|
31
|
17 |
|
|
18 |
// System includes
|
60
|
19 |
|
31
|
20 |
#include <HbDocumentLoader>
|
|
21 |
#include <HbMainWindow>
|
|
22 |
#include <HbWidget>
|
|
23 |
#include <HbLineEdit>
|
|
24 |
#include <HbEditorInterface>
|
|
25 |
#include <HbLabel>
|
60
|
26 |
|
31
|
27 |
#include <wlanqtutils.h>
|
|
28 |
|
|
29 |
// User includes
|
60
|
30 |
|
31
|
31 |
#include "wlanwizardpagessid.h"
|
|
32 |
#include "wlanwizard_p.h"
|
|
33 |
#include "wlanwizardutils.h"
|
60
|
34 |
|
31
|
35 |
#include "OstTraceDefinitions.h"
|
|
36 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
37 |
#include "wlanwizardpagessidTraces.h"
|
|
38 |
#endif
|
|
39 |
|
|
40 |
/*!
|
39
|
41 |
* Constructor method for the SSID query view object.
|
|
42 |
* @param [in] parent pointer to parent object.
|
31
|
43 |
*/
|
|
44 |
WlanWizardPageSsid::WlanWizardPageSsid(WlanWizardPrivate* parent) :
|
|
45 |
WlanWizardPageInternal(parent),
|
|
46 |
mWidget(NULL),
|
|
47 |
mLabel(NULL),
|
|
48 |
mSsid(NULL),
|
|
49 |
mLoader(NULL)
|
|
50 |
{
|
60
|
51 |
OstTraceFunctionEntry0(WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_ENTRY);
|
|
52 |
OstTraceFunctionExit0(WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_EXIT);
|
31
|
53 |
}
|
|
54 |
|
|
55 |
/*!
|
|
56 |
* Destructor. Loader widget is deleted.
|
|
57 |
* All document widgets are deleted by wlanwizard_p destructor.
|
|
58 |
*/
|
|
59 |
WlanWizardPageSsid::~WlanWizardPageSsid()
|
|
60 |
{
|
60
|
61 |
OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_ENTRY);
|
|
62 |
|
31
|
63 |
delete mLoader;
|
60
|
64 |
|
|
65 |
OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESSID_WLANWIZARDPAGESSID_EXIT);
|
31
|
66 |
}
|
|
67 |
|
|
68 |
/*!
|
|
69 |
* Page initialization. If view is already loaded, does nothing.
|
39
|
70 |
* @return pointer to widget "occ_add_wlan_01".
|
31
|
71 |
*/
|
|
72 |
HbWidget* WlanWizardPageSsid::initializePage()
|
|
73 |
{
|
60
|
74 |
OstTraceFunctionEntry0(WLANWIZARDPAGESSID_INITIALIZEPAGE_ENTRY);
|
|
75 |
|
|
76 |
OstTrace0(
|
|
77 |
TRACE_NORMAL,
|
|
78 |
WLANWIZARDPAGESSID_INITIALIZEPAGE,
|
|
79 |
"WlanWizardPageSsid::initializePage");
|
31
|
80 |
|
39
|
81 |
// It is not possible for this method to be called more than once during
|
|
82 |
// wizard lifetime.
|
|
83 |
Q_ASSERT(mWidget == NULL);
|
31
|
84 |
|
39
|
85 |
bool ok;
|
31
|
86 |
|
39
|
87 |
mLoader = new HbDocumentLoader(mWizard->mainWindow());
|
31
|
88 |
|
39
|
89 |
mLoader->load(":/docml/occ_add_wlan_01_04.docml", &ok);
|
|
90 |
Q_ASSERT(ok);
|
|
91 |
|
|
92 |
// Load orientation
|
|
93 |
loadDocmlSection(mWizard->mainWindow()->orientation());
|
31
|
94 |
|
39
|
95 |
// Load widgets
|
|
96 |
mWidget = qobject_cast<HbWidget*> (mLoader->findWidget(
|
|
97 |
"occ_add_wlan_01"));
|
|
98 |
Q_ASSERT(mWidget != NULL);
|
31
|
99 |
|
39
|
100 |
mLabel = qobject_cast<HbLabel*> (mLoader->findWidget("dialog"));
|
|
101 |
Q_ASSERT(mLabel != NULL);
|
31
|
102 |
|
39
|
103 |
mSsid = qobject_cast<HbLineEdit*> (mLoader->findWidget("lineEditKey"));
|
|
104 |
Q_ASSERT(mSsid != NULL);
|
|
105 |
|
|
106 |
mLabel->setPlainText(hbTrId(
|
|
107 |
"txt_occ_dialog_insert_the_name_of_the_new_wlan_net"));
|
31
|
108 |
|
39
|
109 |
// Connect orientation signal from the main window to orientation
|
|
110 |
// loader.
|
|
111 |
ok = connect(mWizard->mainWindow(),
|
|
112 |
SIGNAL(orientationChanged(Qt::Orientation)), this,
|
|
113 |
SLOT(loadDocmlSection(Qt::Orientation)));
|
|
114 |
Q_ASSERT(ok);
|
31
|
115 |
|
39
|
116 |
// Connect text change-signal from input dialog to handler function
|
|
117 |
ok = connect(mSsid, SIGNAL(textChanged(const QString &)), this,
|
|
118 |
SLOT(textChanged(const QString &)));
|
|
119 |
Q_ASSERT(ok);
|
31
|
120 |
|
39
|
121 |
HbEditorInterface editInterface(mSsid);
|
|
122 |
|
|
123 |
editInterface.setInputConstraints(
|
60
|
124 |
HbEditorConstraintAutoCompletingField |
|
|
125 |
HbEditorConstraintLatinAlphabetOnly);
|
39
|
126 |
|
|
127 |
editInterface.setSmileyTheme(HbSmileyTheme());
|
|
128 |
editInterface.setEditorClass(HbInputEditorClassNetworkName);
|
|
129 |
mSsid->setInputMethodHints(
|
|
130 |
Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase);
|
|
131 |
mSsid->setMaxLength(WlanWizardUtils::SsidMaxLength);
|
31
|
132 |
|
60
|
133 |
OstTraceFunctionExit0(WLANWIZARDPAGESSID_INITIALIZEPAGE_EXIT);
|
39
|
134 |
return mWidget;
|
31
|
135 |
}
|
|
136 |
|
|
137 |
/*!
|
39
|
138 |
* This method is overrides the default implementation from WlanWizardPage.
|
|
139 |
* It indicates whether the Next-button should be enabled or not.
|
|
140 |
* @return true, if mSsid edit field is not empty.
|
|
141 |
*/
|
|
142 |
bool WlanWizardPageSsid::showPage()
|
|
143 |
{
|
60
|
144 |
OstTraceFunctionEntry0(WLANWIZARDPAGESSID_SHOWPAGE_ENTRY);
|
|
145 |
|
39
|
146 |
// Initiate the scanning of public APs here.
|
|
147 |
mWizard->wlanQtUtils()->scanWlanAps();
|
|
148 |
|
|
149 |
// Open virtual keyboard by setting focus to line edit
|
|
150 |
mSsid->setFocus();
|
60
|
151 |
|
|
152 |
OstTraceFunctionExit0(WLANWIZARDPAGESSID_SHOWPAGE_EXIT);
|
39
|
153 |
return !(mSsid->text().isEmpty());
|
|
154 |
}
|
|
155 |
|
|
156 |
/*!
|
|
157 |
* Stores the SSID selection in the configuration.
|
|
158 |
* @param [out] removeFromStack returns false.
|
|
159 |
* @return WlanWizardPageScanning page id.
|
31
|
160 |
*/
|
|
161 |
int WlanWizardPageSsid::nextId(bool &removeFromStack) const
|
|
162 |
{
|
60
|
163 |
OstTraceFunctionEntry0(WLANWIZARDPAGESSID_NEXTID_ENTRY);
|
|
164 |
|
31
|
165 |
removeFromStack = false;
|
|
166 |
|
39
|
167 |
// SSID is stored into configuration
|
60
|
168 |
QString ssid(mSsid->text());
|
|
169 |
mWizard->setConfiguration(WlanWizardPrivate::ConfName, ssid);
|
|
170 |
mWizard->setConfiguration(WlanWizardPrivate::ConfSsid, ssid.toUtf8());
|
39
|
171 |
|
60
|
172 |
OstTraceFunctionExit0(WLANWIZARDPAGESSID_NEXTID_EXIT);
|
39
|
173 |
return WlanWizardPageInternal::PageScanning;
|
31
|
174 |
}
|
|
175 |
|
|
176 |
/*!
|
39
|
177 |
* Loads the document orientation information from occ_add_wlan_01_04.docml
|
|
178 |
* This is called each time phone orientation changes.
|
|
179 |
* @param [in] orientation indicates whether the phone is in portrait or
|
|
180 |
* landscape mode.
|
31
|
181 |
*/
|
39
|
182 |
void WlanWizardPageSsid::loadDocmlSection(Qt::Orientation orientation)
|
31
|
183 |
{
|
60
|
184 |
OstTraceFunctionEntry0(WLANWIZARDPAGESSID_LOADDOCMLSECTION_ENTRY);
|
|
185 |
|
|
186 |
OstTrace1(
|
|
187 |
TRACE_FLOW,
|
|
188 |
WLANWIZARDPAGESSID_LOADDOCML,
|
31
|
189 |
"WlanWizardPageSsid::loadDocml - orientation ;orientation=%x",
|
60
|
190 |
(TUint)orientation);
|
31
|
191 |
|
39
|
192 |
WlanWizardPageInternal::loadDocmlSection(
|
|
193 |
mLoader,
|
|
194 |
orientation,
|
|
195 |
":/docml/occ_add_wlan_01_04.docml",
|
|
196 |
"portrait_section",
|
|
197 |
"landscape_section");
|
60
|
198 |
|
|
199 |
OstTraceFunctionExit0(WLANWIZARDPAGESSID_LOADDOCMLSECTION_EXIT);
|
31
|
200 |
}
|
|
201 |
|
|
202 |
/*!
|
39
|
203 |
* Executed when changes have been made to the mSsid field (and the field is
|
|
204 |
* not empty).
|
|
205 |
* @param [in] text is not used at this point.
|
31
|
206 |
*/
|
39
|
207 |
void WlanWizardPageSsid::textChanged(const QString &text)
|
31
|
208 |
{
|
60
|
209 |
OstTraceFunctionEntry0(WLANWIZARDPAGESSID_TEXTCHANGED_ENTRY);
|
|
210 |
|
39
|
211 |
Q_UNUSED(text);
|
60
|
212 |
OstTrace0(
|
|
213 |
TRACE_FLOW,
|
|
214 |
WLANWIZARDPAGESSID_TEXTCHANGED,
|
|
215 |
"WlanWizardPageSsid::textChanged in text edit widget");
|
31
|
216 |
|
39
|
217 |
mWizard->enableNextButton(!(mSsid->text().isEmpty()));
|
60
|
218 |
|
|
219 |
OstTraceFunctionExit0(WLANWIZARDPAGESSID_TEXTCHANGED_EXIT);
|
31
|
220 |
}
|