Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'sectionheaders-jb45646' into 'master'
DateAndAccountRole for section headers

See merge request mer-core/libcommhistory!30
  • Loading branch information
Venemo committed May 31, 2019
2 parents d792e65 + bae3116 commit 7f56858
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/eventmodel.cpp
Expand Up @@ -85,6 +85,7 @@ QHash<int, QByteArray> EventModel::roleNames() const
roles[MessagePartsRole] = "messageParts";
roles[SubjectRole] = "subject";
roles[AccountRole] = "account";
roles[DateAndAccountGroupingRole] = "dateAndAccountGrouping";
return roles;
}

Expand Down Expand Up @@ -294,6 +295,10 @@ QVariant EventModel::data(const QModelIndex &index, int role) const
}
return QVariant::fromValue(localUid);
}
case DateAndAccountGroupingRole: {
QString dateString = event.startTime().date().toString("yyyy-MM-dd");
return dateString + QStringLiteral(" ") + event.localUid();
}
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/eventmodel.h
Expand Up @@ -113,6 +113,7 @@ class LIBCOMMHISTORY_EXPORT EventModel: public QAbstractItemModel
MessagePartsRole,
SubjectRole,
AccountRole,
DateAndAccountGroupingRole,
BaseRole = Qt::UserRole + 1000,
};

Expand Down

0 comments on commit 7f56858

Please sign in to comment.