diff -r fd30d51f876b -r a949c2543c15 notes/notesui/notesviews/src/notesnoteview.cpp --- a/notes/notesui/notesviews/src/notesnoteview.cpp Mon May 03 12:30:32 2010 +0300 +++ b/notes/notesui/notesviews/src/notesnoteview.cpp Fri May 14 15:51:09 2010 +0300 @@ -26,6 +26,7 @@ #include #include #include +#include // User includes #include "notesnoteview.h" @@ -53,7 +54,8 @@ NotesNoteView::NotesNoteView(QGraphicsWidget *parent) :HbView(parent), mSelectedItem(0), - mDeleteAction(0) + mDeleteAction(0), + mIsLongTop(false) { // Nothing yet. } @@ -170,34 +172,36 @@ */ void NotesNoteView::handleItemReleased(const QModelIndex &index) { - // Sanity check. - if (!index.isValid()) { - return; - } + if(!mIsLongTop) { + // Sanity check. + if (!index.isValid()) { + return; + } - // First get the id of the note and get the corresponding information from - // agendautil. - ulong noteId = index.data(NotesNamespace::IdRole).value(); + // First get the id of the note and get the corresponding information from + // agendautil. + ulong noteId = index.data(NotesNamespace::IdRole).value(); - if (0 >= noteId) { - // Something wrong. - return; - } + if (0 >= noteId) { + // Something wrong. + return; + } - // Get the entry details. - AgendaEntry entry = mAgendaUtil->fetchById(noteId); + // Get the entry details. + AgendaEntry entry = mAgendaUtil->fetchById(noteId); - if (entry.isNull()) { - // Entry invalid. - return; + if (entry.isNull()) { + // Entry invalid. + return; + } + + // Now launch the editor with the obtained info. + mNotesEditor = new NotesEditor(mAgendaUtil, this); + connect( + mNotesEditor, SIGNAL(editingCompleted(bool)), + this, SLOT(handleEditingCompleted(bool))); + mNotesEditor->edit(entry); } - - // Now launch the editor with the obtained info. - mNotesEditor = new NotesEditor(mAgendaUtil, this); - connect( - mNotesEditor, SIGNAL(editingCompleted(bool)), - this, SLOT(handleEditingCompleted(bool))); - mNotesEditor->edit(entry); } /*! @@ -212,6 +216,7 @@ HbAbstractViewItem *item, const QPointF &coords) { mSelectedItem = item; + mIsLongTop = true; ulong noteId = item->modelIndex().data( NotesNamespace::IdRole).value(); @@ -219,48 +224,32 @@ // Display a context specific menu. HbMenu *contextMenu = new HbMenu(); + connect( + contextMenu,SIGNAL(aboutToClose()), + this, SLOT(handleMenuClosed())); // Add actions to the context menu. mOpenAction = contextMenu->addAction(hbTrId("txt_common_menu_open")); - connect( - mOpenAction, SIGNAL(triggered()), - this, SLOT(openNote())); mDeleteAction = contextMenu->addAction(hbTrId("txt_common_menu_delete")); - connect( - mDeleteAction, SIGNAL(triggered()), - this, SLOT(deleteNote())); if (AgendaEntry::TypeNote == entry.type()) { if (entry.favourite()) { - mMakeFavouriteAction = - contextMenu->addAction( + mMakeFavouriteAction = contextMenu->addAction( hbTrId("txt_notes_menu_remove_from_favorites")); - - connect( - mMakeFavouriteAction, SIGNAL(triggered()), - this, SLOT(markNoteAsFavourite())); - } else { - mMakeFavouriteAction = - contextMenu->addAction( + mMakeFavouriteAction = contextMenu->addAction( hbTrId("txt_notes_menu_mark_as_favorite")); - - connect( - mMakeFavouriteAction, SIGNAL(triggered()), - this, SLOT(markNoteAsFavourite())); } mMarkTodoAction = contextMenu->addAction( hbTrId("txt_notes_menu_make_it_as_todo_note")); - connect( - mMarkTodoAction, SIGNAL(triggered()), - this, SLOT(markNoteAsTodo())); } // Show the menu. - contextMenu->exec(coords); + contextMenu->open(this, SLOT(selectedMenuAction(HbAction*))); + contextMenu->setPreferredPos(coords); } /*! @@ -357,6 +346,13 @@ // Delete the old entry. mAgendaUtil->deleteEntry(entry.id()); + // Show the soft notification. + HbNotificationDialog *notificationDialog = new HbNotificationDialog(); + notificationDialog->setTimeout( + HbNotificationDialog::ConfirmationNoteTimeout); + notificationDialog->setTitle( + hbTrId("txt_notes_dpopinfo_note_moved_to_todos")); + notificationDialog->show(); } /*! @@ -437,5 +433,29 @@ // Launch the notes editor with the obtained info. mNotesEditor->edit(entry); } + +/*! + Slot to handle context menu actions. + */ +void NotesNoteView::selectedMenuAction(HbAction *action) +{ + if (action == mOpenAction) { + openNote(); + } else if (action == mDeleteAction) { + deleteNote(); + } else if (action == mMakeFavouriteAction) { + markNoteAsFavourite(); + } else if (action == mMarkTodoAction) { + markNoteAsTodo(); + } +} + +/*! + Slot to handle the context menu closed. + */ +void NotesNoteView::handleMenuClosed() +{ + mIsLongTop = false; +} // End of file --Don't remove this.