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