--- a/notes/notesui/notesviews/src/notescollectionview.cpp Mon May 03 12:30:32 2010 +0300
+++ b/notes/notesui/notesviews/src/notescollectionview.cpp Mon Jun 28 15:22:02 2010 +0530
@@ -117,9 +117,6 @@
mListView, SIGNAL(activated(const QModelIndex &)),
this, SLOT(handleActivated(const QModelIndex &)));
- // Populate the content of the view.
- populateListView();
-
// Get the toolbar/menu actions.
mAllNotesAction = static_cast<HbAction *> (
mDocLoader->findObject("allNotesAction"));
@@ -158,6 +155,46 @@
}
/*!
+ Populate the content of the view.
+ */
+void NotesCollectionView::populateListView()
+{
+ QStandardItemModel *model = new QStandardItemModel(this);
+ model->setColumnCount(1);
+
+ QString countString(hbTrId("txt_notes_list_note_count"));
+
+ // Add To-do's item.
+ QStandardItem *item = new QStandardItem();
+ QStringList todoStringList;
+ todoStringList.append(hbTrId("txt_notes_list_todos"));
+ todoStringList.append(countString.arg(QString::number(todosCount())));
+ item->setData(todoStringList, Qt::DisplayRole);
+ model->appendRow(item);
+
+ // Add Favorites item.
+ item = new QStandardItem();
+ QStringList favStringList;
+ favStringList.append(hbTrId("txt_notes_list_favorites"));
+ favStringList.append(countString.arg(mFavouriteModel->rowCount()));
+ item->setData(favStringList, Qt::DisplayRole);
+ model->appendRow(item);
+
+ // Add Recent notes item.
+ item = new QStandardItem();
+ QStringList notesStringList;
+ notesStringList.append(hbTrId("txt_notes_list_plain_notes"));
+ notesStringList.append(
+ countString.arg(QString::number(recentNotesCount())));
+ item->setData(notesStringList, Qt::DisplayRole);
+ model->appendRow(item);
+
+ HbStyleLoader::registerFilePath(":/style");
+ mListView->setLayoutName("custom");
+ mListView->setModel(model);
+}
+
+/*!
Displays all notes view.
*/
void NotesCollectionView::displayAllNotesView()
@@ -215,6 +252,8 @@
// Cleanup.
mNotesEditor->deleteLater();
+
+ mAppControllerIf->switchToView(NotesNamespace::NotesMainViewId);
}
/*!
@@ -297,14 +336,18 @@
Q_UNUSED(index)
Q_UNUSED(start)
Q_UNUSED(end)
-
- // Update the count of notes in the view.
- QString countString(hbTrId("txt_notes_list_note_count"));
- QModelIndex mdlIndex = mListView->model()->index(1, 0);
- QStringList favStringList;
- favStringList.append(hbTrId("txt_notes_list_favorites"));
- favStringList.append(countString.arg(mFavouriteModel->rowCount()));
- mListView->model()->setData(mdlIndex, favStringList, Qt::DisplayRole);
+
+ // Check model is set for mListView before update
+ if( mListView->model())
+ {
+ // Update the count of notes in the view.
+ QString countString(hbTrId("txt_notes_list_note_count"));
+ QModelIndex mdlIndex = mListView->model()->index(1, 0);
+ QStringList favStringList;
+ favStringList.append(hbTrId("txt_notes_list_favorites"));
+ favStringList.append(countString.arg(mFavouriteModel->rowCount()));
+ mListView->model()->setData(mdlIndex, favStringList, Qt::DisplayRole);
+ }
}
/*!
@@ -315,46 +358,6 @@
mViewCollectionAction->setChecked(true);
}
-/*!
- Populate the content of the view.
- */
-void NotesCollectionView::populateListView()
-{
- QStandardItemModel *model = new QStandardItemModel(this);
- model->setColumnCount(1);
-
- QString countString(hbTrId("txt_notes_list_note_count"));
-
- // Add To-do's item.
- QStandardItem *item = new QStandardItem();
- QStringList todoStringList;
- todoStringList.append(hbTrId("txt_notes_list_todos"));
- todoStringList.append(countString.arg(QString::number(todosCount())));
- item->setData(todoStringList, Qt::DisplayRole);
- model->appendRow(item);
-
- // Add Favorites item.
- item = new QStandardItem();
- QStringList favStringList;
- favStringList.append(hbTrId("txt_notes_list_favorites"));
- favStringList.append(countString.arg(mFavouriteModel->rowCount()));
- item->setData(favStringList, Qt::DisplayRole);
- model->appendRow(item);
-
- // Add Recent notes item.
- item = new QStandardItem();
- QStringList notesStringList;
- notesStringList.append(hbTrId("txt_notes_list_plain_notes"));
- notesStringList.append(
- countString.arg(QString::number(recentNotesCount())));
- item->setData(notesStringList, Qt::DisplayRole);
- model->appendRow(item);
-
- HbStyleLoader::registerFilePath(":/style");
- mListView->setLayoutName("custom");
- mListView->setModel(model);
-}
-
/*!
Returns the todos count