31
|
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 |
* WLAN Wizard: Private implementation.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef WLANWIZARD_P_H
|
|
20 |
#define WLANWIZARD_P_H
|
|
21 |
|
|
22 |
// System includes
|
|
23 |
#include <QObject>
|
|
24 |
#include <QHash>
|
|
25 |
|
|
26 |
// User includes
|
|
27 |
#include "wlanwizardhelper.h"
|
|
28 |
|
|
29 |
// Forward declarations
|
|
30 |
class QTimer;
|
|
31 |
class HbTranslator;
|
|
32 |
class HbStackedWidget;
|
|
33 |
class HbWidget;
|
|
34 |
class HbLabel;
|
|
35 |
class HbDialog;
|
|
36 |
class HbAction;
|
|
37 |
class HbDocumentLoader;
|
|
38 |
class HbMainWindow;
|
|
39 |
class WlanQtUtils;
|
|
40 |
class WlanWizardPlugin;
|
|
41 |
class WlanWizardPage;
|
|
42 |
class WlanWizard;
|
|
43 |
class EapWizard;
|
|
44 |
class WpsWizard;
|
|
45 |
|
|
46 |
class TestWlanWizardUi;
|
|
47 |
|
|
48 |
// External data types
|
|
49 |
|
|
50 |
// Constants
|
|
51 |
|
|
52 |
/*!
|
|
53 |
@addtogroup group_wlan_wizard
|
|
54 |
@{
|
|
55 |
*/
|
|
56 |
class WlanWizardPrivate: public QObject, public WlanWizardHelper
|
|
57 |
{
|
|
58 |
Q_OBJECT
|
|
59 |
|
|
60 |
public:
|
|
61 |
// API implementation
|
|
62 |
WlanWizardPrivate(WlanWizard* wizard, HbMainWindow *mainWindow);
|
|
63 |
virtual ~WlanWizardPrivate();
|
|
64 |
|
|
65 |
void setParameters(
|
|
66 |
const QString &ssid,
|
|
67 |
int networkMode,
|
|
68 |
int securityMode,
|
|
69 |
bool usePsk,
|
|
70 |
bool hidden,
|
|
71 |
bool wps);
|
|
72 |
|
|
73 |
void show();
|
|
74 |
|
|
75 |
public:
|
|
76 |
// For WLAN Wizard pages
|
|
77 |
int getNextPageId(
|
|
78 |
const QString &ssid,
|
|
79 |
int networkMode,
|
|
80 |
int securityMode,
|
|
81 |
bool usePsk,
|
|
82 |
bool hidden,
|
|
83 |
bool wps);
|
|
84 |
|
|
85 |
WlanQtUtils* wlanQtUtils() const;
|
|
86 |
WlanWizardPlugin* wlanWizardPlugin() const;
|
|
87 |
bool isEapEnabled() const;
|
|
88 |
bool handleIap();
|
|
89 |
|
|
90 |
public:
|
|
91 |
// from WlanWizardHelper, for all wizards
|
|
92 |
virtual QVariant configuration(ConfigurationId confId) const;
|
|
93 |
virtual void setConfiguration(ConfigurationId confId, const QVariant &value);
|
|
94 |
virtual void enableNextButton(bool enable);
|
|
95 |
virtual void enablePrevButton(bool enable);
|
|
96 |
virtual void addPage(int pageId, WlanWizardPage *page);
|
|
97 |
virtual void nextPage();
|
|
98 |
virtual HbMainWindow* mainWindow() const;
|
|
99 |
virtual bool isCurrentPage(const HbWidget *page) const;
|
|
100 |
virtual int nextPageId(bool useWps);
|
|
101 |
|
|
102 |
signals:
|
|
103 |
|
|
104 |
public slots:
|
|
105 |
|
|
106 |
protected:
|
|
107 |
|
|
108 |
protected slots:
|
|
109 |
|
|
110 |
private:
|
|
111 |
Q_DISABLE_COPY(WlanWizardPrivate)
|
|
112 |
static const int PageTimeout = 1500;
|
|
113 |
|
|
114 |
private slots:
|
|
115 |
void cancelTriggered();
|
|
116 |
void previousTriggered();
|
|
117 |
void nextTriggered();
|
|
118 |
void finishTriggered();
|
|
119 |
void onTimeOut();
|
|
120 |
void startPageOperation();
|
|
121 |
|
|
122 |
private:
|
|
123 |
void toNextPage();
|
|
124 |
void showPage(int pageId, bool removeFromStack);
|
|
125 |
void createPages();
|
|
126 |
void closeViews();
|
|
127 |
void updateFrame(int pageId);
|
|
128 |
void loadDocml();
|
|
129 |
void disconnectActions();
|
|
130 |
|
|
131 |
private:
|
|
132 |
// Not owned pointers
|
|
133 |
//! Pointer to Wizard API class, needed to send signals
|
|
134 |
WlanWizard *q_ptr;
|
|
135 |
//! Pointer to mainwindow from where the wizard was launched
|
|
136 |
HbMainWindow *mMainWindow;
|
|
137 |
//! used for timer protected pages (progressbar)
|
|
138 |
QTimer *mPageTimer;
|
|
139 |
//! Wizard heading aka HbDialog::heading
|
|
140 |
HbLabel *mTitle;
|
|
141 |
//! Toolbar action: Next
|
|
142 |
HbAction *mActionNext;
|
|
143 |
//! Toolbar action: Previous
|
|
144 |
HbAction *mActionPrevious;
|
|
145 |
//! Toolbar action: Finish
|
|
146 |
HbAction *mActionFinish;
|
|
147 |
//! Toolbar action: Cancel
|
|
148 |
HbAction *mActionCancel;
|
|
149 |
/*! acts as HbDialog::contentWidget. When next is clicked a wizard page
|
|
150 |
(HbWidget) is added to the stack. When prev is pressed the current
|
|
151 |
item is removed from the stack. The previous pages are always in the
|
|
152 |
stacked widget
|
|
153 |
*/
|
|
154 |
HbStackedWidget *mStackedWidget;
|
|
155 |
|
|
156 |
// Owned pointers
|
|
157 |
|
|
158 |
//! Dialog, from docml
|
|
159 |
QScopedPointer<HbDialog> mDialog;
|
|
160 |
//! Translator
|
|
161 |
QScopedPointer<HbTranslator> mTranslator;
|
|
162 |
//! Provides services like: create/update iap, scan, connect, disconnect
|
|
163 |
QScopedPointer<WlanQtUtils> mWlanQtUtils;
|
|
164 |
//! Document loader for docml
|
|
165 |
QScopedPointer<HbDocumentLoader> mDocLoader;
|
|
166 |
//! Extensible Authentication Protocol (EAP) Wizard plugin, instantiated
|
|
167 |
//! when required
|
|
168 |
EapWizard* mEapWizard;
|
|
169 |
//! Wifi Protected Setup (WPS) Wizard plugin, instantiated when required
|
|
170 |
WpsWizard* mWpsWizard;
|
|
171 |
//! Maps UI object of page into a control object
|
|
172 |
QHash<HbWidget* , WlanWizardPage *> mPageMapper;
|
|
173 |
//! Maps page id to control object of page.
|
|
174 |
QHash<int, WlanWizardPage *> mPages;
|
|
175 |
|
|
176 |
//! Holds wlan wizard configurations.
|
|
177 |
QHash<ConfigurationId, QVariant> mConfigurations;
|
|
178 |
//! holds the page id which is displayed when WlanWizard::show() is called
|
|
179 |
int mFirstPageId;
|
|
180 |
//! Flag to keep track if movement to next page is allowed when timer is used
|
|
181 |
bool mPageFinished;
|
|
182 |
//! flag to indicate that wizard has been closed via either cancel or finish
|
|
183 |
bool mClosed;
|
|
184 |
|
|
185 |
// Friend classes
|
|
186 |
friend class WlanWizard;
|
|
187 |
friend class TestWlanWizardUi;
|
|
188 |
};
|
|
189 |
|
|
190 |
/*! @} */
|
|
191 |
|
|
192 |
#endif // WLANWIZARD_P_H
|