From e3a4d869cf0cc12a61f2b4faee44ab1d9751cca8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 27 Jun 2017 21:46:49 +0200 Subject: Show Avatar images --- framework/src/domain/contactcontroller.cpp | 1 + framework/src/domain/contactcontroller.h | 1 + framework/src/domain/peoplemodel.cpp | 6 +++++- framework/src/domain/peoplemodel.h | 3 ++- 4 files changed, 9 insertions(+), 2 deletions(-) (limited to 'framework/src/domain') diff --git a/framework/src/domain/contactcontroller.cpp b/framework/src/domain/contactcontroller.cpp index 90ef6323..bc536bf6 100644 --- a/framework/src/domain/contactcontroller.cpp +++ b/framework/src/domain/contactcontroller.cpp @@ -59,6 +59,7 @@ void ContactController::loadContact(const QVariant &contact) } setCompany(addressee.organization()); setJobTitle(addressee.role()); + setImageData(addressee.photo().rawData()); } } diff --git a/framework/src/domain/contactcontroller.h b/framework/src/domain/contactcontroller.h index fea42430..72d8eee1 100644 --- a/framework/src/domain/contactcontroller.h +++ b/framework/src/domain/contactcontroller.h @@ -41,6 +41,7 @@ class ContactController : public Kube::Controller KUBE_CONTROLLER_PROPERTY(QString, Country, country) KUBE_CONTROLLER_PROPERTY(QString, Company, company) KUBE_CONTROLLER_PROPERTY(QString, JobTitle, jobTitle) + KUBE_CONTROLLER_PROPERTY(QByteArray, ImageData, imageData) KUBE_CONTROLLER_ACTION(save) diff --git a/framework/src/domain/peoplemodel.cpp b/framework/src/domain/peoplemodel.cpp index c9e7248c..099c680a 100644 --- a/framework/src/domain/peoplemodel.cpp +++ b/framework/src/domain/peoplemodel.cpp @@ -38,6 +38,7 @@ PeopleModel::PeopleModel(QObject *parent) query.request(); query.request(); query.request(); + query.request(); runQuery(query); } @@ -65,7 +66,8 @@ QHash< int, QByteArray > PeopleModel::roleNames() const {Type, "type"}, {DomainObject, "domainObject"}, {FirstName, "firstName"}, - {LastName, "lastName"} + {LastName, "lastName"}, + {ImageData, "imageData"} }; return roles; } @@ -96,6 +98,8 @@ QVariant PeopleModel::data(const QModelIndex &idx, int role) const return contact->getFirstname(); case LastName: return contact->getLastname(); + case ImageData: + return contact->getPhoto(); } return QSortFilterProxyModel::data(idx, role); } diff --git a/framework/src/domain/peoplemodel.h b/framework/src/domain/peoplemodel.h index a59e752c..69d07417 100644 --- a/framework/src/domain/peoplemodel.h +++ b/framework/src/domain/peoplemodel.h @@ -51,7 +51,8 @@ public: Addressbook, DomainObject, FirstName, - LastName + LastName, + ImageData }; QHash roleNames() const Q_DECL_OVERRIDE; -- cgit v1.2.3