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: EAP-FAST Provisioning not successfull note Dialog implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 5 % |
|
20 */ |
|
21 |
|
22 // System includes |
|
23 #include <HbAction> |
|
24 #include <HbTranslator> |
|
25 |
|
26 // User includes |
|
27 #include "eapfastprovnotsuccessnotedialog.h" |
|
28 #include "OstTraceDefinitions.h" |
|
29 #ifdef OST_TRACE_COMPILER_IN_USE |
|
30 #include "eapfastprovnotsuccessnotedialogTraces.h" |
|
31 #endif |
|
32 |
|
33 /*! |
|
34 * \class EapFastProvNotSuccessNoteDialog |
|
35 * \brief Implements EAP-MSCHAPv2 New Password Input Dialog. |
|
36 */ |
|
37 |
|
38 // External function prototypes |
|
39 |
|
40 // Local constants |
|
41 |
|
42 //! The index numbers of the button of the dialog |
|
43 static const int okButtonIndex = 1; |
|
44 |
|
45 // ======== LOCAL FUNCTIONS ======== |
|
46 |
|
47 // ======== MEMBER FUNCTIONS ======== |
|
48 |
|
49 /*! |
|
50 * Constructor. |
|
51 * |
|
52 * @param [in] parameters Parameters for the Constructor. |
|
53 */ |
|
54 EapFastProvNotSuccessNoteDialog::EapFastProvNotSuccessNoteDialog(const QVariantMap ¶meters) |
|
55 :HbMessageBox(HbMessageBox::MessageTypeWarning), |
|
56 mTranslator(new HbTranslator("eapprompts")), |
|
57 mOkActionPressed(false) |
|
58 { |
|
59 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_EAPFASTPROVNOTSUCCESSNOTEDIALOG_ENTRY ); |
|
60 qDebug("EapFastProvNotSuccessNoteDialog::EapFastProvNotSuccessNoteDialog ENTER"); |
|
61 |
|
62 Q_UNUSED(parameters) |
|
63 |
|
64 createDialog(); |
|
65 |
|
66 OstTraceFunctionExit0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_EAPFASTPROVNOTSUCCESSNOTEDIALOG_EXIT ); |
|
67 qDebug("EapFastProvNotSuccessNoteDialog::EapFastProvNotSuccessNoteDialog EXIT"); |
|
68 } |
|
69 |
|
70 /*! |
|
71 * The construction of the dialog |
|
72 */ |
|
73 void EapFastProvNotSuccessNoteDialog::createDialog() |
|
74 { |
|
75 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_CREATEDIALOG_ENTRY ); |
|
76 qDebug("EapFastProvNotSuccessNoteDialog::createDialog ENTER"); |
|
77 |
|
78 QString text(hbTrId("txt_occ_info_provisioning_not_successful_reactiv")); |
|
79 |
|
80 //Set the dialog to be on the screen until user reacts |
|
81 //by pressing the Action button |
|
82 this->setModal(true); |
|
83 this->setTimeout(HbPopup::NoTimeout); |
|
84 this->setDismissPolicy(HbPopup::NoDismiss); |
|
85 this->setText(text); |
|
86 this->setIconVisible(true); |
|
87 |
|
88 //Remove all default actions from the dialog |
|
89 QList<QAction*> action_list = this->actions(); |
|
90 for ( int i = 0; i < action_list.count(); i++ ) { |
|
91 this->removeAction(action_list.at(i)); |
|
92 } |
|
93 |
|
94 //Add a new Ok button action |
|
95 HbAction* actionOk = new HbAction(hbTrId("txt_common_button_ok_single_dialog"),this); |
|
96 this->addAction(actionOk); |
|
97 |
|
98 //Disconnect action Ok from the default SLOT and connect to |
|
99 //a SLOT owned by this class |
|
100 disconnect(actionOk, SIGNAL(triggered()),this, SLOT(close())); |
|
101 bool connected = connect(actionOk, SIGNAL(triggered()), this, SLOT(okPressed())); |
|
102 Q_ASSERT(connected == true); |
|
103 |
|
104 // Connect the about to close and hide signals, so that we are able to inform |
|
105 // the caller that the dialog was closed |
|
106 connected = connect(this, SIGNAL(aboutToClose()), this, SLOT(closingDialog())); |
|
107 Q_ASSERT(connected == true); |
|
108 connected = connect(this, SIGNAL(aboutToHide()), this, SLOT(closingDialog())); |
|
109 Q_ASSERT(connected == true); |
|
110 |
|
111 OstTraceFunctionExit0( DUP1_EAPFASTPROVNOTSUCCESSNOTEDIALOG_CREATEDIALOG_EXIT ); |
|
112 qDebug("EapFastProvNotSuccessNoteDialog::createDialog EXIT"); |
|
113 } |
|
114 |
|
115 /*! |
|
116 * Destructor. |
|
117 */ |
|
118 EapFastProvNotSuccessNoteDialog::~EapFastProvNotSuccessNoteDialog() |
|
119 { |
|
120 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_DEAPFASTPROVNOTSUCCESSNOTEDIALOG_ENTRY ); |
|
121 |
|
122 // The dialog widgets are deleted as the dialog is deleted |
|
123 |
|
124 OstTraceFunctionExit0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_DEAPFASTPROVNOTSUCCESSNOTEDIALOG_EXIT ); |
|
125 } |
|
126 |
|
127 /*! |
|
128 * Function is called when the Ok Action button is pressed |
|
129 */ |
|
130 void EapFastProvNotSuccessNoteDialog::okPressed() |
|
131 { |
|
132 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_OKBUTTONPRESSED_ENTRY ); |
|
133 qDebug("EapFastProvNotSuccessNoteDialog::okPressed ENTER"); |
|
134 |
|
135 if ( mOkActionPressed == false ) { |
|
136 |
|
137 mOkActionPressed = true; |
|
138 |
|
139 QVariantMap data; |
|
140 data["okbutton"] = okButtonIndex; |
|
141 |
|
142 // emit the data of the selected button and close the dialog |
|
143 qDebug("EapFastProvNotSuccessNoteDialog::okPressed: emit deviceDialogData"); |
|
144 emit deviceDialogData(data); |
|
145 |
|
146 closeDeviceDialog(true); |
|
147 } |
|
148 OstTraceFunctionExit0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_OKBUTTONPRESSED_EXIT ); |
|
149 qDebug("EapFastProvNotSuccessNoteDialog::okPressed EXIT"); |
|
150 } |
|
151 |
|
152 /*! |
|
153 * Function is called when the dialog is about to close |
|
154 * |
|
155 */ |
|
156 void EapFastProvNotSuccessNoteDialog::closingDialog() |
|
157 { |
|
158 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_CLOSINGDIALOG_ENTRY ); |
|
159 qDebug("EapFastProvNotSuccessNoteDialog::closingDialog ENTER"); |
|
160 |
|
161 qDebug("EapFastProvNotSuccessNoteDialog::closingDialog EXIT"); |
|
162 OstTraceFunctionExit0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_CLOSINGDIALOG_EXIT ); |
|
163 } |
|
164 |
|
165 /*! |
|
166 * Device dialog parameters to be set while dialog is displayed. |
|
167 * Not supported. |
|
168 * |
|
169 * @param [in] parameters NOT USED |
|
170 * @return true always. |
|
171 */ |
|
172 bool EapFastProvNotSuccessNoteDialog::setDeviceDialogParameters |
|
173 (const QVariantMap ¶meters) |
|
174 { |
|
175 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_ENTRY ); |
|
176 |
|
177 Q_UNUSED(parameters) |
|
178 // changing the dialog after presenting it is not supported. |
|
179 |
|
180 OstTraceFunctionExit0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_EXIT ); |
|
181 return true; |
|
182 } |
|
183 |
|
184 /*! |
|
185 * Not supported |
|
186 * |
|
187 * @return 0 always returned. |
|
188 */ |
|
189 int EapFastProvNotSuccessNoteDialog::deviceDialogError() const |
|
190 { |
|
191 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_DEVICEDIALOGERROR_ENTRY ); |
|
192 OstTraceFunctionExit0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_DEVICEDIALOGERROR_EXIT); |
|
193 return 0; |
|
194 } |
|
195 |
|
196 /*! |
|
197 * Dialog is closed and the signal about closing is emitted |
|
198 * |
|
199 * @param [in] byClient indicates when the user closes the dialog |
|
200 */ |
|
201 void EapFastProvNotSuccessNoteDialog::closeDeviceDialog(bool byClient) |
|
202 { |
|
203 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_CLOSEDEVICEDIALOG_ENTRY ); |
|
204 qDebug("EapFastProvNotSuccessNoteDialog::closeDeviceDialog ENTER"); |
|
205 |
|
206 if ( byClient == true ) { |
|
207 emit deviceDialogClosed(); |
|
208 } |
|
209 |
|
210 qDebug("EapFastProvNotSuccessNoteDialog::closeDeviceDialog EXIT"); |
|
211 OstTraceFunctionExit0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_CLOSEDEVICEDIALOG_EXIT ); |
|
212 } |
|
213 |
|
214 /*! |
|
215 * This dialog widget is returned to the caller |
|
216 * |
|
217 * @return this dialog widget |
|
218 */ |
|
219 HbPopup *EapFastProvNotSuccessNoteDialog::deviceDialogWidget() const |
|
220 { |
|
221 OstTraceFunctionEntry0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_DEVICEDIALOGWIDGET_ENTRY ); |
|
222 qDebug("EapFastProvNotSuccessNoteDialog::deviceDialogWidget ENTER"); |
|
223 |
|
224 qDebug("EapFastProvNotSuccessNoteDialog::deviceDialogWidget EXIT"); |
|
225 OstTraceFunctionExit0( EAPFASTPROVNOTSUCCESSNOTEDIALOG_DEVICEDIALOGWIDGET_EXIT ); |
|
226 |
|
227 return const_cast<EapFastProvNotSuccessNoteDialog*>(this); |
|
228 } |
|
229 |
|