notes/notesui/notesviews/src/notesnoteview.cpp
branchRCL_3
changeset 65 12af337248b1
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  * Definition file for NotesNoteView class.
       
    16  *
       
    17  */
       
    18 
       
    19 // System includes
       
    20 #include <QDateTime>
       
    21 #include <HbListView>
       
    22 #include <HbListWidget>
       
    23 #include <HbAction>
       
    24 #include <HbMenu>
       
    25 #include <HbAbstractViewItem>
       
    26 #include <HbGroupBox>
       
    27 #include <HbListViewItem>
       
    28 #include <HbInstance>
       
    29 #include <HbNotificationDialog>
       
    30 #include <HbLabel>
       
    31 
       
    32 // User includes
       
    33 #include <agendautil.h>
       
    34 #include "notesnoteview.h"
       
    35 #include "notescommon.h"
       
    36 #include "notesdocloader.h"
       
    37 #include "notesmodel.h"
       
    38 #include "notessortfilterproxymodel.h"
       
    39 #include "noteseditor.h"
       
    40 #include "OstTraceDefinitions.h"
       
    41 #ifdef OST_TRACE_COMPILER_IN_USE
       
    42 #include "notesnoteviewTraces.h"
       
    43 #endif
       
    44 
       
    45 
       
    46 
       
    47 /*!
       
    48 	\class NotesNoteView
       
    49 	\brief The Note view of the notes application. Responsible for displaying
       
    50 			the all notes.
       
    51 
       
    52 	\sa NotesViewManager
       
    53  */
       
    54 
       
    55 /*!
       
    56 	Constructs the NotesNoteView object.
       
    57 
       
    58 	\param parent The parent of type QGraphicsWidget.
       
    59  */
       
    60 NotesNoteView::NotesNoteView(QGraphicsWidget *parent)
       
    61 :HbView(parent),
       
    62  mSelectedItem(0),
       
    63  mDeleteAction(0),
       
    64  mIsLongTop(false)
       
    65 {
       
    66 	OstTraceFunctionEntry0( NOTESNOTEVIEW_NOTESNOTEVIEW_ENTRY );
       
    67 	// Nothing yet.
       
    68 	OstTraceFunctionExit0( NOTESNOTEVIEW_NOTESNOTEVIEW_EXIT );
       
    69 }
       
    70 
       
    71 /*!
       
    72 	Destructor.
       
    73  */
       
    74 NotesNoteView::~NotesNoteView()
       
    75 {
       
    76 	OstTraceFunctionEntry0( DUP1_NOTESNOTEVIEW_NOTESNOTEVIEW_ENTRY );
       
    77 	if (mDocLoader) {
       
    78 		delete mDocLoader;
       
    79 		mDocLoader = 0;
       
    80 	}
       
    81 	OstTraceFunctionExit0( DUP1_NOTESNOTEVIEW_NOTESNOTEVIEW_EXIT );
       
    82 }
       
    83 
       
    84 /*!
       
    85 	Called by the NotesViewManager after loading the view from the docml.
       
    86 	The initializaion/setup of the view is done here.
       
    87 
       
    88 	\param controller The NotesAppController object.
       
    89 	\param docLoader Pointer to NotesDocLoader object.
       
    90  */
       
    91 void NotesNoteView::setupView(
       
    92 		NotesAppControllerIf &controllerIf, NotesDocLoader *docLoader)
       
    93 {
       
    94 	OstTraceFunctionEntry0( NOTESNOTEVIEW_SETUPVIEW_ENTRY );
       
    95 	mDocLoader = docLoader;
       
    96 	mAppControllerIf = &controllerIf;
       
    97 	mNotesModel = mAppControllerIf->notesModel();
       
    98 	mAgendaUtil = mAppControllerIf->agendaUtil();
       
    99 
       
   100 	mProxyModel = new NotesSortFilterProxyModel(*mAgendaUtil, this);
       
   101 	mProxyModel->setDynamicSortFilter(true);
       
   102 	mProxyModel->setSourceModel(mNotesModel->sourceModel());
       
   103 
       
   104 	mProxyModel->setFilterRole(NotesNamespace::TypeRole);
       
   105 	mProxyModel->setFilterRegExp(QRegExp(QString("note")));
       
   106 
       
   107 	NotesSortFilterProxyModel *subModel =
       
   108 			new NotesSortFilterProxyModel(*mAgendaUtil, this);
       
   109 	subModel->setDynamicSortFilter(true);
       
   110 	subModel->setSourceModel(mProxyModel);
       
   111 
       
   112 	// Get the list object from the document and update the model.
       
   113 	mListView = static_cast<HbListView *> (
       
   114 			mDocLoader->findWidget("noteListView"));
       
   115 	
       
   116 	// Update the list view model.
       
   117 	mListView->setModel(subModel);
       
   118 	// Setup the operations that can be done with a list view.
       
   119 	connect(
       
   120 			mListView, SIGNAL(released(const QModelIndex &)),
       
   121 			this, SLOT(handleItemReleased(const QModelIndex &)));
       
   122 	connect(
       
   123 			mListView,
       
   124 			SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)),
       
   125 			this,
       
   126 			SLOT(handleItemLongPressed(HbAbstractViewItem *, const QPointF &)));
       
   127 
       
   128 	// Get the empty list label.
       
   129 	mEmptyListLabel = static_cast<HbLabel *> (
       
   130 			mDocLoader->findWidget("emptyListLabel"));
       
   131 
       
   132 	// Get the toolbar/menu actions.
       
   133 	mAddNoteAction = static_cast<HbAction *> (
       
   134 			mDocLoader->findObject("newNoteAction"));
       
   135 	connect(
       
   136 			mAddNoteAction, SIGNAL(triggered()),
       
   137 			this, SLOT(createNewNote()));
       
   138 
       
   139 	mAllNotesAction = static_cast<HbAction *> (
       
   140 			mDocLoader->findObject("allNotesAction"));
       
   141 	connect(
       
   142 			mAllNotesAction, SIGNAL(triggered()),
       
   143 			this, SLOT(displayAllNotesView()));
       
   144 
       
   145 	mViewCollectionAction = static_cast<HbAction *> (
       
   146 			mDocLoader->findObject("displayCollectionsAction"));
       
   147 	
       
   148 	connect(
       
   149 			mViewCollectionAction, SIGNAL(changed()),
       
   150 			this, SLOT(handleActionStateChanged()));
       
   151 	connect(
       
   152 			mViewCollectionAction, SIGNAL(triggered()),
       
   153 			this, SLOT(displayCollectionView()));
       
   154 
       
   155 	// Handles the orientation change for list items
       
   156 	HbMainWindow *window = hbInstance->allMainWindows().first();
       
   157 	handleOrientationChanged(window->orientation());
       
   158 	connect(
       
   159 			window, SIGNAL(orientationChanged(Qt::Orientation)),
       
   160 			this, SLOT(handleOrientationChanged(Qt::Orientation)));
       
   161 
       
   162 
       
   163 	connect(
       
   164 			mAgendaUtil, SIGNAL(entryAdded(ulong)),
       
   165 			this,SLOT(updateView(ulong)));
       
   166 	connect(
       
   167 			mAgendaUtil, SIGNAL(entryDeleted(ulong)),
       
   168 			this,SLOT(updateView(ulong)));
       
   169 	connect(
       
   170 			mAgendaUtil, SIGNAL(entryUpdated(ulong)),
       
   171 			this, SLOT(updateView(ulong)));
       
   172 	
       
   173 
       
   174 	// Set the graphics size for the icons.
       
   175 	HbListViewItem *prototype = mListView->listItemPrototype();
       
   176 	prototype->setGraphicsSize(HbListViewItem::SmallIcon);
       
   177 	OstTraceFunctionExit0( NOTESNOTEVIEW_SETUPVIEW_EXIT );
       
   178 }
       
   179 
       
   180 /*
       
   181 	Updates the note view either to show notes or emptyListLabel.
       
   182  */
       
   183 void NotesNoteView::updateNoteView()
       
   184 {
       
   185 	OstTraceFunctionEntry0( NOTESNOTEVIEW_UPDATENOTEVIEW_ENTRY );
       
   186 	updateView();
       
   187 	OstTraceFunctionExit0( NOTESNOTEVIEW_UPDATENOTEVIEW_EXIT );
       
   188 }
       
   189 
       
   190 /*!
       
   191 	Opens the note editor to create a new note.
       
   192  */
       
   193 void NotesNoteView::createNewNote()
       
   194 {
       
   195 	OstTraceFunctionEntry0( NOTESNOTEVIEW_CREATENEWNOTE_ENTRY );
       
   196 	// Here we Display an editor to the use to enter text.
       
   197 	mNotesEditor = new NotesEditor(mAgendaUtil, this);
       
   198 	connect(
       
   199 			mNotesEditor, SIGNAL(editingCompleted(bool)),
       
   200 			this, SLOT(handleEditingCompleted(bool)));
       
   201 	mNotesEditor->create(NotesEditor::CreateNote);
       
   202 	OstTraceFunctionExit0( NOTESNOTEVIEW_CREATENEWNOTE_EXIT );
       
   203 }
       
   204 
       
   205 /*!
       
   206 	Handles the pressing of a list item in the view.
       
   207 
       
   208 	Here we open the editor for viewing/editing.
       
   209 
       
   210 	\param index Reference to the QModelIndex representing the view item.
       
   211 	\sa HbAbstractViewItem
       
   212  */
       
   213 void NotesNoteView::handleItemReleased(const QModelIndex &index)
       
   214 {
       
   215 	OstTraceFunctionEntry0( NOTESNOTEVIEW_HANDLEITEMRELEASED_ENTRY );
       
   216 	if(!mIsLongTop) {
       
   217 		// Sanity check.
       
   218 		if (!index.isValid()) {
       
   219 			OstTraceFunctionExit0( NOTESNOTEVIEW_HANDLEITEMRELEASED_EXIT );
       
   220 			return;
       
   221 		}
       
   222 
       
   223 		// First get the id of the note and get the corresponding information
       
   224 		// from agendautil.
       
   225 		ulong noteId = index.data(NotesNamespace::IdRole).value<qulonglong>();
       
   226 
       
   227 		if (0 >= noteId) {
       
   228 			// Something wrong.
       
   229 			OstTraceFunctionExit0( DUP1_NOTESNOTEVIEW_HANDLEITEMRELEASED_EXIT );
       
   230 			return;
       
   231 		}
       
   232 
       
   233 		// Get the entry details.
       
   234 		AgendaEntry entry = mAgendaUtil->fetchById(noteId);
       
   235 
       
   236 		if (entry.isNull()) {
       
   237 			// Entry invalid.
       
   238 			OstTraceFunctionExit0( DUP2_NOTESNOTEVIEW_HANDLEITEMRELEASED_EXIT );
       
   239 			return;
       
   240 		}
       
   241 
       
   242 		// Now launch the editor with the obtained info.
       
   243 		mNotesEditor = new NotesEditor(mAgendaUtil, this);
       
   244 		connect(
       
   245 				mNotesEditor, SIGNAL(editingCompleted(bool)),
       
   246 				this, SLOT(handleEditingCompleted(bool)));
       
   247 		mNotesEditor->edit(entry);
       
   248 	}
       
   249 	OstTraceFunctionExit0( DUP3_NOTESNOTEVIEW_HANDLEITEMRELEASED_EXIT );
       
   250 }
       
   251 
       
   252 /*!
       
   253 	Displays a list item specific context menu.
       
   254 
       
   255 	\param item The HbAbstractViewItem that was long pressed.
       
   256 	\param coords The position where mouse was pressed.
       
   257 
       
   258 	\sa HbAbstractViewItem, HbListView, HbMenu.
       
   259  */
       
   260 void NotesNoteView::handleItemLongPressed(
       
   261 		HbAbstractViewItem *item, const QPointF &coords)
       
   262 {
       
   263 	OstTraceFunctionEntry0( NOTESNOTEVIEW_HANDLEITEMLONGPRESSED_ENTRY );
       
   264 	mSelectedItem = item;
       
   265 	mIsLongTop = true;
       
   266 
       
   267 	ulong noteId = item->modelIndex().data(
       
   268 			NotesNamespace::IdRole).value<qulonglong>();
       
   269 	AgendaEntry entry = mAgendaUtil->fetchById(noteId);
       
   270 
       
   271 	// Display a context specific menu.
       
   272 	HbMenu *contextMenu = new HbMenu();
       
   273 	connect(
       
   274 			contextMenu,SIGNAL(aboutToClose()),
       
   275 			this, SLOT(handleMenuClosed()));
       
   276 
       
   277 	// Add actions to the context menu.
       
   278 	mOpenAction =
       
   279 			contextMenu->addAction(hbTrId("txt_common_menu_open"));
       
   280 
       
   281 	mDeleteAction =
       
   282 			contextMenu->addAction(hbTrId("txt_common_menu_delete"));
       
   283 
       
   284 	if (AgendaEntry::TypeNote == entry.type()) {
       
   285 		if (entry.favourite()) {
       
   286 			mMakeFavouriteAction = contextMenu->addAction(
       
   287 							hbTrId("txt_notes_menu_remove_from_favorites"));
       
   288 		} else {
       
   289 			mMakeFavouriteAction = contextMenu->addAction(
       
   290 							hbTrId("txt_notes_menu_mark_as_favorite"));
       
   291 		}
       
   292 		mMarkTodoAction = contextMenu->addAction(
       
   293 				hbTrId("txt_notes_menu_make_it_as_todo_note"));
       
   294 	}
       
   295 
       
   296 	// Show the menu.
       
   297 	contextMenu->open(this, SLOT(selectedMenuAction(HbAction*)));
       
   298 	contextMenu->setPreferredPos(coords);
       
   299 	OstTraceFunctionExit0( NOTESNOTEVIEW_HANDLEITEMLONGPRESSED_EXIT );
       
   300 }
       
   301 
       
   302 /*!
       
   303 	Slot to delete a selected note.
       
   304  */
       
   305 void NotesNoteView::deleteNote()
       
   306 {
       
   307 	OstTraceFunctionEntry0( NOTESNOTEVIEW_DELETENOTE_ENTRY );
       
   308 	Q_ASSERT(mSelectedItem);
       
   309 
       
   310 	QModelIndex index = mSelectedItem->modelIndex();
       
   311 	if (!index.isValid()) {
       
   312 		OstTraceFunctionExit0( NOTESNOTEVIEW_DELETENOTE_EXIT );
       
   313 		return;
       
   314 	}
       
   315 	ulong noteId =
       
   316 			index.data(NotesNamespace::IdRole).value<qulonglong>();
       
   317 	if (!noteId) {
       
   318 		OstTraceFunctionExit0( DUP1_NOTESNOTEVIEW_DELETENOTE_EXIT );
       
   319 		return;
       
   320 	}
       
   321 	// Emitting the signal , deletion would be handle in view manager.
       
   322 	emit deleteEntry(noteId);
       
   323 
       
   324 	mSelectedItem = 0;
       
   325 	OstTraceFunctionExit0( DUP2_NOTESNOTEVIEW_DELETENOTE_EXIT );
       
   326 }
       
   327 
       
   328 /*!
       
   329     Marks/unmarks the note as favourite.
       
   330  */
       
   331 void NotesNoteView::markNoteAsFavourite()
       
   332 {
       
   333 	OstTraceFunctionEntry0( NOTESNOTEVIEW_MARKNOTEASFAVOURITE_ENTRY );
       
   334 	ulong noteId = mSelectedItem->modelIndex().data(
       
   335 			NotesNamespace::IdRole).value<qulonglong>();
       
   336 	AgendaEntry entry = mAgendaUtil->fetchById(noteId);
       
   337 
       
   338 	if (entry.favourite()) {
       
   339 		entry.setFavourite(0);
       
   340 	} else {
       
   341 		entry.setFavourite(1);
       
   342 	}
       
   343 	mAgendaUtil->store(entry);
       
   344 	OstTraceFunctionExit0( NOTESNOTEVIEW_MARKNOTEASFAVOURITE_EXIT );
       
   345 }
       
   346 
       
   347 /*!
       
   348 	Slot to make a note as to-do.
       
   349  */
       
   350 void NotesNoteView::markNoteAsTodo()
       
   351 {
       
   352 	OstTraceFunctionEntry0( NOTESNOTEVIEW_MARKNOTEASTODO_ENTRY );
       
   353 	Q_ASSERT(mSelectedItem);
       
   354 
       
   355 	QModelIndex index = mSelectedItem->modelIndex();
       
   356 	if (!index.isValid()) {
       
   357 		OstTraceFunctionExit0( NOTESNOTEVIEW_MARKNOTEASTODO_EXIT );
       
   358 		return;
       
   359 	}
       
   360 	ulong noteId =
       
   361 			index.data(NotesNamespace::IdRole).value<qulonglong>();
       
   362 	if (!noteId) {
       
   363 		OstTraceFunctionExit0( DUP1_NOTESNOTEVIEW_MARKNOTEASTODO_EXIT );
       
   364 		return;
       
   365 	}
       
   366 	// Get the entry details.
       
   367 	AgendaEntry entry = mAgendaUtil->fetchById(noteId);
       
   368 
       
   369 	if (entry.isNull()) {
       
   370 		// Entry invalid.
       
   371 		OstTraceFunctionExit0( DUP2_NOTESNOTEVIEW_MARKNOTEASTODO_EXIT );
       
   372 		return;
       
   373 	}
       
   374 
       
   375 	// Here change the type of modified note and destroy the noteeditor and
       
   376 	// construct the to-do editor.
       
   377 	entry.setType(AgendaEntry::TypeTodo);
       
   378 
       
   379 	QDateTime dueDateTime;
       
   380 	QDate currentDate(QDate::currentDate());
       
   381 	dueDateTime.setDate(
       
   382 			QDate(currentDate.year(),currentDate.month(),currentDate.day()+1));
       
   383 	dueDateTime.setTime(QTime::fromString("12:00 am", "hh:mm ap"));
       
   384 
       
   385 	entry.setStartAndEndTime(dueDateTime, dueDateTime);
       
   386 
       
   387 	entry.setSummary(entry.description().left(80));
       
   388 
       
   389 	if (80 > entry.description().length()) {
       
   390 		entry.setDescription("");
       
   391 	}
       
   392 
       
   393 	// Remove favourite if marked so.
       
   394 	entry.setFavourite(0);
       
   395 
       
   396 	// Set the status of the to-do.
       
   397 	entry.setStatus(AgendaEntry::TodoNeedsAction);
       
   398 
       
   399 	// First clone the todoEntry for the new type.
       
   400 	mAgendaUtil->cloneEntry(
       
   401 			entry, AgendaEntry::TypeTodo);
       
   402 
       
   403 	// Delete the old entry.
       
   404 	mAgendaUtil->deleteEntry(entry.id());
       
   405 
       
   406 	// Show the soft notification.
       
   407 	HbNotificationDialog *notificationDialog = new HbNotificationDialog();
       
   408 	notificationDialog->setTimeout(
       
   409 			HbNotificationDialog::ConfirmationNoteTimeout);
       
   410 	notificationDialog->setTitle(
       
   411 			hbTrId("txt_notes_dpopinfo_note_moved_to_todos"));
       
   412 	notificationDialog->show();
       
   413 	OstTraceFunctionExit0( DUP3_NOTESNOTEVIEW_MARKNOTEASTODO_EXIT );
       
   414 }
       
   415 
       
   416 /*!
       
   417 	Slot to handle the signal editingCompleted by the notes editor.
       
   418 
       
   419 	\param status Boolean value indicating whether the note was saved or not.
       
   420 
       
   421 	\sa NotesEditor.
       
   422  */
       
   423 void NotesNoteView::handleEditingCompleted(bool status)
       
   424 {
       
   425 	OstTraceFunctionEntry0( NOTESNOTEVIEW_HANDLEEDITINGCOMPLETED_ENTRY );
       
   426 	Q_UNUSED(status)
       
   427 
       
   428 	// Cleanup.
       
   429 	mNotesEditor->deleteLater();
       
   430 	OstTraceFunctionExit0( NOTESNOTEVIEW_HANDLEEDITINGCOMPLETED_EXIT );
       
   431 }
       
   432 
       
   433 /*!
       
   434 	Directs the view manager to display the Collections view.
       
   435  */
       
   436 void NotesNoteView::displayCollectionView()
       
   437 {
       
   438 	OstTraceFunctionEntry0( NOTESNOTEVIEW_DISPLAYCOLLECTIONVIEW_ENTRY );
       
   439 	// Switch to collections view.
       
   440 	mAppControllerIf->switchToView(NotesNamespace::NotesCollectionViewId);
       
   441 
       
   442 	OstTraceFunctionExit0( NOTESNOTEVIEW_DISPLAYCOLLECTIONVIEW_EXIT );
       
   443 }
       
   444 
       
   445 /*!
       
   446 	Directs the view manager to display the All notes view.
       
   447  */
       
   448 void NotesNoteView::displayAllNotesView()
       
   449 {
       
   450 	OstTraceFunctionEntry0( NOTESNOTEVIEW_DISPLAYALLNOTESVIEW_ENTRY );
       
   451 	// Switch to collections view.
       
   452 	mAppControllerIf->switchToView(NotesNamespace::NotesMainViewId);
       
   453 	OstTraceFunctionExit0( NOTESNOTEVIEW_DISPLAYALLNOTESVIEW_EXIT );
       
   454 }
       
   455 
       
   456 /*!
       
   457 	Slot to handle the case when the state of an action has changed.
       
   458  */
       
   459 void NotesNoteView::handleActionStateChanged()
       
   460 {
       
   461 	OstTraceFunctionEntry0( NOTESNOTEVIEW_HANDLEACTIONSTATECHANGED_ENTRY );
       
   462 	mAllNotesAction->setChecked(true);
       
   463 	OstTraceFunctionExit0( NOTESNOTEVIEW_HANDLEACTIONSTATECHANGED_EXIT );
       
   464 }
       
   465 
       
   466 /*!
       
   467 	Handles the orientation changes.Updates the list
       
   468 	item when orientation is changed
       
   469 
       
   470 	\param orientation Value of the orientation
       
   471  */
       
   472 void NotesNoteView::handleOrientationChanged(Qt::Orientation orientation)
       
   473 {
       
   474 	OstTraceFunctionEntry0( NOTESNOTEVIEW_HANDLEORIENTATIONCHANGED_ENTRY );
       
   475 	HbListViewItem *prototype = mListView->listItemPrototype();
       
   476 
       
   477 	if (Qt::Horizontal == orientation) {
       
   478 		prototype->setStretchingStyle(HbListViewItem::StretchLandscape);
       
   479 	} else {
       
   480 		prototype->setStretchingStyle(HbListViewItem::NoStretching);
       
   481 	}
       
   482 	OstTraceFunctionExit0( NOTESNOTEVIEW_HANDLEORIENTATIONCHANGED_EXIT );
       
   483 }
       
   484 
       
   485 /*
       
   486 	Opens the notes editor to edit the note.
       
   487  */
       
   488 void NotesNoteView::openNote()
       
   489 {
       
   490 	OstTraceFunctionEntry0( NOTESNOTEVIEW_OPENNOTE_ENTRY );
       
   491 	ulong noteId = mSelectedItem->modelIndex().data(
       
   492 			NotesNamespace::IdRole).value<qulonglong>();
       
   493 
       
   494 	AgendaEntry entry = mAgendaUtil->fetchById(noteId);
       
   495 
       
   496 	// Construct notes editor.
       
   497 	mNotesEditor = new NotesEditor(mAgendaUtil, this);
       
   498 	connect(
       
   499 			mNotesEditor, SIGNAL(editingCompleted(bool)),
       
   500 			this, SLOT(handleEditingCompleted(bool)));
       
   501 
       
   502 	// Launch the notes editor with the obtained info.
       
   503 	mNotesEditor->edit(entry);
       
   504 	OstTraceFunctionExit0( NOTESNOTEVIEW_OPENNOTE_EXIT );
       
   505 }
       
   506 
       
   507 /*!
       
   508 	Slot to handle context menu actions.
       
   509  */
       
   510 void NotesNoteView::selectedMenuAction(HbAction *action)
       
   511 {
       
   512 	OstTraceFunctionEntry0( NOTESNOTEVIEW_SELECTEDMENUACTION_ENTRY );
       
   513 	if (action == mOpenAction) {
       
   514 		openNote();
       
   515 	} else if (action == mDeleteAction) {
       
   516 		deleteNote();
       
   517 	} else if (action == mMakeFavouriteAction) {
       
   518 		markNoteAsFavourite();
       
   519 	} else if (action == mMarkTodoAction) {
       
   520 		markNoteAsTodo();
       
   521 	}
       
   522 	OstTraceFunctionExit0( NOTESNOTEVIEW_SELECTEDMENUACTION_EXIT );
       
   523 }
       
   524 
       
   525 /*!
       
   526 	Slot to handle the context menu closed.
       
   527  */
       
   528 void NotesNoteView::handleMenuClosed()
       
   529 {
       
   530 	OstTraceFunctionEntry0( NOTESNOTEVIEW_HANDLEMENUCLOSED_ENTRY );
       
   531 	mIsLongTop = false;
       
   532 	OstTraceFunctionExit0( NOTESNOTEVIEW_HANDLEMENUCLOSED_EXIT );
       
   533 }
       
   534 
       
   535 /*!
       
   536 	Handles the visibility of empty list label.
       
   537  */
       
   538 void NotesNoteView::updateView(ulong id)
       
   539 {
       
   540 	OstTraceFunctionEntry0( NOTESNOTEVIEW_UPDATEVIEW_ENTRY );
       
   541 	Q_UNUSED(id)
       
   542 
       
   543 	// Get the numbers of notes.
       
   544 	if (0 >= mListView->model()->rowCount()) {
       
   545 		mEmptyListLabel->show();
       
   546 		mListView->hide();
       
   547 	} else {
       
   548 		mEmptyListLabel->hide();
       
   549 		mListView->show();
       
   550 	}
       
   551 	OstTraceFunctionExit0( NOTESNOTEVIEW_UPDATEVIEW_EXIT );
       
   552 }
       
   553 
       
   554 // End of file	--Don't remove this.