294 mSubHeading->setHeading(hbTrId("txt_notes_subhead_todo")); |
293 mSubHeading->setHeading(hbTrId("txt_notes_subhead_todo")); |
295 } |
294 } |
296 |
295 |
297 // Store the current view and set our view as the current view. |
296 // Store the current view and set our view as the current view. |
298 HbMainWindow *window = hbInstance->allMainWindows().first(); |
297 HbMainWindow *window = hbInstance->allMainWindows().first(); |
299 HbAction *action = new HbAction(Hb::BackAction); |
298 HbAction *action = new HbAction(Hb::BackNaviAction); |
300 mEditor->setNavigationAction(action); |
299 mEditor->setNavigationAction(action); |
301 connect( |
300 connect( |
302 action, SIGNAL(triggered()), |
301 action, SIGNAL(triggered()), |
303 this, SLOT(saveTodo())); |
302 this, SLOT(saveTodo())); |
304 window->addView(mEditor); |
303 window->addView(mEditor); |
634 /*! |
633 /*! |
635 Handles "Delete" action when triggered from menu |
634 Handles "Delete" action when triggered from menu |
636 */ |
635 */ |
637 void NotesTodoEditor::handleDeleteAction() |
636 void NotesTodoEditor::handleDeleteAction() |
638 { |
637 { |
639 if (showDeleteConfirmationQuery()) { |
638 HbMessageBox *confirmationQuery = new HbMessageBox( |
640 // Delete the to-do entry. |
639 HbMessageBox::MessageTypeQuestion); |
641 mOwner->deleteNote(); |
640 confirmationQuery->setDismissPolicy(HbDialog::NoDismiss); |
642 |
641 confirmationQuery->setTimeout(HbDialog::NoTimeout); |
643 // Close the to-do editor. |
642 confirmationQuery->setIconVisible(true); |
644 close(); |
643 |
645 } |
644 QString displayText; |
646 |
645 displayText = displayText.append(hbTrId("txt_notes_info_delete_todo_note")); |
|
646 |
|
647 confirmationQuery->setText(displayText); |
|
648 |
|
649 // Remove the default actions. |
|
650 QList<QAction *> defaultActions = confirmationQuery->actions(); |
|
651 for (int index=0;index<defaultActions.count();index++) { |
|
652 confirmationQuery->removeAction(defaultActions[index]); |
|
653 } |
|
654 defaultActions.clear(); |
|
655 |
|
656 // Add delete and cancel actions. |
|
657 mDeleteTodoAction = new HbAction( |
|
658 hbTrId("txt_notes_button_dialog_delete")); |
|
659 mCancelDeleteAction = new HbAction( |
|
660 hbTrId("txt_common_button_cancel")); |
|
661 confirmationQuery->addAction(mDeleteTodoAction); |
|
662 confirmationQuery->addAction((mCancelDeleteAction)); |
|
663 |
|
664 confirmationQuery->open(this, SLOT(selectedAction(HbAction*))); |
647 } |
665 } |
648 |
666 |
649 /*! |
667 /*! |
650 Handles "Discard changes" action when triggered from menu |
668 Handles "Discard changes" action when triggered from menu |
651 */ |
669 */ |
652 void NotesTodoEditor::handleDiscardChangesAction() |
670 void NotesTodoEditor::handleDiscardChangesAction() |
653 { |
671 { |
654 // Close the to-do editor |
672 // Close the to-do editor |
655 close(); |
673 close(); |
656 |
674 } |
657 } |
675 |
658 |
676 /*! |
659 /* ! |
677 Slot to handle selected action in delete confirmation note. |
660 Show the delete confirmation query. |
678 */ |
661 */ |
679 void NotesTodoEditor::selectedAction(HbAction *action) |
662 bool NotesTodoEditor::showDeleteConfirmationQuery() |
680 { |
663 { |
681 if (action==mDeleteTodoAction) { |
664 bool retValue(false); |
682 // Delete the to-do entry. |
665 |
683 mOwner->deleteNote(); |
666 HbMessageBox confirmationQuery(HbMessageBox::MessageTypeQuestion); |
684 |
667 confirmationQuery.setDismissPolicy(HbDialog::NoDismiss); |
685 // Close the to-do editor. |
668 confirmationQuery.setTimeout(HbDialog::NoTimeout); |
686 close(); |
669 confirmationQuery.setIconVisible(true); |
687 } |
670 |
688 } |
671 QString displayText; |
689 |
672 displayText = displayText.append(hbTrId("txt_notes_info_delete_todo_note")); |
|
673 |
|
674 confirmationQuery.setText(displayText); |
|
675 |
|
676 confirmationQuery.setPrimaryAction(new HbAction( |
|
677 hbTrId("txt_notes_button_dialog_delete"), &confirmationQuery)); |
|
678 confirmationQuery.setSecondaryAction(new HbAction( |
|
679 hbTrId("txt_common_button_cancel"), &confirmationQuery)); |
|
680 HbAction *selected = confirmationQuery.exec(); |
|
681 if (selected == confirmationQuery.primaryAction()) { |
|
682 retValue = true; |
|
683 } |
|
684 |
|
685 return retValue; |
|
686 } |
|
687 // End of file --Don't remove this. |
690 // End of file --Don't remove this. |