diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-18 13:08:59 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-18 13:08:59 +0100 |
commit | 3af80d6bce96009a66cebb0650f1f20cf4ef1be7 (patch) | |
tree | 340a0846dd44b7ec25748f0807403e66ff30dadb /framework/mail/maillistmodel.cpp | |
parent | ba6ef2c4e782f542c6a23b357f90030e930606da (diff) | |
download | kube-3af80d6bce96009a66cebb0650f1f20cf4ef1be7.tar.gz kube-3af80d6bce96009a66cebb0650f1f20cf4ef1be7.zip |
Load the full mime message in the viewer as well.
Diffstat (limited to 'framework/mail/maillistmodel.cpp')
-rw-r--r-- | framework/mail/maillistmodel.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/framework/mail/maillistmodel.cpp b/framework/mail/maillistmodel.cpp index 2b2d2aeb..d1ad99db 100644 --- a/framework/mail/maillistmodel.cpp +++ b/framework/mail/maillistmodel.cpp | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "maillistmodel.h" | 1 | #include "maillistmodel.h" |
2 | 2 | ||
3 | #include <QFile> | ||
4 | |||
3 | MailListModel::MailListModel(QObject *parent) | 5 | MailListModel::MailListModel(QObject *parent) |
4 | : QIdentityProxyModel() | 6 | : QIdentityProxyModel() |
5 | { | 7 | { |
@@ -22,6 +24,7 @@ QHash< int, QByteArray > MailListModel::roleNames() const | |||
22 | roles[Unread] = "unread"; | 24 | roles[Unread] = "unread"; |
23 | roles[Important] = "important"; | 25 | roles[Important] = "important"; |
24 | roles[Id] = "id"; | 26 | roles[Id] = "id"; |
27 | roles[MimeMessage] = "mimeMessage"; | ||
25 | 28 | ||
26 | return roles; | 29 | return roles; |
27 | } | 30 | } |
@@ -44,6 +47,17 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const | |||
44 | return srcIdx.sibling(srcIdx.row(), 5).data(Qt::DisplayRole).toString(); | 47 | return srcIdx.sibling(srcIdx.row(), 5).data(Qt::DisplayRole).toString(); |
45 | case Id: | 48 | case Id: |
46 | return srcIdx.data(Akonadi2::Store::DomainObjectBaseRole).value<Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr>()->identifier(); | 49 | return srcIdx.data(Akonadi2::Store::DomainObjectBaseRole).value<Akonadi2::ApplicationDomain::ApplicationDomainType::Ptr>()->identifier(); |
50 | case MimeMessage: { | ||
51 | auto filename = srcIdx.sibling(srcIdx.row(), 6).data(Qt::DisplayRole).toString(); | ||
52 | QFile file(filename); | ||
53 | if (file.open(QFile::ReadOnly)) { | ||
54 | auto content = file.readAll(); | ||
55 | return content; | ||
56 | } else { | ||
57 | qWarning() << "Failed to open the file"; | ||
58 | } | ||
59 | return "Failed to read mail."; | ||
60 | } | ||
47 | } | 61 | } |
48 | return QIdentityProxyModel::data(idx, role); | 62 | return QIdentityProxyModel::data(idx, role); |
49 | } | 63 | } |