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 the License "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 * WPS Wizard Page: Step 2 |
|
16 * |
|
17 */ |
|
18 |
|
19 // System includes |
|
20 #include <hbdocumentloader.h> |
|
21 #include <hbwidget.h> |
|
22 #include <hbradiobuttonlist.h> |
|
23 #include <hblineedit.h> |
|
24 #include <hblabel.h> |
|
25 |
|
26 // User includes |
|
27 #include "wpswizardsteptwo.h" |
|
28 #include "wpswizard_p.h" |
|
29 |
|
30 // Trace includes |
|
31 #include "OstTraceDefinitions.h" |
|
32 #ifdef OST_TRACE_COMPILER_IN_USE |
|
33 #include "wpspagesteptwoTraces.h" |
|
34 #endif |
|
35 |
|
36 |
|
37 /*! |
|
38 * Constructor for WPS page two |
|
39 * |
|
40 * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation |
|
41 */ |
|
42 WpsPageStepTwo::WpsPageStepTwo(WpsWizardPrivate* parent) : |
|
43 WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(false) |
|
44 { |
|
45 OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this) |
|
46 OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this) |
|
47 |
|
48 } |
|
49 |
|
50 /*! |
|
51 * Destructor |
|
52 */ |
|
53 WpsPageStepTwo::~WpsPageStepTwo() |
|
54 { |
|
55 OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this) |
|
56 |
|
57 delete mWidget; |
|
58 OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this) |
|
59 |
|
60 } |
|
61 |
|
62 /*! |
|
63 * Loads the page with all the widgets |
|
64 * |
|
65 * \return HbWidget* Returns the view widget |
|
66 */ |
|
67 HbWidget* WpsPageStepTwo::initializePage() |
|
68 { |
|
69 OstTraceFunctionEntry1(WPSPAGESTEPTWO_INITIALIZEPAGE_ENTRY, this) |
|
70 |
|
71 if (!mWidget) |
|
72 { |
|
73 bool ok; |
|
74 HbDocumentLoader loader; |
|
75 loader.load(":/docml/occ_wps_P1.docml", &ok); |
|
76 Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); |
|
77 |
|
78 mWidget = qobject_cast<HbWidget*> (loader.findWidget("occ_wps_P1")); |
|
79 Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); |
|
80 |
|
81 mHeading |
|
82 = qobject_cast<HbLabel*> (loader.findWidget("label_heading")); |
|
83 Q_ASSERT_X(mTitle != 0, "WPS wizard", "Header not found"); |
|
84 |
|
85 mRadio = qobject_cast<HbRadioButtonList*> (loader.findWidget( |
|
86 "radioButtonList")); |
|
87 Q_ASSERT_X(mRadio != 0, "WPS Wizard", "List not found"); |
|
88 |
|
89 connect(mRadio, SIGNAL(itemSelected(int)), this, |
|
90 SLOT(itemSelected(int))); |
|
91 |
|
92 } |
|
93 OstTraceFunctionExit1(WPSPAGESTEPTWO_INITIALIZEPAGE_EXIT, this) |
|
94 |
|
95 return mWidget; |
|
96 } |
|
97 |
|
98 |
|
99 /*! |
|
100 * Funtion to determine the next page to be displayed in the wizard process |
|
101 * |
|
102 * \param bool& RemoveFromStack indicating whether the current page should be |
|
103 * removed from the stack |
|
104 * |
|
105 * \return int Page Id of the next page to be displayed. |
|
106 */ |
|
107 int WpsPageStepTwo::nextId(bool &removeFromStack) const |
|
108 { |
|
109 OstTraceFunctionEntry1(WPSPAGESTEPTWO_NEXTID_ENTRY, this) |
|
110 int id = WpsWizardPage::PageWpsWizardStep3_Button; |
|
111 removeFromStack = false; |
|
112 if (mItemSelected == 0) |
|
113 id = WpsWizardPage::PageWpsWizardStep3_Button; |
|
114 else |
|
115 id = WpsWizardPage::PageWpsWizardStep3_Number; |
|
116 OstTraceFunctionExit1(WPSPAGESTEPTWO_NEXTID_EXIT, this) |
|
117 |
|
118 |
|
119 return id; |
|
120 } |
|
121 |
|
122 /*! |
|
123 * Determines the Number of steps to move backwards when 'Prev' Button |
|
124 * is clicked |
|
125 * |
|
126 * \return int Number of pages to move backwards |
|
127 */ |
|
128 int WpsPageStepTwo::stepsBackwards() |
|
129 { |
|
130 OstTraceFunctionEntry1(WPSPAGESTEPTWO_STEPSBACKWARDS_ENTRY, this) |
|
131 OstTraceFunctionExit1(WPSPAGESTEPTWO_STEPBACKWARDS_EXIT, this) |
|
132 |
|
133 return 1; |
|
134 } |
|
135 |
|
136 /*! |
|
137 * Callback when the previous button is clicked |
|
138 */ |
|
139 void WpsPageStepTwo::previousTriggered() |
|
140 { |
|
141 OstTraceFunctionEntry1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_ENTRY, this) |
|
142 OstTraceFunctionExit1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_EXIT, this) |
|
143 |
|
144 } |
|
145 |
|
146 /*! |
|
147 * CallBack when the cancel button is clicked |
|
148 */ |
|
149 void WpsPageStepTwo::cancelTriggered() |
|
150 { |
|
151 OstTraceFunctionEntry1(WPSPAGESTEPTWO_CANCELTRIGGERED_ENTRY, this) |
|
152 OstTraceFunctionExit1(WPSPAGESTEPTWO_CANCELTRIGGERED_EXIT, this) |
|
153 |
|
154 } |
|
155 |
|
156 /*! |
|
157 * Validates the content of the pages |
|
158 * |
|
159 * \return bool Indicating the result of the operation |
|
160 */ |
|
161 bool WpsPageStepTwo::validate() const |
|
162 { |
|
163 OstTraceFunctionEntry1(WPSPAGESTEPTWO_VALIDATE_ENTRY, this) |
|
164 OstTraceFunctionExit1(WPSPAGESTEPTWO_VALIDATE_EXIT, this) |
|
165 |
|
166 return mValid; |
|
167 } |
|
168 |
|
169 /*! |
|
170 * Call back when an item is selected from the list on the UI |
|
171 * |
|
172 * \param int index Indcating the relative position in the list |
|
173 */ |
|
174 void WpsPageStepTwo::itemSelected(int index) |
|
175 { |
|
176 OstTraceFunctionEntry1(WPSPAGESTEPTWO_ITEMSELECTED_ENTRY, this) |
|
177 |
|
178 mValid = true; |
|
179 mWizard->enableNextButton(mValid); |
|
180 mItemSelected = index; |
|
181 OstTraceFunctionExit1(WPSPAGESTEPTWO_ITEMSELECTED_EXIT, this) |
|
182 |
|
183 } |
|
184 |
|