diff -r 5de72ea7a065 -r 579cc610882e notes/notesui/notesviews/src/notesnoteview.cpp --- a/notes/notesui/notesviews/src/notesnoteview.cpp Wed Jun 23 18:11:28 2010 +0300 +++ b/notes/notesui/notesviews/src/notesnoteview.cpp Tue Jul 06 14:14:56 2010 +0300 @@ -27,6 +27,7 @@ #include #include #include +#include // User includes #include "notesnoteview.h" @@ -99,8 +100,9 @@ subModel->setSourceModel(mProxyModel); // Get the list object from the document and update the model. - mListView = static_cast - (mDocLoader->findWidget("noteListView")); + mListView = static_cast ( + mDocLoader->findWidget("noteListView")); + // Update the list view model. mListView->setModel(subModel); // Setup the operations that can be done with a list view. @@ -113,6 +115,10 @@ this, SLOT(handleItemLongPressed(HbAbstractViewItem *, const QPointF &))); + // Get the empty list label. + mEmptyListLabel = static_cast ( + mDocLoader->findWidget("emptyListLabel")); + // Get the toolbar/menu actions. mAddNoteAction = static_cast ( mDocLoader->findObject("newNoteAction")); @@ -128,8 +134,7 @@ mViewCollectionAction = static_cast ( mDocLoader->findObject("displayCollectionsAction")); - mViewCollectionAction->setCheckable(true); - mViewCollectionAction->setChecked(true); + connect( mViewCollectionAction, SIGNAL(changed()), this, SLOT(handleActionStateChanged())); @@ -144,11 +149,31 @@ window, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(handleOrientationChanged(Qt::Orientation))); + + connect( + mAgendaUtil, SIGNAL(entryAdded(ulong)), + this,SLOT(updateView(ulong))); + connect( + mAgendaUtil, SIGNAL(entryDeleted(ulong)), + this,SLOT(updateView(ulong))); + connect( + mAgendaUtil, SIGNAL(entryUpdated(ulong)), + this, SLOT(updateView(ulong))); + + // Set the graphics size for the icons. HbListViewItem *prototype = mListView->listItemPrototype(); prototype->setGraphicsSize(HbListViewItem::SmallIcon); } +/* + Updates the note view either to show notes or emptyListLabel. + */ +void NotesNoteView::updateNoteView() +{ + updateView(); +} + /*! Opens the note editor to create a new note. */ @@ -457,5 +482,23 @@ { mIsLongTop = false; } + +/*! + Handles the visibility of empty list label. + */ +void NotesNoteView::updateView(ulong id) +{ + Q_UNUSED(id) + + // Get the numbers of notes. + if (0 >= mListView->model()->rowCount()) { + mEmptyListLabel->show(); + mListView->hide(); + } else { + mEmptyListLabel->hide(); + mListView->show(); + } +} + // End of file --Don't remove this.