25 #include <HbAbstractViewItem> |
25 #include <HbAbstractViewItem> |
26 #include <HbGroupBox> |
26 #include <HbGroupBox> |
27 #include <HbListViewItem> |
27 #include <HbListViewItem> |
28 #include <HbInstance> |
28 #include <HbInstance> |
29 #include <HbNotificationDialog> |
29 #include <HbNotificationDialog> |
|
30 #include <HbLabel> |
30 |
31 |
31 // User includes |
32 // User includes |
32 #include "notesnoteview.h" |
33 #include "notesnoteview.h" |
33 #include "notescommon.h" |
34 #include "notescommon.h" |
34 #include "notesdocloader.h" |
35 #include "notesdocloader.h" |
97 new NotesSortFilterProxyModel(*mAgendaUtil, this); |
98 new NotesSortFilterProxyModel(*mAgendaUtil, this); |
98 subModel->setDynamicSortFilter(true); |
99 subModel->setDynamicSortFilter(true); |
99 subModel->setSourceModel(mProxyModel); |
100 subModel->setSourceModel(mProxyModel); |
100 |
101 |
101 // Get the list object from the document and update the model. |
102 // Get the list object from the document and update the model. |
102 mListView = static_cast<HbListView *> |
103 mListView = static_cast<HbListView *> ( |
103 (mDocLoader->findWidget("noteListView")); |
104 mDocLoader->findWidget("noteListView")); |
|
105 |
104 // Update the list view model. |
106 // Update the list view model. |
105 mListView->setModel(subModel); |
107 mListView->setModel(subModel); |
106 // Setup the operations that can be done with a list view. |
108 // Setup the operations that can be done with a list view. |
107 connect( |
109 connect( |
108 mListView, SIGNAL(released(const QModelIndex &)), |
110 mListView, SIGNAL(released(const QModelIndex &)), |
111 mListView, |
113 mListView, |
112 SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)), |
114 SIGNAL(longPressed(HbAbstractViewItem *, const QPointF &)), |
113 this, |
115 this, |
114 SLOT(handleItemLongPressed(HbAbstractViewItem *, const QPointF &))); |
116 SLOT(handleItemLongPressed(HbAbstractViewItem *, const QPointF &))); |
115 |
117 |
|
118 // Get the empty list label. |
|
119 mEmptyListLabel = static_cast<HbLabel *> ( |
|
120 mDocLoader->findWidget("emptyListLabel")); |
|
121 |
116 // Get the toolbar/menu actions. |
122 // Get the toolbar/menu actions. |
117 mAddNoteAction = static_cast<HbAction *> ( |
123 mAddNoteAction = static_cast<HbAction *> ( |
118 mDocLoader->findObject("newNoteAction")); |
124 mDocLoader->findObject("newNoteAction")); |
119 connect( |
125 connect( |
120 mAddNoteAction, SIGNAL(triggered()), |
126 mAddNoteAction, SIGNAL(triggered()), |
126 mAllNotesAction, SIGNAL(triggered()), |
132 mAllNotesAction, SIGNAL(triggered()), |
127 this, SLOT(displayAllNotesView())); |
133 this, SLOT(displayAllNotesView())); |
128 |
134 |
129 mViewCollectionAction = static_cast<HbAction *> ( |
135 mViewCollectionAction = static_cast<HbAction *> ( |
130 mDocLoader->findObject("displayCollectionsAction")); |
136 mDocLoader->findObject("displayCollectionsAction")); |
131 mViewCollectionAction->setCheckable(true); |
137 |
132 mViewCollectionAction->setChecked(true); |
|
133 connect( |
138 connect( |
134 mViewCollectionAction, SIGNAL(changed()), |
139 mViewCollectionAction, SIGNAL(changed()), |
135 this, SLOT(handleActionStateChanged())); |
140 this, SLOT(handleActionStateChanged())); |
136 connect( |
141 connect( |
137 mViewCollectionAction, SIGNAL(triggered()), |
142 mViewCollectionAction, SIGNAL(triggered()), |
142 handleOrientationChanged(window->orientation()); |
147 handleOrientationChanged(window->orientation()); |
143 connect( |
148 connect( |
144 window, SIGNAL(orientationChanged(Qt::Orientation)), |
149 window, SIGNAL(orientationChanged(Qt::Orientation)), |
145 this, SLOT(handleOrientationChanged(Qt::Orientation))); |
150 this, SLOT(handleOrientationChanged(Qt::Orientation))); |
146 |
151 |
|
152 |
|
153 connect( |
|
154 mAgendaUtil, SIGNAL(entryAdded(ulong)), |
|
155 this,SLOT(updateView(ulong))); |
|
156 connect( |
|
157 mAgendaUtil, SIGNAL(entryDeleted(ulong)), |
|
158 this,SLOT(updateView(ulong))); |
|
159 connect( |
|
160 mAgendaUtil, SIGNAL(entryUpdated(ulong)), |
|
161 this, SLOT(updateView(ulong))); |
|
162 |
|
163 |
147 // Set the graphics size for the icons. |
164 // Set the graphics size for the icons. |
148 HbListViewItem *prototype = mListView->listItemPrototype(); |
165 HbListViewItem *prototype = mListView->listItemPrototype(); |
149 prototype->setGraphicsSize(HbListViewItem::SmallIcon); |
166 prototype->setGraphicsSize(HbListViewItem::SmallIcon); |
|
167 } |
|
168 |
|
169 /* |
|
170 Updates the note view either to show notes or emptyListLabel. |
|
171 */ |
|
172 void NotesNoteView::updateNoteView() |
|
173 { |
|
174 updateView(); |
150 } |
175 } |
151 |
176 |
152 /*! |
177 /*! |
153 Opens the note editor to create a new note. |
178 Opens the note editor to create a new note. |
154 */ |
179 */ |
455 */ |
480 */ |
456 void NotesNoteView::handleMenuClosed() |
481 void NotesNoteView::handleMenuClosed() |
457 { |
482 { |
458 mIsLongTop = false; |
483 mIsLongTop = false; |
459 } |
484 } |
|
485 |
|
486 /*! |
|
487 Handles the visibility of empty list label. |
|
488 */ |
|
489 void NotesNoteView::updateView(ulong id) |
|
490 { |
|
491 Q_UNUSED(id) |
|
492 |
|
493 // Get the numbers of notes. |
|
494 if (0 >= mListView->model()->rowCount()) { |
|
495 mEmptyListLabel->show(); |
|
496 mListView->hide(); |
|
497 } else { |
|
498 mEmptyListLabel->hide(); |
|
499 mListView->show(); |
|
500 } |
|
501 } |
|
502 |
460 // End of file --Don't remove this. |
503 // End of file --Don't remove this. |
461 |
504 |