Skip to content

Commit

Permalink
Begin model reset before notebook model is invalidated
Browse files Browse the repository at this point in the history
  • Loading branch information
Petri M. Gerdt committed Apr 29, 2014
1 parent e18284a commit f7d9645
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/calendarnotebookmodel.cpp
Expand Up @@ -39,6 +39,8 @@ NemoCalendarNotebookModel::NemoCalendarNotebookModel()
{
connect(NemoCalendarManager::instance(), SIGNAL(notebooksChanged(QList<NemoCalendarData::Notebook>)),
this, SLOT(notebooksChanged()));
connect(NemoCalendarManager::instance(), SIGNAL(notebooksAboutToChange()),
this, SLOT(notebooksAboutToChange()));
}

int NemoCalendarNotebookModel::rowCount(const QModelIndex &index) const
Expand Down Expand Up @@ -102,9 +104,13 @@ bool NemoCalendarNotebookModel::setData(const QModelIndex &index, const QVariant
return true;
}

void NemoCalendarNotebookModel::notebooksChanged()
void NemoCalendarNotebookModel::notebooksAboutToChange()
{
beginResetModel();
}

void NemoCalendarNotebookModel::notebooksChanged()
{
endResetModel();
}

Expand Down
1 change: 1 addition & 0 deletions src/calendarnotebookmodel.h
Expand Up @@ -56,6 +56,7 @@ class NemoCalendarNotebookModel : public QAbstractListModel
virtual bool setData(const QModelIndex &index, const QVariant &, int role);

public slots:
void notebooksAboutToChange();
void notebooksChanged();

protected:
Expand Down

0 comments on commit f7d9645

Please sign in to comment.