16 |
16 |
17 #include "phonenotecontroller.h" |
17 #include "phonenotecontroller.h" |
18 #include "tphonecmdparamglobalnote.h" |
18 #include "tphonecmdparamglobalnote.h" |
19 #include "tphonecmdparamquery.h" |
19 #include "tphonecmdparamquery.h" |
20 #include "phoneresourceadapter.h" |
20 #include "phoneresourceadapter.h" |
21 #include <QtDebug> |
21 #include "qtphonelog.h" |
22 #include <QSignalMapper> |
22 #include <QSignalMapper> |
23 #include <QTimer> |
23 #include <QTimer> |
24 #include <hbdevicemessagebox.h> |
24 #include <hbdevicemessagebox.h> |
25 #include <hbdeviceprogressdialog.h> |
25 #include <hbdeviceprogressdialog.h> |
26 #include <hbmessagebox.h> |
26 #include <hbmessagebox.h> |
27 #include <hbprogressnote.h> |
27 #include <hbprogressdialog.h> |
28 #include <hbaction.h> |
28 #include <hbaction.h> |
29 #include <phoneappcommands.hrh> |
29 #include <phoneappcommands.hrh> |
30 |
30 |
31 PhoneNoteController::PhoneNoteController(QObject *parent) : |
31 PhoneNoteController::PhoneNoteController(QObject *parent) : |
32 QObject(parent), m_timer(0), m_progressDialog(0), m_dtmfNote(0), |
32 QObject(parent), m_timer(0), m_progressDialog(0), m_dtmfNote(0), |
33 m_queryNote(0), m_queryCanceledCommand(-1), m_timeoutCommand(-1) |
33 m_queryNote(0), m_queryCanceledCommand(-1), m_timeoutCommand(-1) |
34 { |
34 { |
35 qDebug() << "PhoneNoteController::PhoneNoteController"; |
35 PHONE_DEBUG("PhoneNoteController::PhoneNoteController"); |
36 m_signalMapper = new QSignalMapper(this); |
36 m_signalMapper = new QSignalMapper(this); |
37 connect(m_signalMapper, SIGNAL(mapped(int)), this, SIGNAL(command (int))); |
37 connect(m_signalMapper, SIGNAL(mapped(int)), this, SIGNAL(command (int))); |
38 } |
38 } |
39 |
39 |
40 PhoneNoteController::~PhoneNoteController() |
40 PhoneNoteController::~PhoneNoteController() |
41 { |
41 { |
42 qDebug() << "PhoneNoteController::~PhoneNoteController"; |
42 PHONE_DEBUG("PhoneNoteController::~PhoneNoteController"); |
43 if (m_timer) { |
43 if (m_timer) { |
44 delete m_timer; |
44 delete m_timer; |
45 } |
45 } |
46 } |
46 } |
47 |
47 |
48 void PhoneNoteController::showGlobalNote(TPhoneCommandParam *commandParam) |
48 void PhoneNoteController::showGlobalNote(TPhoneCommandParam *commandParam) |
49 { |
49 { |
50 qDebug() << "PhoneNoteController::showGlobalNote"; |
50 PHONE_DEBUG("PhoneNoteController::showGlobalNote"); |
51 Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdGlobalNote); |
51 Q_ASSERT (commandParam->ParamId () == TPhoneCommandParam::EPhoneParamIdGlobalNote); |
52 |
52 |
53 TPhoneCmdParamGlobalNote* globalNoteParam = |
53 TPhoneCmdParamGlobalNote* globalNoteParam = |
54 static_cast<TPhoneCmdParamGlobalNote*>( commandParam ); |
54 static_cast<TPhoneCmdParamGlobalNote*>( commandParam ); |
55 |
55 |
101 |
101 |
102 } |
102 } |
103 |
103 |
104 void PhoneNoteController::showQuery(TPhoneCommandParam *commandParam) |
104 void PhoneNoteController::showQuery(TPhoneCommandParam *commandParam) |
105 { |
105 { |
106 qDebug() << "PhoneNoteController::showQuery"; |
106 PHONE_DEBUG("PhoneNoteController::showQuery"); |
107 TPhoneCmdParamQuery& params = *static_cast<TPhoneCmdParamQuery*>( commandParam ); |
107 TPhoneCmdParamQuery& params = *static_cast<TPhoneCmdParamQuery*>( commandParam ); |
108 |
108 |
109 if ( EPhoneQueryDialog == params.QueryType() && |
109 if ( EPhoneQueryDialog == params.QueryType() && |
110 params.QueryPrompt().Length() ) { |
110 params.QueryPrompt().Length() ) { |
111 showDefaultQuery(¶ms); |
111 showDefaultQuery(¶ms); |
118 |
118 |
119 } |
119 } |
120 |
120 |
121 void PhoneNoteController::removeDtmfNote() |
121 void PhoneNoteController::removeDtmfNote() |
122 { |
122 { |
123 qDebug() << "PhoneNoteController::removeDtmfNote"; |
123 PHONE_DEBUG("PhoneNoteController::removeDtmfNote"); |
124 if (m_dtmfNote) { |
124 if (m_dtmfNote) { |
125 m_dtmfNote->close(); |
125 m_dtmfNote->close(); |
126 } |
126 } |
127 } |
127 } |
128 |
128 |
129 void PhoneNoteController::removeNote() |
129 void PhoneNoteController::removeNote() |
130 { |
130 { |
131 qDebug() << "PhoneNoteController::removeNote"; |
131 PHONE_DEBUG("PhoneNoteController::removeNote"); |
132 removeDtmfNote(); |
132 removeDtmfNote(); |
133 } |
133 } |
134 |
134 |
135 void PhoneNoteController::removeQuery() |
135 void PhoneNoteController::removeQuery() |
136 { |
136 { |
137 qDebug() << "PhoneNoteController::removeQuery"; |
137 PHONE_DEBUG("PhoneNoteController::removeQuery"); |
138 if (m_queryNote) { |
138 if (m_queryNote) { |
139 m_queryNote->close(); |
139 m_queryNote->close(); |
140 } |
140 } |
141 } |
141 } |
142 |
142 |
143 void PhoneNoteController::removeGlobalWaitNote() |
143 void PhoneNoteController::removeGlobalWaitNote() |
144 { |
144 { |
145 qDebug() << "PhoneNoteController::removeGlobalWaitNote"; |
145 PHONE_DEBUG("PhoneNoteController::removeGlobalWaitNote"); |
146 if (m_timer) { |
146 if (m_timer) { |
147 m_timeoutCommand = -1; |
147 m_timeoutCommand = -1; |
148 m_timer->stop(); |
148 m_timer->stop(); |
149 } |
149 } |
150 |
150 |
154 } |
154 } |
155 } |
155 } |
156 |
156 |
157 void PhoneNoteController::destroyDialog() |
157 void PhoneNoteController::destroyDialog() |
158 { |
158 { |
159 qDebug() << "PhoneNoteController::destroyDialog"; |
159 PHONE_DEBUG("PhoneNoteController::destroyDialog"); |
160 HbDeviceMessageBox *messageBox = m_messageBoxList.takeFirst(); |
160 HbDeviceMessageBox *messageBox = m_messageBoxList.takeFirst(); |
161 messageBox->deleteLater(); |
161 messageBox->deleteLater(); |
162 messageBox = 0; |
162 messageBox = 0; |
163 |
163 |
164 if ( 0 < m_messageBoxList.size() ) { |
164 if ( 0 < m_messageBoxList.size() ) { |
165 qDebug() << "PhoneNoteController::show pending note"; |
165 PHONE_DEBUG("PhoneNoteController::show pending note"); |
166 HbDeviceMessageBox *messageBoxTemp = m_messageBoxList[0]; |
166 HbDeviceMessageBox *messageBoxTemp = m_messageBoxList[0]; |
167 QObject::connect(messageBoxTemp, SIGNAL(aboutToClose()), |
167 QObject::connect(messageBoxTemp, SIGNAL(aboutToClose()), |
168 this, SLOT(destroyDialog())); |
168 this, SLOT(destroyDialog())); |
169 messageBoxTemp->show(); |
169 messageBoxTemp->show(); |
170 } |
170 } |
252 noteParam->Text().Length()) ); |
252 noteParam->Text().Length()) ); |
253 m_dtmfNote->update(); |
253 m_dtmfNote->update(); |
254 } else { |
254 } else { |
255 QList<HbAction*> hbactions = PhoneResourceAdapter::Instance()-> |
255 QList<HbAction*> hbactions = PhoneResourceAdapter::Instance()-> |
256 convertToHbActions(noteParam->ResourceId()); |
256 convertToHbActions(noteParam->ResourceId()); |
257 |
257 |
258 if (hbactions.count() > 0) { |
258 if (hbactions.count() > 0) { |
259 m_dtmfNote = new HbProgressNote(HbProgressNote::ProgressNote); |
259 m_dtmfNote = new HbProgressDialog(HbProgressDialog::ProgressDialog); |
260 m_dtmfNote->setText( QString::fromUtf16(noteParam->Text().Ptr(), |
260 m_dtmfNote->setText( QString::fromUtf16(noteParam->Text().Ptr(), |
261 noteParam->Text().Length()) ); |
261 noteParam->Text().Length()) ); |
262 |
262 |
263 connect(hbactions.at(0), SIGNAL(triggered()), m_signalMapper, SLOT(map())); |
263 connect(hbactions.at(0), SIGNAL(triggered()), m_signalMapper, SLOT(map())); |
264 m_dtmfNote->setPrimaryAction(hbactions.at(0)); |
264 m_dtmfNote->setPrimaryAction(hbactions.at(0)); |
311 void PhoneNoteController::showGlobalWaitNote(TPhoneCmdParamQuery* params) |
311 void PhoneNoteController::showGlobalWaitNote(TPhoneCmdParamQuery* params) |
312 { |
312 { |
313 if (!m_progressDialog) { |
313 if (!m_progressDialog) { |
314 m_queryCanceledCommand = params->CbaCommandMapping(EAknSoftkeyCancel); |
314 m_queryCanceledCommand = params->CbaCommandMapping(EAknSoftkeyCancel); |
315 |
315 |
316 m_progressDialog = new HbDeviceProgressDialog(HbProgressNote::WaitNote); |
316 m_progressDialog = new HbDeviceProgressDialog(HbProgressDialog::WaitDialog); |
317 |
317 |
318 if (params->QueryPrompt().Length()) { |
318 if (params->QueryPrompt().Length()) { |
319 m_progressDialog->setText(QString::fromUtf16(params->QueryPrompt().Ptr(), |
319 m_progressDialog->setText(QString::fromUtf16(params->QueryPrompt().Ptr(), |
320 params->QueryPrompt().Length())); |
320 params->QueryPrompt().Length())); |
321 } else if (0 != params->DataText()) { |
321 } else if (0 != params->DataText()) { |