notes/notesui/notesviews/src/notesnoteview.cpp
changeset 50 579cc610882e
parent 26 a949c2543c15
child 58 ef813d54df51
--- 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 <HbListViewItem>
 #include <HbInstance>
 #include <HbNotificationDialog>
+#include <HbLabel>
 
 // 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<HbListView *>
-	(mDocLoader->findWidget("noteListView"));
+	mListView = static_cast<HbListView *> (
+			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<HbLabel *> (
+			mDocLoader->findWidget("emptyListLabel"));
+
 	// Get the toolbar/menu actions.
 	mAddNoteAction = static_cast<HbAction *> (
 			mDocLoader->findObject("newNoteAction"));
@@ -128,8 +134,7 @@
 
 	mViewCollectionAction = static_cast<HbAction *> (
 			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.