From dfc0042f5b22bf6aa873b10b25e5b661f1754ecf Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Sun, 19 Mar 2017 20:59:33 +0100 Subject: add firstname and lastname roles to peoplemodel, update ui to display them --- framework/domain/peoplemodel.cpp | 8 +++++++- framework/domain/peoplemodel.h | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'framework') diff --git a/framework/domain/peoplemodel.cpp b/framework/domain/peoplemodel.cpp index 7cc2f3fa..d33c6703 100644 --- a/framework/domain/peoplemodel.cpp +++ b/framework/domain/peoplemodel.cpp @@ -50,7 +50,9 @@ QHash< int, QByteArray > PeopleModel::roleNames() const {Emails, "emails"}, {Addressbook, "addressbook"}, {Type, "type"}, - {DomainObject, "domainObject"} + {DomainObject, "domainObject"}, + {FirstName, "firstName"}, + {LastName, "lastName"} }; return roles; } @@ -70,6 +72,10 @@ QVariant PeopleModel::data(const QModelIndex &idx, int role) const return "contact"; case DomainObject: return QVariant::fromValue(contact); + case FirstName: + return "FIRSTNAME"; + case LastName: + return contact->getFn(); } return QSortFilterProxyModel::data(idx, role); } diff --git a/framework/domain/peoplemodel.h b/framework/domain/peoplemodel.h index 419d59a6..1e9d2d01 100644 --- a/framework/domain/peoplemodel.h +++ b/framework/domain/peoplemodel.h @@ -48,7 +48,9 @@ public: Type, Emails, Addressbook, - DomainObject + DomainObject, + FirstName, + LastName }; QHash roleNames() const Q_DECL_OVERRIDE; -- cgit v1.2.3