22 #include <hblistview.h> |
22 #include <hblistview.h> |
23 #include <hbdialog.h> |
23 #include <hbdialog.h> |
24 #include <hblabel.h> |
24 #include <hblabel.h> |
25 #include <hbaction.h> |
25 #include <hbaction.h> |
26 #include <hbmessagebox.h> |
26 #include <hbmessagebox.h> |
|
27 #include <hbnotificationdialog.h> |
27 #include <QStandardItemModel> |
28 #include <QStandardItemModel> |
28 #include <QItemSelectionModel> |
29 #include <QItemSelectionModel> |
29 #include <hbstringutil.h> |
30 #include <hbstringutil.h> |
30 #include <hbextendedlocale.h> |
31 #include <hbextendedlocale.h> |
31 #include <HbInputDialog> |
32 #include <HbInputDialog> |
94 DPRINT << ": IN"; |
89 DPRINT << ": IN"; |
95 |
90 |
96 HbDeviceProgressDialog *note = |
91 HbDeviceProgressDialog *note = |
97 new HbDeviceProgressDialog(HbProgressDialog::WaitDialog, this); |
92 new HbDeviceProgressDialog(HbProgressDialog::WaitDialog, this); |
98 note->setText(text); |
93 note->setText(text); |
99 QAction *action = new QAction(hbTrId("txt_common_button_hide"), this); |
94 |
100 //Ownership of action is not transferred. Deleted when note closes. |
95 if(hbTrId("txt_common_info_requesting") == text){ |
101 note->setAction(action, HbDeviceProgressDialog::CancelButtonRole ); |
96 QAction *action = new QAction(hbTrId("txt_common_button_hide"), note); |
|
97 note->setAction(action, HbDeviceProgressDialog::CancelButtonRole ); |
|
98 } |
|
99 |
102 noteId = reinterpret_cast<int>(note); |
100 noteId = reinterpret_cast<int>(note); |
103 DPRINT << ", NOTEID: " << noteId; |
101 DPRINT << ", NOTEID: " << noteId; |
104 QObject::connect( |
102 QObject::connect( |
105 note, SIGNAL(aboutToClose()), |
103 note, SIGNAL(aboutToClose()), |
106 this, SLOT(activeNoteAboutToClose())); |
104 this, SLOT(activeNoteAboutToClose())); |
141 launchNextNoteIfReady(); |
139 launchNextNoteIfReady(); |
142 |
140 |
143 DPRINT << ": OUT"; |
141 DPRINT << ": OUT"; |
144 } |
142 } |
145 |
143 |
146 /*! |
|
147 CpPhoneNotes::showBasicServiceList. |
|
148 */ |
|
149 void CpPhoneNotes::showBasicServiceList( |
|
150 const QString &title, |
|
151 const QList<unsigned char> &basicServiceGroupIds) |
|
152 { |
|
153 DPRINT << ": IN"; |
|
154 |
|
155 Q_ASSERT(title != ""); |
|
156 Q_ASSERT(0 < basicServiceGroupIds.count()); |
|
157 |
|
158 QScopedPointer<HbDialog> serviceListPopup(new HbDialog()); |
|
159 serviceListPopup->setDismissPolicy(HbDialog::NoDismiss); |
|
160 serviceListPopup->setTimeout(HbPopup::NoTimeout); |
|
161 |
|
162 QScopedPointer<HbLabel> heading( |
|
163 new HbLabel(title, serviceListPopup.data())); |
|
164 heading->setAlignment(Qt::AlignLeft | Qt::AlignTop); |
|
165 serviceListPopup->setHeadingWidget(heading.take()); |
|
166 |
|
167 QScopedPointer<HbListView> serviceList( |
|
168 new HbListView(serviceListPopup.data())); |
|
169 QScopedPointer<QStandardItemModel> serviceListModel( |
|
170 new QStandardItemModel(serviceList.data())); |
|
171 for (int i = 0; i < basicServiceGroupIds.count(); i++) { |
|
172 BasicServiceGroups groupId = |
|
173 static_cast<BasicServiceGroups>(basicServiceGroupIds.at(i)); |
|
174 QString groupName = basicServiceGroupName(groupId); |
|
175 QScopedPointer<QStandardItem> listItem(new QStandardItem(groupName)); |
|
176 serviceListModel->appendRow(listItem.take()); |
|
177 } |
|
178 serviceList->setModel(serviceListModel.take()); |
|
179 serviceList->setSelectionMode(HbAbstractItemView::NoSelection); |
|
180 serviceListPopup->setContentWidget(serviceList.take()); |
|
181 |
|
182 HbAction *backAction = |
|
183 new HbAction(hbTrId("txt_common_button_back"), serviceListPopup.data()); |
|
184 serviceListPopup->setPrimaryAction(backAction); |
|
185 |
|
186 HbDialog *serviceListPopupDialog = serviceListPopup.take(); |
|
187 QObject::connect( |
|
188 serviceListPopupDialog, SIGNAL(finished(HbAction*)), |
|
189 serviceListPopupDialog, SLOT(deleteLater())); |
|
190 serviceListPopupDialog->show(); |
|
191 |
|
192 DPRINT << ": OUT"; |
|
193 } |
|
194 |
144 |
195 /*! |
145 /*! |
196 CpPhoneNotes::cancelNote. |
146 CpPhoneNotes::cancelNote. |
197 */ |
147 */ |
198 void CpPhoneNotes::cancelNote(int noteId) |
148 void CpPhoneNotes::cancelNote(int noteId) |
231 { |
181 { |
232 return !m_notesQueue->isEmpty(); |
182 return !m_notesQueue->isEmpty(); |
233 } |
183 } |
234 |
184 |
235 /*! |
185 /*! |
236 CpPhoneNotes::basicServiceGroupName. |
|
237 Resolves basic service group name by group identifier. |
|
238 */ |
|
239 QString CpPhoneNotes::basicServiceGroupName(BasicServiceGroups basicServiceGroupId) const |
|
240 { |
|
241 DPRINT << ": IN"; |
|
242 |
|
243 QString string = ""; |
|
244 switch (basicServiceGroupId) { |
|
245 case AllTeleAndBearer: |
|
246 string = hbTrId("All services"); |
|
247 break; |
|
248 case AllTele: |
|
249 string = hbTrId("Voice, fax and messages"); |
|
250 break; |
|
251 case Telephony: |
|
252 string = hbTrId("Voice calls"); |
|
253 break; |
|
254 case AllDataTele: |
|
255 string = hbTrId("Fax and messages"); |
|
256 break; |
|
257 case Fax: |
|
258 string = hbTrId("Fax"); |
|
259 break; |
|
260 case Sms: |
|
261 string = hbTrId("Messages"); |
|
262 break; |
|
263 case AllTeleExcSms: |
|
264 string = hbTrId("Voice calls and fax"); |
|
265 break; |
|
266 case AllBearer: |
|
267 if (Tools::videoSupported()) { |
|
268 string = hbTrId("Data and video services"); |
|
269 } else { |
|
270 string = hbTrId("Data services"); |
|
271 } |
|
272 break; |
|
273 case AllAsync: |
|
274 string = hbTrId("Asynchronous services"); |
|
275 break; |
|
276 case AllSync: |
|
277 string = hbTrId("Synchronous services"); |
|
278 break; |
|
279 case SyncData: |
|
280 string = hbTrId("Synchronous data services"); |
|
281 break; |
|
282 case AsyncData: |
|
283 string = hbTrId("Asynchronous data services"); |
|
284 break; |
|
285 case PacketData: |
|
286 string = hbTrId("Packet data"); |
|
287 break; |
|
288 case PadAccess: |
|
289 string = hbTrId("PAD access"); |
|
290 break; |
|
291 case 30: |
|
292 string = hbTrId("Video calls"); |
|
293 break; |
|
294 case AltTele: |
|
295 string = hbTrId("Alternate line services"); |
|
296 break; |
|
297 default: |
|
298 DPRINT << ", DEFAULT"; |
|
299 break; |
|
300 } |
|
301 |
|
302 DPRINT << ": OUT"; |
|
303 return string; |
|
304 } |
|
305 |
|
306 /*! |
|
307 CpPhoneNotes::showGlobalErrorNote. |
186 CpPhoneNotes::showGlobalErrorNote. |
308 */ |
187 */ |
309 void CpPhoneNotes::showGlobalErrorNote(int ¬eId, int errorcode) |
188 void CpPhoneNotes::showGlobalErrorNote(int ¬eId, int errorcode) |
310 { |
189 { |
311 DPRINT << ": IN"; |
190 DPRINT << ": IN"; |
351 } |
230 } |
352 divertInfoScopedPointer->setText(content); |
231 divertInfoScopedPointer->setText(content); |
353 HbAction *backAction = new HbAction( |
232 HbAction *backAction = new HbAction( |
354 hbTrId("txt_common_button_back"), |
233 hbTrId("txt_common_button_back"), |
355 divertInfoScopedPointer.data()); |
234 divertInfoScopedPointer.data()); |
356 divertInfoScopedPointer->setPrimaryAction(backAction); |
235 divertInfoScopedPointer->addAction(backAction); |
357 |
236 |
358 HbMessageBox *divertInfo = divertInfoScopedPointer.take(); |
237 HbMessageBox *divertInfo = divertInfoScopedPointer.take(); |
359 QObject::connect( |
238 QObject::connect( |
360 divertInfo, SIGNAL(finished(HbAction*)), |
239 divertInfo, SIGNAL(finished(HbAction*)), |
361 divertInfo, SLOT(deleteLater())); |
240 divertInfo, SLOT(deleteLater())); |
378 |
257 |
379 // configure editor so that only digits can be inputted |
258 // configure editor so that only digits can be inputted |
380 passwordDialog->setPromptText(title); |
259 passwordDialog->setPromptText(title); |
381 passwordDialog->setEchoMode(HbLineEdit::Password); |
260 passwordDialog->setEchoMode(HbLineEdit::Password); |
382 passwordDialog->setInputMethodHints(Qt::ImhDigitsOnly); |
261 passwordDialog->setInputMethodHints(Qt::ImhDigitsOnly); |
|
262 passwordDialog->actions().at(0)->setEnabled(false); |
|
263 |
383 HbLineEdit *hbLineEdit = passwordDialog->lineEdit(); |
264 HbLineEdit *hbLineEdit = passwordDialog->lineEdit(); |
384 hbLineEdit->setMaxLength(maxPasswordLength); |
265 hbLineEdit->setMaxLength(maxPasswordLength); |
|
266 |
385 HbEditorInterface editorInterface(hbLineEdit); |
267 HbEditorInterface editorInterface(hbLineEdit); |
386 |
|
387 editorInterface.setMode(HbInputModeNumeric); |
268 editorInterface.setMode(HbInputModeNumeric); |
388 editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); |
269 editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); |
389 |
|
390 editorInterface.setFilter(HbDigitsOnlyFilter::instance()); |
270 editorInterface.setFilter(HbDigitsOnlyFilter::instance()); |
391 |
271 |
392 m_passwordValidator = &validator; |
272 m_passwordValidator = &validator; |
393 passwordDialog->primaryAction()->setEnabled(false); |
273 |
394 connect( |
274 connect( |
395 hbLineEdit, SIGNAL(contentsChanged()), |
275 hbLineEdit, SIGNAL(contentsChanged()), |
396 this, SLOT(passwordTextChanged())); |
276 this, SLOT(passwordTextChanged())); |
397 |
277 |
398 passwordDialog->open(this, SLOT(finishedPasswordQueryDialog(HbAction*))); |
278 passwordDialog->open(this, SLOT(finishedPasswordQueryDialog(HbAction*))); |
399 if(m_passwordDialog) { |
279 if(m_passwordDialog) { |
400 m_passwordDialog->deleteLater(); |
280 m_passwordDialog->deleteLater(); |
401 m_passwordDialog = NULL; |
281 m_passwordDialog = NULL; |
402 } |
282 } |
403 m_passwordDialog = passwordDialog.take(); |
283 m_passwordDialog = passwordDialog.take(); |
404 |
284 m_passwordDialog->setParent(this); |
405 DPRINT << ": OUT"; |
285 DPRINT << ": OUT"; |
406 } |
286 } |
407 |
287 |
408 /*! |
288 /*! |
409 CpPhoneNotes::finishedPasswordQueryDialog. |
289 CpPhoneNotes::finishedPasswordQueryDialog. |
505 launchNextNoteIfReady(); |
385 launchNextNoteIfReady(); |
506 note->disconnect(this); |
386 note->disconnect(this); |
507 DPRINT << ", delete note: " << reinterpret_cast<int>(note); |
387 DPRINT << ", delete note: " << reinterpret_cast<int>(note); |
508 HbDeviceProgressDialog *pNote = |
388 HbDeviceProgressDialog *pNote = |
509 qobject_cast<HbDeviceProgressDialog *>(note); |
389 qobject_cast<HbDeviceProgressDialog *>(note); |
510 if(pNote){ |
|
511 delete pNote->action(); |
|
512 } |
|
513 note->deleteLater(); |
390 note->deleteLater(); |
514 } |
391 } |
515 } |
392 } |
516 |
393 |
517 DPRINT << ": OUT"; |
394 DPRINT << ": OUT"; |
541 int position = 0; |
418 int position = 0; |
542 QString password = hbLineEdit->text(); |
419 QString password = hbLineEdit->text(); |
543 bool isPasswordValid = |
420 bool isPasswordValid = |
544 (QValidator::Acceptable == m_passwordValidator->validate( |
421 (QValidator::Acceptable == m_passwordValidator->validate( |
545 password, position)); |
422 password, position)); |
546 m_passwordDialog->primaryAction()->setEnabled(isPasswordValid); |
423 m_passwordDialog->actions().at(0)->setEnabled(isPasswordValid); |
547 |
424 |
|
425 DPRINT << ": OUT"; |
|
426 } |
|
427 |
|
428 |
|
429 /*! |
|
430 CpPhoneNotes::showNotificationDialog. |
|
431 */ |
|
432 void CpPhoneNotes::showNotificationDialog(const QString& text) |
|
433 { |
|
434 DPRINT << ": IN"; |
|
435 HbNotificationDialog *notifDialog = new HbNotificationDialog(); |
|
436 notifDialog->setDismissPolicy(HbPopup::TapAnywhere); |
|
437 notifDialog->setAttribute(Qt::WA_DeleteOnClose, true); |
|
438 notifDialog->setText(text); |
|
439 notifDialog->show(); |
|
440 |
548 DPRINT << ": OUT"; |
441 DPRINT << ": OUT"; |
549 } |
442 } |
550 |
443 |
551 // End of File. |
444 // End of File. |