summaryrefslogtreecommitdiffstats
path: root/framework/mail
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-08 14:14:15 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-12-08 14:14:15 +0100
commit394d3d9803c101014fb7f521155b0a9ed6809454 (patch)
tree7ef3dd33192c0a4ee299581ec41a9f94fac21cca /framework/mail
parentcdb9f957d24ebb255c3eb6b6034da9a8a403f65c (diff)
downloadkube-394d3d9803c101014fb7f521155b0a9ed6809454.tar.gz
kube-394d3d9803c101014fb7f521155b0a9ed6809454.zip
Fixed mapping to result model
The result model exposes the different properties as columns
Diffstat (limited to 'framework/mail')
-rw-r--r--framework/mail/folderlistmodel.cpp7
-rw-r--r--framework/mail/maillistmodel.cpp23
2 files changed, 16 insertions, 14 deletions
diff --git a/framework/mail/folderlistmodel.cpp b/framework/mail/folderlistmodel.cpp
index 8c513b64..b0969060 100644
--- a/framework/mail/folderlistmodel.cpp
+++ b/framework/mail/folderlistmodel.cpp
@@ -29,11 +29,12 @@ QHash< int, QByteArray > FolderListModel::roleNames() const
29 29
30QVariant FolderListModel::data(const QModelIndex &idx, int role) const 30QVariant FolderListModel::data(const QModelIndex &idx, int role) const
31{ 31{
32 auto srcIdx = mapToSource(idx);
32 switch (role) { 33 switch (role) {
33 case Name: 34 case Name:
34 return mapToSource(idx).data(Qt::DisplayRole).toString(); 35 return srcIdx.sibling(srcIdx.row(), 0).data(Qt::DisplayRole).toString();
35 case Icon: 36 case Icon:
36 return mapToSource(idx).data(Qt::DisplayRole).toString(); 37 return srcIdx.sibling(srcIdx.row(), 1).data(Qt::DisplayRole).toString();
37 } 38 }
38 return QIdentityProxyModel::data(idx, role); 39 return QIdentityProxyModel::data(idx, role);
39} 40}
diff --git a/framework/mail/maillistmodel.cpp b/framework/mail/maillistmodel.cpp
index 06670e09..baa11bc3 100644
--- a/framework/mail/maillistmodel.cpp
+++ b/framework/mail/maillistmodel.cpp
@@ -35,19 +35,20 @@ QHash< int, QByteArray > MailListModel::roleNames() const
35 35
36QVariant MailListModel::data(const QModelIndex &idx, int role) const 36QVariant MailListModel::data(const QModelIndex &idx, int role) const
37{ 37{
38 auto srcIdx = mapToSource(idx);
38 switch (role) { 39 switch (role) {
39 case Subject: 40 case Subject:
40 return mapToSource(idx).data(Qt::DisplayRole).toString(); 41 return srcIdx.sibling(srcIdx.row(), 0).data(Qt::DisplayRole).toString();
41 case Sender: 42 case Sender:
42 return mapToSource(idx).data(Qt::DisplayRole).toString(); 43 return srcIdx.sibling(srcIdx.row(), 1).data(Qt::DisplayRole).toString();
43 case SenderName: 44 case SenderName:
44 return mapToSource(idx).data(Qt::DisplayRole).toString(); 45 return srcIdx.sibling(srcIdx.row(), 2).data(Qt::DisplayRole).toString();
45 case Date: 46 case Date:
46 return mapToSource(idx).data(Qt::DisplayRole).toString(); 47 return srcIdx.sibling(srcIdx.row(), 3).data(Qt::DisplayRole).toString();
47 case Unread: 48 case Unread:
48 return mapToSource(idx).data(Qt::DisplayRole).toString(); 49 return srcIdx.sibling(srcIdx.row(), 4).data(Qt::DisplayRole).toString();
49 case Important: 50 case Important:
50 return mapToSource(idx).data(Qt::DisplayRole).toString(); 51 return srcIdx.sibling(srcIdx.row(), 5).data(Qt::DisplayRole).toString();
51 } 52 }
52 return QIdentityProxyModel::data(idx, role); 53 return QIdentityProxyModel::data(idx, role);
53} 54}