214 apList[i]->getStringAttribute(CMManagerShim::CmName)); |
213 apList[i]->getStringAttribute(CMManagerShim::CmName)); |
215 |
214 |
216 // Add priority to item if not Uncategorised "Destination" |
215 // Add priority to item if not Uncategorised "Destination" |
217 if (mDestinationId != 0) { |
216 if (mDestinationId != 0) { |
218 // Access Points are listed in priority order. |
217 // Access Points are listed in priority order. |
219 QString priority = hbTrId("txt_occ_dblist_val_priority_l1", i); |
218 QString priority = hbTrId("txt_occ_dblist_val_priority_l1").arg(i + 1); |
220 iapDataItem->setContentWidgetData(QString("additionalText"), priority); |
219 iapDataItem->setContentWidgetData(QString("additionalText"), priority); |
221 } |
220 } |
222 |
221 |
223 // Set item disabled if it is protected |
222 // Set item disabled if it is protected |
224 if (apProtected) { |
223 if (apProtected) { |
292 } |
291 } |
293 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SHOWITEMMENU_EXIT); |
292 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SHOWITEMMENU_EXIT); |
294 } |
293 } |
295 |
294 |
296 /*! |
295 /*! |
|
296 Opens selected destination. |
|
297 */ |
|
298 void CpDestinationEntryItemData::openDestination() |
|
299 { |
|
300 onLaunchView(); |
|
301 } |
|
302 |
|
303 /*! |
297 Prompts user for new destination name and makes |
304 Prompts user for new destination name and makes |
298 the change in commsdat if new name is valid. |
305 the change in commsdat if new name is valid. |
299 |
306 |
300 \sa isDestinationNameValid() |
307 \sa isDestinationNameValid() |
301 */ |
308 */ |
302 void CpDestinationEntryItemData::renameDestination() |
309 void CpDestinationEntryItemData::renameDestination() |
303 { |
310 { |
304 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_RENAMEDESTINATION_ENTRY); |
311 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_RENAMEDESTINATION_ENTRY); |
305 mDialog = new HbInputDialog(); |
312 mDialog = new HbInputDialog(); |
306 mDialog->setAttribute(Qt::WA_DeleteOnClose); |
313 mDialog->setAttribute(Qt::WA_DeleteOnClose); |
307 mDialog->lineEdit()->setMaxLength(DestinationNameMaxLength); |
314 mDialog->lineEdit()->setMaxLength(CMManagerShim::CmNameLength); |
308 mDialog->clearActions(); |
315 mDialog->clearActions(); |
309 mDialog->setPromptText(hbTrId("txt_occ_dialog_destination_name")); |
316 mDialog->setPromptText(hbTrId("txt_occ_dialog_destination_name")); |
310 mDialog->setInputMode(HbInputDialog::TextInput); |
317 mDialog->setInputMode(HbInputDialog::TextInput); |
311 mOkAction = new HbAction(hbTrId("txt_common_button_ok")); |
318 mDialog->setValue(mDestinationName); |
|
319 mOkAction = new HbAction( |
|
320 hbTrId("txt_common_button_ok"), |
|
321 mDialog); |
312 bool connected = connect(mOkAction, |
322 bool connected = connect(mOkAction, |
313 SIGNAL(triggered()), |
323 SIGNAL(triggered()), |
314 this, |
324 this, |
315 SLOT(saveNewDestinationName())); |
325 SLOT(saveNewDestinationName())); |
316 Q_ASSERT(connected); |
326 Q_ASSERT(connected); |
317 HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_cancel")); |
327 HbAction *cancelAction = new HbAction( |
|
328 hbTrId("txt_common_button_cancel"), |
|
329 mDialog); |
318 mDialog->addAction(mOkAction); |
330 mDialog->addAction(mOkAction); |
319 mDialog->addAction(cancelAction); |
331 mDialog->addAction(cancelAction); |
320 mDialog->show(); |
332 mDialog->show(); |
321 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_RENAMEDESTINATION_EXIT); |
333 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_RENAMEDESTINATION_EXIT); |
322 } |
334 } |
330 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_CONFIRMDESTINATIONDELETE_ENTRY); |
342 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_CONFIRMDESTINATIONDELETE_ENTRY); |
331 HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
343 HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
332 note->setAttribute(Qt::WA_DeleteOnClose); |
344 note->setAttribute(Qt::WA_DeleteOnClose); |
333 note->setText(hbTrId("txt_occ_info_delete_snap").arg(mDestinationName)); |
345 note->setText(hbTrId("txt_occ_info_delete_snap").arg(mDestinationName)); |
334 note->clearActions(); |
346 note->clearActions(); |
335 HbAction *okAction = new HbAction(hbTrId("txt_common_button_yes")); |
347 HbAction *okAction = new HbAction( |
|
348 hbTrId("txt_common_button_yes"), |
|
349 note); |
336 note->addAction(okAction); |
350 note->addAction(okAction); |
337 bool connected = connect( |
351 bool connected = connect( |
338 okAction, |
352 okAction, |
339 SIGNAL(triggered()), |
353 SIGNAL(triggered()), |
340 this, |
354 this, |
341 SLOT(deleteDestination())); |
355 SLOT(deleteDestination())); |
342 Q_ASSERT(connected); |
356 Q_ASSERT(connected); |
343 HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_no")); |
357 HbAction *cancelAction = new HbAction( |
|
358 hbTrId("txt_common_button_no"), |
|
359 note); |
344 note->addAction(cancelAction); |
360 note->addAction(cancelAction); |
345 note->setTimeout(HbPopup::NoTimeout); |
361 note->setTimeout(HbPopup::NoTimeout); |
346 note->show(); |
362 note->show(); |
347 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_CONFIRMDESTINATIONDELETE_EXIT); |
363 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_CONFIRMDESTINATIONDELETE_EXIT); |
348 } |
364 } |
494 { |
510 { |
495 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_UPDATEINDEX_ENTRY); |
511 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_UPDATEINDEX_ENTRY); |
496 Q_UNUSED(widgetItem); |
512 Q_UNUSED(widgetItem); |
497 for (int i = 0; i < mList->count(); i++) { |
513 for (int i = 0; i < mList->count(); i++) { |
498 HbListWidgetItem *item = mList->item(i); |
514 HbListWidgetItem *item = mList->item(i); |
499 QString priority = hbTrId("txt_occ_dblist_val_priority_l1", i); |
515 QString priority = hbTrId("txt_occ_dblist_val_priority_l1").arg(i + 1); |
500 item->setSecondaryText(priority); |
516 item->setSecondaryText(priority); |
501 } |
517 } |
502 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_UPDATEINDEX_EXIT); |
518 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_UPDATEINDEX_EXIT); |
503 } |
519 } |
504 |
520 |
607 HbListWidgetItem *item = new HbListWidgetItem(); |
623 HbListWidgetItem *item = new HbListWidgetItem(); |
608 item->setText(apList[i]->getStringAttribute(CMManagerShim::CmName)); |
624 item->setText(apList[i]->getStringAttribute(CMManagerShim::CmName)); |
609 item->setData(apList[i]->getIntAttribute(CMManagerShim::CmId), Hb::IndexFeedbackRole); |
625 item->setData(apList[i]->getIntAttribute(CMManagerShim::CmId), Hb::IndexFeedbackRole); |
610 |
626 |
611 uint pri = destination->priority(apList[i].data()); |
627 uint pri = destination->priority(apList[i].data()); |
612 QString priority = hbTrId("txt_occ_dblist_val_priority_l1", pri); |
628 QString priority = hbTrId("txt_occ_dblist_val_priority_l1").arg(pri); |
613 item->setSecondaryText(priority); |
629 item->setSecondaryText(priority); |
614 |
630 |
615 mList->addItem(item); |
631 mList->addItem(item); |
616 } |
632 } |
617 mList->setArrangeMode(true); |
633 mList->setArrangeMode(true); |
651 const QPointF position) |
667 const QPointF position) |
652 { |
668 { |
653 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_CREATEITEMMENU_ENTRY); |
669 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_CREATEITEMMENU_ENTRY); |
654 HbMenu *menu = new HbMenu(); |
670 HbMenu *menu = new HbMenu(); |
655 menu->setAttribute(Qt::WA_DeleteOnClose); |
671 menu->setAttribute(Qt::WA_DeleteOnClose); |
|
672 HbAction *openDestAction = menu->addAction(hbTrId("txt_common_menu_open")); |
|
673 bool connected = |
|
674 connect(openDestAction, SIGNAL(triggered()), this, SLOT(openDestination())); |
|
675 Q_ASSERT(connected); |
656 HbAction *renameDestAction = menu->addAction(hbTrId("txt_common_menu_rename_item")); |
676 HbAction *renameDestAction = menu->addAction(hbTrId("txt_common_menu_rename_item")); |
657 bool connected = |
677 connected = |
658 connect(renameDestAction, SIGNAL(triggered()), this, SLOT(renameDestination())); |
678 connect(renameDestAction, SIGNAL(triggered()), this, SLOT(renameDestination())); |
659 Q_ASSERT(connected); |
679 Q_ASSERT(connected); |
660 HbAction *deleteDestAction = menu->addAction(hbTrId("txt_common_menu_delete")); |
680 HbAction *deleteDestAction = menu->addAction(hbTrId("txt_common_menu_delete")); |
661 connected = |
681 connected = |
662 connect(deleteDestAction, SIGNAL(triggered()), this, SLOT(confirmDestinationDelete())); |
682 connect(deleteDestAction, SIGNAL(triggered()), this, SLOT(confirmDestinationDelete())); |
676 return menu; |
696 return menu; |
677 } |
697 } |
678 |
698 |
679 /*! |
699 /*! |
680 This function is called when user selects OK from destination |
700 This function is called when user selects OK from destination |
681 name query popup. The given name is valited and if the name is |
701 name query popup. The given name is validated and if the name is |
682 valid, new destination is created in commsdat with given name. |
702 valid, new destination name is saved to commsdat. If validation fails |
683 If validation fails user is promted again for destination name. |
703 user is prompted again for destination name. |
684 */ |
704 */ |
685 void CpDestinationEntryItemData::saveNewDestinationName() |
705 void CpDestinationEntryItemData::saveNewDestinationName() |
686 { |
706 { |
687 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_ENTRY); |
707 OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_ENTRY); |
688 QString destinationName = mDialog->value().toString(); |
708 QString destinationName = mDialog->value().toString(); |
689 bool destinationNameInvalid = true; |
709 if (destinationName != mDestinationName) { |
690 CmManagerShim *cmm = NULL; |
710 // Destination name was changed |
691 CmDestinationShim *destination = NULL; |
711 bool destinationNameInvalid = true; |
692 |
712 CmManagerShim *cmm = NULL; |
693 try { |
713 CmDestinationShim *destination = NULL; |
694 cmm = new CmManagerShim(); |
714 |
695 if (isDestinationNameValid(destinationName, cmm)) { |
715 try { |
696 destination = cmm->destination(mDestinationId); |
716 cmm = new CmManagerShim(); |
697 destination->setName(destinationName); |
717 if (isDestinationNameValid(destinationName, cmm)) { |
698 destination->update(); |
718 destination = cmm->destination(mDestinationId); |
699 mDestinationName = destinationName; |
719 destination->setName(destinationName); |
700 destinationNameInvalid = false; |
720 destination->update(); |
701 } |
721 mDestinationName = destinationName; |
702 } catch (const std::exception&) { |
722 destinationNameInvalid = false; |
703 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_EXIT); |
723 } |
704 return; |
724 } catch (const std::exception&) { |
705 } |
725 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_EXIT); |
706 delete destination; |
726 return; |
707 delete cmm; |
727 } |
708 |
728 delete destination; |
709 if (destinationNameInvalid) { |
729 delete cmm; |
710 // Validation function has modified destination name |
730 |
711 // to be error string |
731 if (destinationNameInvalid) { |
712 showRenameError(destinationName); |
732 // Validation function has modified destination name |
713 } else { |
733 // to be error string |
714 OstTrace0(TRACE_NORMAL, CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME, "CpDestinationEntryItemData::saveNewDestinationName: emit destination changed"); |
734 showRenameError(destinationName); |
715 emit destChanged(); |
735 } else { |
|
736 OstTrace0(TRACE_NORMAL, CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME, "CpDestinationEntryItemData::saveNewDestinationName: emit destination changed"); |
|
737 emit destChanged(); |
|
738 } |
716 } |
739 } |
717 OstTraceFunctionExit0(DUP1_CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_EXIT); |
740 OstTraceFunctionExit0(DUP1_CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_EXIT); |
718 } |
741 } |
719 |
742 |
720 /*! |
743 /*! |
728 HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
751 HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
729 note->clearActions(); |
752 note->clearActions(); |
730 note->setAttribute(Qt::WA_DeleteOnClose); |
753 note->setAttribute(Qt::WA_DeleteOnClose); |
731 note->setText(info); |
754 note->setText(info); |
732 note->setTimeout(HbPopup::NoTimeout); |
755 note->setTimeout(HbPopup::NoTimeout); |
733 HbAction *errorOk = new HbAction(hbTrId("txt_common_button_ok")); |
756 HbAction *errorOk = new HbAction( |
|
757 hbTrId("txt_common_button_ok"), |
|
758 note); |
734 bool connected = connect( |
759 bool connected = connect( |
735 errorOk, |
760 errorOk, |
736 SIGNAL(triggered()), |
761 SIGNAL(triggered()), |
737 this, |
762 this, |
738 SLOT(renameDestination())); |
763 SLOT(renameDestination())); |
753 HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeWarning); |
778 HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeWarning); |
754 note->clearActions(); |
779 note->clearActions(); |
755 note->setAttribute(Qt::WA_DeleteOnClose); |
780 note->setAttribute(Qt::WA_DeleteOnClose); |
756 note->setText(info); |
781 note->setText(info); |
757 note->setTimeout(HbPopup::NoTimeout); |
782 note->setTimeout(HbPopup::NoTimeout); |
758 HbAction *errorOk = new HbAction(hbTrId("txt_common_button_ok")); |
783 HbAction *errorOk = new HbAction( |
|
784 hbTrId("txt_common_button_ok"), |
|
785 note); |
759 note->addAction(errorOk); |
786 note->addAction(errorOk); |
760 note->show(); |
787 note->show(); |
761 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SHOWERRORNOTE_EXIT); |
788 OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SHOWERRORNOTE_EXIT); |
762 } |
789 } |