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-MSCHAPv2 password expired note Dialog implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 4 % |
|
20 */ |
|
21 |
|
22 // System includes |
|
23 #include <HbAction> |
|
24 #include <HbTranslator> |
|
25 |
|
26 // User includes |
|
27 #include "eapmschapv2pwdexpirednotedialog.h" |
|
28 #include "OstTraceDefinitions.h" |
|
29 #ifdef OST_TRACE_COMPILER_IN_USE |
|
30 #include "eapmschapv2pwdexpirednotedialogTraces.h" |
|
31 #endif |
|
32 |
|
33 /*! |
|
34 * \class EapMschapv2NewPwdDialog |
|
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 EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog(const QVariantMap ¶meters) |
|
55 :HbMessageBox("default text...",HbMessageBox::MessageTypeInformation), |
|
56 mTranslator(new HbTranslator("eapprompts")), |
|
57 mOkActionPressed(false) |
|
58 { |
|
59 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_EAPMSCHAPV2PWDEXPNOTEDIALOG_ENTRY ); |
|
60 qDebug("EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog ENTER"); |
|
61 |
|
62 Q_UNUSED(parameters) |
|
63 |
|
64 createDialog(); |
|
65 |
|
66 OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_EAPMSCHAPV2PWDEXPNOTEDIALOG_EXIT ); |
|
67 qDebug("EapMschapv2PwdExpNoteDialog::EapMschapv2PwdExpNoteDialog EXIT"); |
|
68 } |
|
69 |
|
70 /*! |
|
71 * The construction of the dialog |
|
72 */ |
|
73 void EapMschapv2PwdExpNoteDialog::createDialog() |
|
74 { |
|
75 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CREATEDIALOG_ENTRY ); |
|
76 qDebug("EapMschapv2PwdExpNoteDialog::createDialog ENTER"); |
|
77 |
|
78 QString text(hbTrId("txt_occ_info_eapmschapv2_password_has_expired_yo")); |
|
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 |
|
86 this->setText(text); |
|
87 this->setIconVisible(true); |
|
88 |
|
89 //Remove all default actions from the dialog |
|
90 QList<QAction*> action_list = this->actions(); |
|
91 for ( int i = 0; i < action_list.count(); i++ ) { |
|
92 this->removeAction(action_list.at(i)); |
|
93 } |
|
94 |
|
95 //Add a new Ok button action |
|
96 HbAction* actionOk = new HbAction(hbTrId("txt_common_button_ok_single_dialog"),this); |
|
97 this->addAction(actionOk); |
|
98 |
|
99 //Disconnect action Ok from the default SLOT and connect to |
|
100 //a SLOT owned by this class |
|
101 disconnect(actionOk, SIGNAL(triggered()),this, SLOT(close())); |
|
102 bool connected = connect(actionOk, SIGNAL(triggered()), this, SLOT(okPressed())); |
|
103 Q_ASSERT(connected == true); |
|
104 |
|
105 //Connect the about to close and hide signals, so that we are able to inform |
|
106 //the caller that the dialog was closed |
|
107 connected = connect(this, SIGNAL(aboutToClose()), this, SLOT(closingDialog())); |
|
108 Q_ASSERT(connected == true); |
|
109 connected = connect(this, SIGNAL(aboutToHide()), this, SLOT(closingDialog())); |
|
110 Q_ASSERT(connected == true); |
|
111 |
|
112 OstTraceFunctionExit0( DUP1_EAPMSCHAPV2PWDEXPNOTEDIALOG_CREATEDIALOG_EXIT ); |
|
113 qDebug("EapMschapv2PwdExpNoteDialog::createDialog EXIT"); |
|
114 } |
|
115 |
|
116 /*! |
|
117 * Destructor |
|
118 */ |
|
119 EapMschapv2PwdExpNoteDialog::~EapMschapv2PwdExpNoteDialog() |
|
120 { |
|
121 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEAPMSCHAPV2PWDEXPNOTEDIALOG_ENTRY ); |
|
122 |
|
123 // The dialog widgets are deleted as the dialog is deleted |
|
124 |
|
125 OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEAPMSCHAPV2PWDEXPNOTEDIALOG_EXIT ); |
|
126 } |
|
127 |
|
128 /*! |
|
129 * Function is called when the Ok Action button is pressed |
|
130 */ |
|
131 void EapMschapv2PwdExpNoteDialog::okPressed() |
|
132 { |
|
133 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_OKBUTTONPRESSED_ENTRY ); |
|
134 qDebug("EapMschapv2PwdExpNoteDialog::okPressed ENTER"); |
|
135 |
|
136 if ( mOkActionPressed == false ) { |
|
137 |
|
138 mOkActionPressed = true; |
|
139 |
|
140 QVariantMap data; |
|
141 data["okbutton"] = okButtonIndex; |
|
142 |
|
143 // emit the data of the selected button and close the dialog |
|
144 qDebug("EapMschapv2PwdExpNoteDialog::okPressed: emit deviceDialogData"); |
|
145 emit deviceDialogData(data); |
|
146 |
|
147 closeDeviceDialog(true); |
|
148 } |
|
149 OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_OKBUTTONPRESSED_EXIT ); |
|
150 qDebug("EapMschapv2PwdExpNoteDialog::okPressed EXIT"); |
|
151 } |
|
152 |
|
153 /*! |
|
154 * Function is called when the dialog is about to close |
|
155 * |
|
156 */ |
|
157 void EapMschapv2PwdExpNoteDialog::closingDialog() |
|
158 { |
|
159 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSINGDIALOG_ENTRY ); |
|
160 qDebug("EapMschapv2PwdExpNoteDialog::closingDialog ENTER"); |
|
161 |
|
162 qDebug("EapMschapv2PwdExpNoteDialog::closingDialog EXIT"); |
|
163 OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSINGDIALOG_EXIT ); |
|
164 } |
|
165 |
|
166 /*! |
|
167 * Device dialog parameters to be set while dialog is displayed. |
|
168 * Not supported. |
|
169 * |
|
170 * @param [in] parameters NOT USED |
|
171 * @return true always. |
|
172 */ |
|
173 bool EapMschapv2PwdExpNoteDialog::setDeviceDialogParameters |
|
174 (const QVariantMap ¶meters) |
|
175 { |
|
176 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_ENTRY ); |
|
177 |
|
178 Q_UNUSED(parameters) |
|
179 // changing the dialog after presenting it is not supported. |
|
180 |
|
181 OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_SETDEVICEDIALOGPARAMETERS_EXIT ); |
|
182 return true; |
|
183 } |
|
184 |
|
185 /*! |
|
186 * Not supported |
|
187 * |
|
188 * @return 0 always returned. |
|
189 */ |
|
190 int EapMschapv2PwdExpNoteDialog::deviceDialogError() const |
|
191 { |
|
192 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGERROR_ENTRY ); |
|
193 OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGERROR_EXIT); |
|
194 return 0; |
|
195 } |
|
196 |
|
197 /*! |
|
198 * Dialog is closed and the signal about closing is emitted |
|
199 * |
|
200 * @param [in] byClient indicates when the user closes the dialog |
|
201 */ |
|
202 void EapMschapv2PwdExpNoteDialog::closeDeviceDialog(bool byClient) |
|
203 { |
|
204 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSEDEVICEDIALOG_ENTRY ); |
|
205 qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog ENTER"); |
|
206 |
|
207 if ( byClient == true ) { |
|
208 qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog: emit deviceDialogClosed"); |
|
209 emit deviceDialogClosed(); |
|
210 } |
|
211 |
|
212 qDebug("EapMschapv2PwdExpNoteDialog::closeDeviceDialog EXIT"); |
|
213 OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_CLOSEDEVICEDIALOG_EXIT ); |
|
214 } |
|
215 |
|
216 /*! |
|
217 * This dialog widget is returned to the caller |
|
218 * |
|
219 * @return this dialog widget |
|
220 */ |
|
221 HbPopup *EapMschapv2PwdExpNoteDialog::deviceDialogWidget() const |
|
222 { |
|
223 OstTraceFunctionEntry0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGWIDGET_ENTRY ); |
|
224 qDebug("EapMschapv2PwdExpNoteDialog::deviceDialogWidget ENTER"); |
|
225 |
|
226 qDebug("EapMschapv2PwdExpNoteDialog::deviceDialogWidget EXIT"); |
|
227 OstTraceFunctionExit0( EAPMSCHAPV2PWDEXPNOTEDIALOG_DEVICEDIALOGWIDGET_EXIT ); |
|
228 |
|
229 return const_cast<EapMschapv2PwdExpNoteDialog*>(this); |
|
230 } |
|
231 |
|