notes/notesui/notesviews/src/notesfavoriteview.cpp
changeset 50 579cc610882e
parent 26 a949c2543c15
child 58 ef813d54df51
equal deleted inserted replaced
49:5de72ea7a065 50:579cc610882e
   116 			mListView,
   116 			mListView,
   117 			SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)),
   117 			SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)),
   118 			this,
   118 			this,
   119 			SLOT(handleItemLongPressed(HbAbstractViewItem *, const QPointF &)));
   119 			SLOT(handleItemLongPressed(HbAbstractViewItem *, const QPointF &)));
   120 
   120 
       
   121 	// Get the empty list label.
       
   122 	mEmptyListLabel = static_cast<HbLabel *> (
       
   123 			mDocLoader->findWidget("emptyListLabel"));
       
   124 	
   121 	// Get the toolbar/menu actions.
   125 	// Get the toolbar/menu actions.
   122 	mAddNoteAction = static_cast<HbAction *> (
   126 	mAddNoteAction = static_cast<HbAction *> (
   123 			mDocLoader->findObject("newNoteAction"));
   127 			mDocLoader->findObject("newNoteAction"));
   124 	connect(
   128 	connect(
   125 			mAddNoteAction, SIGNAL(triggered()),
   129 			mAddNoteAction, SIGNAL(triggered()),
   131 			mAllNotesAction, SIGNAL(triggered()),
   135 			mAllNotesAction, SIGNAL(triggered()),
   132 			this, SLOT(displayAllNotesView()));
   136 			this, SLOT(displayAllNotesView()));
   133 
   137 
   134 	mViewCollectionAction = static_cast<HbAction *> (
   138 	mViewCollectionAction = static_cast<HbAction *> (
   135 			mDocLoader->findObject("displayCollectionsAction"));
   139 			mDocLoader->findObject("displayCollectionsAction"));
   136 	mViewCollectionAction->setCheckable(true);
   140 
   137 	mViewCollectionAction->setChecked(true);
       
   138 	connect(
   141 	connect(
   139 			mViewCollectionAction, SIGNAL(changed()),
   142 			mViewCollectionAction, SIGNAL(changed()),
   140 			this, SLOT(handleActionStateChanged()));
   143 			this, SLOT(handleActionStateChanged()));
   141 	connect(
   144 	connect(
   142 			mViewCollectionAction, SIGNAL(triggered()),
   145 			mViewCollectionAction, SIGNAL(triggered()),
   147 	handleOrientationChanged(window->orientation());
   150 	handleOrientationChanged(window->orientation());
   148 	connect(
   151 	connect(
   149 			window, SIGNAL(orientationChanged(Qt::Orientation)),
   152 			window, SIGNAL(orientationChanged(Qt::Orientation)),
   150 			this, SLOT(handleOrientationChanged(Qt::Orientation)));
   153 			this, SLOT(handleOrientationChanged(Qt::Orientation)));
   151 
   154 
       
   155 	connect(
       
   156 			mAgendaUtil, SIGNAL(entryAdded(ulong)),
       
   157 			this,SLOT(updateView(ulong)));
       
   158 	connect(
       
   159 			mAgendaUtil, SIGNAL(entryDeleted(ulong)),
       
   160 			this,SLOT(updateView(ulong)));
       
   161 	connect(
       
   162 			mAgendaUtil, SIGNAL(entryUpdated(ulong)),
       
   163 			this, SLOT(updateView(ulong)));
       
   164 	
   152 	// Set the graphics size for the icons.
   165 	// Set the graphics size for the icons.
   153 	HbListViewItem *prototype = mListView->listItemPrototype();
   166 	HbListViewItem *prototype = mListView->listItemPrototype();
   154 	prototype->setGraphicsSize(HbListViewItem::SmallIcon);
   167 	prototype->setGraphicsSize(HbListViewItem::SmallIcon);
       
   168 }
       
   169 
       
   170 /*
       
   171 	Updates the favorite view either to show notes or emptyListLabel.
       
   172  */
       
   173 void NotesFavoriteView::updateFavoriteView()
       
   174 {
       
   175 	updateView();
   155 }
   176 }
   156 
   177 
   157 /*!
   178 /*!
   158 	Slot which gets called when `+ New note' action is triggered from the view
   179 	Slot which gets called when `+ New note' action is triggered from the view
   159 	toolbar. This is responsible for launching the editor to create a new note.
   180 	toolbar. This is responsible for launching the editor to create a new note.
   456  */
   477  */
   457 void NotesFavoriteView::handleMenuClosed()
   478 void NotesFavoriteView::handleMenuClosed()
   458 {
   479 {
   459 	mIsLongTop = false;
   480 	mIsLongTop = false;
   460 }
   481 }
       
   482 
       
   483 /*!
       
   484 	Handles the visibility of empty list label.
       
   485  */
       
   486 void NotesFavoriteView::updateView(ulong id)
       
   487 {
       
   488 	Q_UNUSED(id)
       
   489 
       
   490 	// Get the numbers of favorite notes.
       
   491 	if (0 >= mListView->model()->rowCount()) {
       
   492 		mEmptyListLabel->show();
       
   493 		mListView->hide();
       
   494 	} else {
       
   495 		mEmptyListLabel->hide();
       
   496 		mListView->show();
       
   497 	}
       
   498 }
       
   499 
   461 // End of file	--Don't remove this.
   500 // End of file	--Don't remove this.
   462 
   501