|
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 Plugin API: Interface for wizard pages. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef WLANWIZARDPAGE_H |
|
20 #define WLANWIZARDPAGE_H |
|
21 |
|
22 // System includes |
|
23 |
|
24 // User includes |
|
25 |
|
26 // Forward declarations |
|
27 class HbWidget; |
|
28 |
|
29 // External data types |
|
30 |
|
31 // Constants |
|
32 |
|
33 /*! |
|
34 @addtogroup group_wlan_wizard_api_internal |
|
35 @{ |
|
36 */ |
|
37 |
|
38 /*! |
|
39 Interface for wizard pages. |
|
40 |
|
41 Princibles of the interface, see description of the method for detailed |
|
42 information. |
|
43 - initializePage() is called at first to create the UI visualizatio |
|
44 - showPage() is called to detect whether next button should be enabled. This |
|
45 method is called every time before the current page is displayed. |
|
46 - requiresStartOperation() is called to check if page needs timer protection. |
|
47 This is mainly used for pages where are progress bar and some asyncronous |
|
48 operation with network layer, which commands on success to progress to next |
|
49 wizard page. |
|
50 - startOperation() is called to start page operation, this is called if above |
|
51 method returs true. |
|
52 - nextId() is called when user presses next toolbar button or when page has |
|
53 called WlanWizardHelper::nextPage() method, which is used with timer |
|
54 protected pages. |
|
55 - previousTriggered() is called when previous toolbar button is pressed. |
|
56 - cancelTriggered() is called when cancel toolbar button is pressed. |
|
57 |
|
58 Wizard Page must implement all pure virtual methods |
|
59 - initializePage() |
|
60 - nextId() |
|
61 |
|
62 For other methods there is default implementation, which can be overwritten. |
|
63 */ |
|
64 class WlanWizardPage |
|
65 { |
|
66 public: |
|
67 //! default value for previousTriggered(), step one step. |
|
68 static const int OneStepBackwards = 1; |
|
69 static const int SingleResult = 1; |
|
70 |
|
71 /*! |
|
72 Defines common page ids for wizard and page id pools for wizard plugins. |
|
73 |
|
74 Remember to update trace.properties file upon changes. |
|
75 */ |
|
76 enum PageIds { |
|
77 //! No need to change the wizard page. |
|
78 PageNone = 0, |
|
79 //! Process settings. Start connection and runs ict |
|
80 PageProcessSettings, |
|
81 //! Generic Error note page |
|
82 PageGenericError, |
|
83 //! Starting value for WLAN wizard page ids. Defined by WLAN Wizard. |
|
84 PageWlanStart = 0x1000, |
|
85 //! Starting value for EAP wizard page ids. Defined by EAP Wizard. |
|
86 PageEapStart = 0x2000, |
|
87 //! Starting value for WPS wizard page ids. Defined by WPS Wizard. |
|
88 PageWpsStart = 0x3000, |
|
89 }; |
|
90 |
|
91 public: |
|
92 |
|
93 /*! |
|
94 Creates a visualization of the wizard page and returns ownership of the |
|
95 object to the caller. Wizard framework deletes the visualization at the |
|
96 desctructor of WlanWizardPrivate implementation. WizardPage control |
|
97 object can safely use the same pointer during the life time of the |
|
98 control object. This method is called every time when moving to a new |
|
99 page, not when user presses "previous" button. showPage() method is |
|
100 called in both cases. |
|
101 |
|
102 @return pointer to a visualization of the page. |
|
103 */ |
|
104 virtual HbWidget* initializePage() = 0; |
|
105 |
|
106 /*! |
|
107 This method is called, after a visualization is created with |
|
108 initializePage() method, to detect whether next button should be enabled |
|
109 or not. It is up to the policy of the page when next button should be |
|
110 enabled. This method is called everytime before the current |
|
111 active page is displayed. In other words this method is "aboutToShow()" |
|
112 |
|
113 Default implementation: wizard page is valid and next button is enabled. |
|
114 |
|
115 @return validity. |
|
116 */ |
|
117 virtual bool showPage() |
|
118 { |
|
119 return true; |
|
120 }; |
|
121 |
|
122 /*! |
|
123 If the wizard page requires timer protection and asyncronous time |
|
124 lasting operation, return true. This is used in pages e.g. where |
|
125 progressbar is shown. The whole point is to initialize the UI before |
|
126 starting the operation, so that the progress bar is painted before the |
|
127 operation takes place. |
|
128 |
|
129 In practise this means that if true is returned by this method. |
|
130 - WlanWizardPage::startOperation() is called to start the page operation. |
|
131 - 1.5sec timer is used to protect the page |
|
132 - wizardPage MUST call WlanWizardHelper::nextPage() to trigger entry to |
|
133 next wizard page. |
|
134 |
|
135 @return true if protection is needed. |
|
136 */ |
|
137 |
|
138 virtual bool requiresStartOperation() |
|
139 { |
|
140 return false; |
|
141 }; |
|
142 |
|
143 /*! |
|
144 In case the wizard page needs timer protection to the page use this |
|
145 method to start control operation of the page. This method will be called |
|
146 after requiresStartOperation() if true is returned with different call |
|
147 stack. |
|
148 |
|
149 See requiresStartOperation(), WlanWizardHelper::nextPage(). |
|
150 */ |
|
151 virtual void startOperation() {}; |
|
152 |
|
153 /*! |
|
154 Returns id of next page. This method is called when end user has pressed |
|
155 "next" toolbar button or WlanWizardHelper::nextPage() is called. |
|
156 |
|
157 In case the wizard page does not want to make any movement forwards |
|
158 WlanWizardPage::PageNone MUST be returned. |
|
159 |
|
160 Default implementation: Page ID WlanWizardPage::PageNone is retuned and |
|
161 removeFromStack is false. |
|
162 |
|
163 @param [out] removeFromStack return value to the caller, if this page |
|
164 needs to be removed from the stack, which means that this page cannot be |
|
165 accessible from the next page using "previous" toolbar button. |
|
166 |
|
167 @return page identifier of next wizard page |
|
168 */ |
|
169 virtual int nextId(bool &removeFromStack) const |
|
170 { |
|
171 removeFromStack = false; |
|
172 return WlanWizardPage::PageNone; |
|
173 } |
|
174 |
|
175 /*! |
|
176 This method is called when "previous" button has been pressed. |
|
177 |
|
178 Default implementation: one page backwards |
|
179 |
|
180 @return how many steps should be gone backwards. |
|
181 */ |
|
182 virtual int previousTriggered() |
|
183 { |
|
184 return OneStepBackwards; |
|
185 }; |
|
186 |
|
187 /*! |
|
188 This method is called when "cancel" button has been pressed. |
|
189 |
|
190 Default implementation: No actions. |
|
191 */ |
|
192 virtual void cancelTriggered() {}; |
|
193 |
|
194 signals: |
|
195 |
|
196 public slots: |
|
197 |
|
198 protected: |
|
199 |
|
200 protected slots: |
|
201 |
|
202 private: |
|
203 |
|
204 private slots: |
|
205 |
|
206 private: // data |
|
207 }; |
|
208 |
|
209 /*! @} */ |
|
210 |
|
211 #endif // WLANWIZARDPAGE_H |