author | hgs |
Fri, 06 Aug 2010 13:16:44 +0300 | |
changeset 53 | 22cc52eade9b |
parent 46 | bc5a64e5bc3c |
child 65 | 2a5d4ab426d3 |
permissions | -rw-r--r-- |
37 | 1 |
/*! |
2 |
* Copyright (c) 2009 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: Handles phone notes. |
|
15 |
*/ |
|
16 |
||
17 |
#include "phonenotecontroller.h" |
|
18 |
#include "tphonecmdparamglobalnote.h" |
|
19 |
#include "tphonecmdparamquery.h" |
|
20 |
#include "phoneresourceadapter.h" |
|
21 |
#include "qtphonelog.h" |
|
22 |
#include <QSignalMapper> |
|
23 |
#include <QTimer> |
|
24 |
#include <hbdevicemessagebox.h> |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
25 |
#include <hbdevicenotificationdialog.h> |
37 | 26 |
#include <hbdeviceprogressdialog.h> |
27 |
#include <hbmessagebox.h> |
|
28 |
#include <hbprogressdialog.h> |
|
29 |
#include <hbaction.h> |
|
30 |
#include <phoneappcommands.hrh> |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
31 |
#include <hbstringutil.h> |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
32 |
|
37 | 33 |
PhoneNoteController::PhoneNoteController(QObject *parent) : |
34 |
QObject(parent), m_timer(0), m_progressDialog(0), m_dtmfNote(0), |
|
35 |
m_queryNote(0), m_queryCanceledCommand(-1), m_timeoutCommand(-1) |
|
36 |
{ |
|
37 |
PHONE_DEBUG("PhoneNoteController::PhoneNoteController"); |
|
38 |
m_signalMapper = new QSignalMapper(this); |
|
39 |
connect(m_signalMapper, SIGNAL(mapped(int)), this, SIGNAL(command (int))); |
|
40 |
} |
|
41 |
||
42 |
PhoneNoteController::~PhoneNoteController() |
|
43 |
{ |
|
44 |
PHONE_DEBUG("PhoneNoteController::~PhoneNoteController"); |
|
45 |
if (m_timer) { |
|
46 |
delete m_timer; |
|
47 |
} |
|
48 |
} |
|
49 |
||
50 |
void PhoneNoteController::showGlobalNote(TPhoneCommandParam *commandParam) |
|
51 |
{ |
|
52 |
PHONE_DEBUG("PhoneNoteController::showGlobalNote"); |
|
53 |
Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdGlobalNote); |
|
54 |
||
55 |
TPhoneCmdParamGlobalNote* globalNoteParam = |
|
56 |
static_cast<TPhoneCmdParamGlobalNote*>( commandParam ); |
|
57 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
58 |
if (globalNoteParam->NotificationDialog()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
59 |
showDeviceNotificationDialog(globalNoteParam); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
60 |
} else { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
61 |
showDeviceMessageBox(globalNoteParam); |
37 | 62 |
} |
63 |
||
64 |
} |
|
65 |
||
66 |
void PhoneNoteController::showNote(TPhoneCommandParam *commandParam) |
|
67 |
{ |
|
68 |
PHONE_DEBUG("PhoneNoteController::showNote"); |
|
69 |
||
70 |
TPhoneCmdParamNote* noteParam = static_cast<TPhoneCmdParamNote*>( |
|
71 |
commandParam ); |
|
72 |
||
73 |
if ( noteParam->Type() == EPhoneNoteDtmfSending ) { |
|
74 |
showDtmfNote(noteParam); |
|
75 |
} |
|
76 |
||
77 |
} |
|
78 |
||
79 |
void PhoneNoteController::showQuery(TPhoneCommandParam *commandParam) |
|
80 |
{ |
|
81 |
PHONE_DEBUG("PhoneNoteController::showQuery"); |
|
82 |
TPhoneCmdParamQuery& params = *static_cast<TPhoneCmdParamQuery*>( commandParam ); |
|
83 |
||
84 |
if ( EPhoneQueryDialog == params.QueryType() && |
|
85 |
params.QueryPrompt().Length() ) { |
|
86 |
showDefaultQuery(¶ms); |
|
87 |
||
88 |
} else if ( EPhoneGlobalWaitNote == params.QueryType() ) { |
|
89 |
showGlobalWaitNote(¶ms); |
|
90 |
||
91 |
} |
|
92 |
} |
|
93 |
||
94 |
void PhoneNoteController::removeDtmfNote() |
|
95 |
{ |
|
96 |
PHONE_DEBUG("PhoneNoteController::removeDtmfNote"); |
|
97 |
if (m_dtmfNote) { |
|
98 |
m_dtmfNote->close(); |
|
99 |
} |
|
100 |
} |
|
101 |
||
102 |
void PhoneNoteController::removeNote() |
|
103 |
{ |
|
104 |
PHONE_DEBUG("PhoneNoteController::removeNote"); |
|
105 |
removeDtmfNote(); |
|
106 |
} |
|
107 |
||
108 |
void PhoneNoteController::removeQuery() |
|
109 |
{ |
|
110 |
PHONE_DEBUG("PhoneNoteController::removeQuery"); |
|
111 |
if (m_queryNote) { |
|
112 |
m_queryNote->close(); |
|
113 |
} |
|
114 |
} |
|
115 |
||
116 |
void PhoneNoteController::removeGlobalWaitNote() |
|
117 |
{ |
|
118 |
PHONE_DEBUG("PhoneNoteController::removeGlobalWaitNote"); |
|
119 |
if (m_timer) { |
|
120 |
m_timeoutCommand = -1; |
|
121 |
m_timer->stop(); |
|
122 |
} |
|
123 |
||
124 |
if (m_progressDialog) { |
|
125 |
m_queryCanceledCommand = -1; |
|
126 |
m_progressDialog->close(); |
|
127 |
} |
|
128 |
} |
|
129 |
||
130 |
void PhoneNoteController::destroyDialog() |
|
131 |
{ |
|
132 |
PHONE_DEBUG("PhoneNoteController::destroyDialog"); |
|
133 |
HbDeviceMessageBox *messageBox = m_messageBoxList.takeFirst(); |
|
134 |
messageBox->deleteLater(); |
|
135 |
messageBox = 0; |
|
136 |
||
137 |
if ( 0 < m_messageBoxList.size() ) { |
|
138 |
PHONE_DEBUG("PhoneNoteController::show pending note"); |
|
139 |
HbDeviceMessageBox *messageBoxTemp = m_messageBoxList[0]; |
|
140 |
QObject::connect(messageBoxTemp, SIGNAL(aboutToClose()), |
|
141 |
this, SLOT(destroyDialog())); |
|
142 |
messageBoxTemp->show(); |
|
143 |
} |
|
144 |
} |
|
145 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
146 |
void PhoneNoteController::destroyNotification() |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
147 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
148 |
PHONE_DEBUG("PhoneNoteController::destroyDialog"); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
149 |
HbDeviceNotificationDialog *notification = m_notificationList.takeFirst(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
150 |
notification->deleteLater(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
151 |
notification = 0; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
152 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
153 |
if ( 0 < m_notificationList.size() ) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
154 |
PHONE_DEBUG("PhoneNoteController::show pending note"); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
155 |
HbDeviceNotificationDialog *notificationTemp = m_notificationList[0]; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
156 |
QObject::connect(notificationTemp, SIGNAL(aboutToClose()), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
157 |
this, SLOT(destroyNotification())); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
158 |
notificationTemp->show(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
159 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
160 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
161 |
|
37 | 162 |
void PhoneNoteController::removeMappings() |
163 |
{ |
|
164 |
foreach (HbAction *action, m_actions ) { |
|
165 |
m_signalMapper->removeMappings(action); |
|
166 |
} |
|
167 |
m_actions.clear(); |
|
168 |
||
169 |
if (m_dtmfNote) { |
|
170 |
m_dtmfNote->deleteLater(); |
|
171 |
m_dtmfNote = 0; |
|
172 |
} |
|
173 |
if (m_queryNote) { |
|
174 |
m_queryNote->deleteLater(); |
|
175 |
m_queryNote = 0; |
|
176 |
} |
|
177 |
if (m_progressDialog) { |
|
178 |
m_progressDialog->deleteLater(); |
|
179 |
m_progressDialog = 0; |
|
180 |
} |
|
181 |
} |
|
182 |
||
183 |
void PhoneNoteController::queryCancelled() |
|
184 |
{ |
|
185 |
if (m_timer) { |
|
186 |
m_timer->stop(); |
|
187 |
} |
|
188 |
||
189 |
if (m_queryCanceledCommand != -1) { |
|
190 |
emit command(m_queryCanceledCommand); |
|
191 |
} |
|
192 |
m_queryCanceledCommand = -1; |
|
193 |
m_timeoutCommand = -1; |
|
194 |
} |
|
195 |
||
196 |
void PhoneNoteController::queryTimeout() |
|
197 |
{ |
|
198 |
int sendCommand = m_timeoutCommand; |
|
199 |
if (m_progressDialog) { |
|
200 |
m_queryCanceledCommand = -1; |
|
201 |
m_progressDialog->close(); |
|
202 |
} |
|
203 |
if (sendCommand != -1) { |
|
204 |
emit command(sendCommand); |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
QString PhoneNoteController::globalNoteText( |
|
209 |
TPhoneCommandParam *commandParam) |
|
210 |
{ |
|
211 |
TPhoneCmdParamGlobalNote* globalNoteParam = |
|
212 |
static_cast<TPhoneCmdParamGlobalNote*>( commandParam ); |
|
213 |
||
214 |
QString ret; |
|
215 |
||
216 |
if ( globalNoteParam->TextResourceId() && |
|
217 |
KErrNone != globalNoteParam->Text().Compare( KNullDesC() ) ) { |
|
218 |
// resource and text exists |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
219 |
ret = PhoneResourceAdapter::Instance()->convertToStringWithParam( |
37 | 220 |
globalNoteParam->TextResourceId(), |
221 |
QString::fromUtf16(globalNoteParam->Text().Ptr(), |
|
222 |
globalNoteParam->Text().Length()) ); |
|
223 |
} else if ( globalNoteParam->TextResourceId() ) { |
|
224 |
// resource exists |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
225 |
QString causeCode; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
226 |
if (-1 != globalNoteParam->CauseCode()) { |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
227 |
causeCode.setNum(globalNoteParam->CauseCode()); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
228 |
causeCode = HbStringUtil::convertDigits(causeCode); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
229 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
230 |
|
37 | 231 |
ret = PhoneResourceAdapter::Instance()->convertToString( |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
232 |
globalNoteParam->TextResourceId(), causeCode); |
37 | 233 |
|
234 |
} else if ( KErrNone != globalNoteParam->Text().Compare( KNullDesC() ) ) { |
|
235 |
// text exists |
|
236 |
ret = QString::fromUtf16(globalNoteParam->Text().Ptr(), |
|
237 |
globalNoteParam->Text().Length()); |
|
238 |
} |
|
239 |
||
240 |
return ret; |
|
241 |
} |
|
242 |
||
243 |
void PhoneNoteController::showDtmfNote(TPhoneCmdParamNote* noteParam) |
|
244 |
{ |
|
245 |
if (m_dtmfNote) { |
|
246 |
m_dtmfNote->setText( QString::fromUtf16(noteParam->Text().Ptr(), |
|
247 |
noteParam->Text().Length()) ); |
|
248 |
m_dtmfNote->update(); |
|
249 |
} else { |
|
250 |
QList<HbAction*> hbactions = PhoneResourceAdapter::Instance()-> |
|
251 |
convertToHbActions(noteParam->ResourceId()); |
|
252 |
||
253 |
if (hbactions.count() > 0) { |
|
254 |
m_dtmfNote = new HbProgressDialog(HbProgressDialog::ProgressDialog); |
|
255 |
m_dtmfNote->setText( QString::fromUtf16(noteParam->Text().Ptr(), |
|
256 |
noteParam->Text().Length()) ); |
|
257 |
||
258 |
connect(hbactions.at(0), SIGNAL(triggered()), m_signalMapper, SLOT(map())); |
|
259 |
||
260 |
int count = m_dtmfNote->actions().count(); |
|
261 |
for (int i=count;0<i;i--) { |
|
262 |
QAction *action = m_dtmfNote->actions().at(i-1); |
|
263 |
m_dtmfNote->removeAction(action); |
|
264 |
//TODO |
|
265 |
//delete action; |
|
266 |
} |
|
267 |
m_dtmfNote->addAction(hbactions.at(0)); |
|
268 |
m_signalMapper->setMapping(hbactions.at(0), hbactions.at(0)->data().toInt()); |
|
269 |
||
270 |
QObject::connect(m_dtmfNote, SIGNAL(aboutToClose()), |
|
271 |
this, SLOT(removeMappings())); |
|
272 |
||
273 |
m_actions.append(hbactions.at(0)); |
|
274 |
||
275 |
m_dtmfNote->show(); |
|
276 |
} |
|
277 |
} |
|
278 |
} |
|
279 |
||
280 |
void PhoneNoteController::showDefaultQuery(TPhoneCmdParamQuery* params) |
|
281 |
{ |
|
282 |
if (!m_queryNote) { |
|
283 |
QList<HbAction*> hbactions = PhoneResourceAdapter::Instance()-> |
|
284 |
convertToHbActions(params->QueryResourceId()); |
|
285 |
||
286 |
if (hbactions.count() > 0) { |
|
287 |
m_queryNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
|
288 |
m_queryNote->setTimeout(HbPopup::NoTimeout); |
|
289 |
m_queryNote->setDismissPolicy(HbPopup::NoDismiss); |
|
290 |
m_queryNote->setText(QString::fromUtf16(params->QueryPrompt().Ptr(), |
|
291 |
params->QueryPrompt().Length())); |
|
292 |
||
293 |
QObject::connect(m_queryNote, SIGNAL(aboutToClose()), |
|
294 |
this, SLOT(removeMappings())); |
|
295 |
||
296 |
for (int i = 0; i < hbactions.count(); ++i) { |
|
297 |
connect(hbactions.at(i), SIGNAL(triggered()), m_signalMapper, SLOT(map())); |
|
298 |
m_signalMapper->setMapping(hbactions.at(i), hbactions.at(i)->data().toInt()); |
|
299 |
m_actions.append(hbactions.at(i)); |
|
300 |
} |
|
301 |
||
302 |
int count = m_queryNote->actions().count(); |
|
303 |
for (int i=count;0<i;i--) { |
|
304 |
QAction *action = m_queryNote->actions().at(i-1); |
|
305 |
m_queryNote->removeAction(action); |
|
306 |
//TODO |
|
307 |
//delete action; |
|
308 |
} |
|
309 |
||
310 |
for (int i=0;i<hbactions.count();i++) { |
|
311 |
m_queryNote->addAction(hbactions.at(i)); |
|
312 |
} |
|
313 |
||
314 |
m_queryNote->show(); |
|
315 |
} |
|
316 |
} |
|
317 |
} |
|
318 |
||
319 |
void PhoneNoteController::showGlobalWaitNote(TPhoneCmdParamQuery* params) |
|
320 |
{ |
|
321 |
if (!m_progressDialog) { |
|
322 |
m_queryCanceledCommand = params->CbaCommandMapping(EAknSoftkeyCancel); |
|
323 |
||
324 |
m_progressDialog = new HbDeviceProgressDialog(HbProgressDialog::WaitDialog); |
|
325 |
||
326 |
if (params->QueryPrompt().Length()) { |
|
327 |
m_progressDialog->setText(QString::fromUtf16(params->QueryPrompt().Ptr(), |
|
328 |
params->QueryPrompt().Length())); |
|
329 |
} else if (0 != params->DataText()) { |
|
330 |
m_progressDialog->setText(QString::fromUtf16(params->DataText()->Ptr(), |
|
331 |
params->DataText()->Length())); |
|
332 |
} |
|
333 |
||
334 |
QObject::connect(m_progressDialog, SIGNAL(aboutToClose()), |
|
335 |
this, SLOT(removeMappings())); |
|
336 |
||
337 |
QObject::connect(m_progressDialog, SIGNAL(cancelled()), |
|
338 |
this, SLOT(queryCancelled())); |
|
339 |
||
340 |
if (params->TimeOut() != 0) { |
|
341 |
if (!m_timer) { |
|
342 |
m_timer = new QTimer(); |
|
343 |
m_timer->setSingleShot(true); |
|
344 |
connect(m_timer, SIGNAL(timeout()), SLOT(queryTimeout())); |
|
345 |
} |
|
346 |
||
347 |
m_timeoutCommand = -1; |
|
348 |
int customCommand; |
|
349 |
if (-1 != params->GetCustomCommandForTimeOut(customCommand)) { |
|
350 |
m_timeoutCommand = customCommand; |
|
351 |
} |
|
352 |
||
353 |
m_timer->start(params->TimeOut()); |
|
354 |
} |
|
355 |
||
356 |
m_progressDialog->show(); |
|
357 |
} |
|
358 |
} |
|
359 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
360 |
void PhoneNoteController::showDeviceMessageBox( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
361 |
TPhoneCmdParamGlobalNote* params) |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
362 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
363 |
PHONE_DEBUG("PhoneNoteController::showDeviceMessageBox"); |
37 | 364 |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
365 |
HbMessageBox::MessageBoxType type; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
366 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
367 |
switch( params->Type() ) { |
53 | 368 |
case EPhoneMessageBoxInformation: |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
369 |
type = HbMessageBox::MessageTypeInformation; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
370 |
break; |
53 | 371 |
case EPhoneMessageBoxWarning: |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
372 |
default: |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
373 |
type = HbMessageBox::MessageTypeWarning; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
374 |
break; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
375 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
376 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
377 |
QString noteString = globalNoteText(params); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
378 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
379 |
if (false == noteString.isNull()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
380 |
bool showNote(true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
381 |
for (int i = 0; i < m_messageBoxList.count(); ++i) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
382 |
// Do not show same note/text several times, e.g when user hits |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
383 |
// the end button several times we should show only one "not allowed" |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
384 |
// note. |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
385 |
if (noteString == m_messageBoxList.at(i)->text()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
386 |
showNote = false; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
387 |
break; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
388 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
389 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
390 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
391 |
if (showNote) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
392 |
QScopedPointer<HbDeviceMessageBox> messageBox( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
393 |
new HbDeviceMessageBox(noteString, type)); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
394 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
395 |
int timeout = params->Timeout(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
396 |
if (timeout <= 0) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
397 |
messageBox->setTimeout(HbDialog::StandardTimeout); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
398 |
} else { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
399 |
messageBox->setTimeout(timeout); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
400 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
401 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
402 |
HbDeviceMessageBox *messageBoxPtr = messageBox.data(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
403 |
m_messageBoxList.append(messageBoxPtr); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
404 |
messageBox.take(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
405 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
406 |
if (1 == m_messageBoxList.size()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
407 |
QObject::connect(messageBoxPtr, SIGNAL(aboutToClose()), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
408 |
this, SLOT(destroyDialog())); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
409 |
messageBoxPtr->show(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
410 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
411 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
412 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
413 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
414 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
415 |
void PhoneNoteController::showDeviceNotificationDialog( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
416 |
TPhoneCmdParamGlobalNote* params) |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
417 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
418 |
PHONE_DEBUG("PhoneNoteController::showDeviceNotificationDialog"); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
419 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
420 |
QString noteString = globalNoteText(params); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
421 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
422 |
if (false == noteString.isNull()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
423 |
bool showNote(true); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
424 |
for (int i = 0; i < m_notificationList.count(); ++i) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
425 |
// Do not show same note/text several times, e.g when user hits |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
426 |
// the end button several times we should show only one "not allowed" |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
427 |
// note. |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
428 |
if (noteString == m_notificationList.at(i)->title()) { |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
429 |
showNote = false; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
430 |
break; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
431 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
432 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
433 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
434 |
if (showNote) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
435 |
QScopedPointer<HbDeviceNotificationDialog> notification( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
436 |
new HbDeviceNotificationDialog()); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
437 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
438 |
notification->setTitle(noteString); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
439 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
440 |
int timeout = params->Timeout(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
441 |
if (timeout > 0) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
442 |
// If timeout not set we use default timeout. |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
443 |
// Default value is HbPopup::StandardTimeout (3000 ms) |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
444 |
notification->setTimeout(timeout); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
445 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
446 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
447 |
HbDeviceNotificationDialog *notificationPtr = notification.data(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
448 |
m_notificationList.append(notificationPtr); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
449 |
notification.take(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
450 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
451 |
if (1 == m_notificationList.size()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
452 |
QObject::connect(notificationPtr, SIGNAL(aboutToClose()), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
453 |
this, SLOT(destroyNotification())); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
454 |
notificationPtr->show(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
455 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
456 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
457 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
458 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
459 |
|
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
460 |