Skip to content

Commit

Permalink
[nemo-qml-plugin-calendar] Don't cache role names
Browse files Browse the repository at this point in the history
  • Loading branch information
pvuorela committed Feb 3, 2014
1 parent 9bf6b75 commit 6d2fa4d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/calendaragendamodel.cpp
Expand Up @@ -44,10 +44,6 @@
NemoCalendarAgendaModel::NemoCalendarAgendaModel(QObject *parent)
: QAbstractListModel(parent), mIsComplete(true)
{
mRoleNames[EventObjectRole] = "event";
mRoleNames[OccurrenceObjectRole] = "occurrence";
mRoleNames[SectionBucketRole] = "sectionBucket";

connect(NemoCalendarEventCache::instance(), SIGNAL(modelReset()), this, SLOT(refresh()));
}

Expand All @@ -59,7 +55,11 @@ NemoCalendarAgendaModel::~NemoCalendarAgendaModel()

QHash<int, QByteArray> NemoCalendarAgendaModel::roleNames() const
{
return mRoleNames;
QHash<int,QByteArray> roleNames;
roleNames[EventObjectRole] = "event";
roleNames[OccurrenceObjectRole] = "occurrence";
roleNames[SectionBucketRole] = "sectionBucket";
return roleNames;
}

QDate NemoCalendarAgendaModel::startDate() const
Expand Down
1 change: 0 additions & 1 deletion src/calendaragendamodel.h
Expand Up @@ -90,7 +90,6 @@ private slots:
QDate mStartDate;
QDate mEndDate;
QList<NemoCalendarEventOccurrence *> mEvents;
QHash<int,QByteArray> mRoleNames;

bool mIsComplete:1;
};
Expand Down
18 changes: 10 additions & 8 deletions src/calendarnotebookmodel.cpp
Expand Up @@ -37,13 +37,6 @@

NemoCalendarNotebookModel::NemoCalendarNotebookModel()
{
mRoleNames[NameRole] = "name";
mRoleNames[UidRole] = "uid";
mRoleNames[DescriptionRole] = "description";
mRoleNames[ColorRole] = "color";
mRoleNames[DefaultRole] = "isDefault";
mRoleNames[ReadOnlyRole] = "readOnly";
mRoleNames[LocalCalendarRole] = "localCalendar";
}

int NemoCalendarNotebookModel::rowCount(const QModelIndex &index) const
Expand Down Expand Up @@ -103,5 +96,14 @@ bool NemoCalendarNotebookModel::setData(const QModelIndex &index, const QVariant

QHash<int, QByteArray> NemoCalendarNotebookModel::roleNames() const
{
return mRoleNames;
QHash<int, QByteArray> roleNames;
roleNames[NameRole] = "name";
roleNames[UidRole] = "uid";
roleNames[DescriptionRole] = "description";
roleNames[ColorRole] = "color";
roleNames[DefaultRole] = "isDefault";
roleNames[ReadOnlyRole] = "readOnly";
roleNames[LocalCalendarRole] = "localCalendar";

return roleNames;
}
3 changes: 0 additions & 3 deletions src/calendarnotebookmodel.h
Expand Up @@ -57,9 +57,6 @@ class NemoCalendarNotebookModel : public QAbstractListModel

protected:
virtual QHash<int, QByteArray> roleNames() const;

private:
QHash<int, QByteArray> mRoleNames;
};

#endif // CALENDARNOTEBOOKMODEL_H

0 comments on commit 6d2fa4d

Please sign in to comment.