diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2015-12-06 21:01:20 +0100 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2015-12-06 21:01:20 +0100 |
commit | 5b1025d49af793381ad3ea921e9b03d3326ac979 (patch) | |
tree | f8fe4225053715508d16bf5381c4ca61b1097126 /framework/mail/singlemailcontroller.cpp | |
parent | 055fcb73f17718cf85b8fc6e72231be97d99a619 (diff) | |
download | kube-5b1025d49af793381ad3ea921e9b03d3326ac979.tar.gz kube-5b1025d49af793381ad3ea921e9b03d3326ac979.zip |
add SingleMailController including example
Diffstat (limited to 'framework/mail/singlemailcontroller.cpp')
-rw-r--r-- | framework/mail/singlemailcontroller.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/framework/mail/singlemailcontroller.cpp b/framework/mail/singlemailcontroller.cpp new file mode 100644 index 00000000..68105839 --- /dev/null +++ b/framework/mail/singlemailcontroller.cpp | |||
@@ -0,0 +1,71 @@ | |||
1 | #include "singlemailcontroller.h" | ||
2 | |||
3 | #include <QDebug> | ||
4 | |||
5 | SingleMailController::SingleMailController(QObject *parent): QObject(parent), m_isImportant(false), m_isUnread(true) | ||
6 | { | ||
7 | |||
8 | } | ||
9 | |||
10 | QString SingleMailController::akonadiId() const | ||
11 | { | ||
12 | return m_akonadiId; | ||
13 | } | ||
14 | |||
15 | void SingleMailController::setAkonadiId(const QString &id) | ||
16 | { | ||
17 | if(m_akonadiId != id) { | ||
18 | m_akonadiId = id; | ||
19 | |||
20 | loadMessage(m_akonadiId); | ||
21 | |||
22 | emit akonadiIdChanged(); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | QString SingleMailController::message() const | ||
27 | { | ||
28 | return m_message; | ||
29 | } | ||
30 | |||
31 | bool SingleMailController::isImportant() const | ||
32 | { | ||
33 | return m_isImportant; | ||
34 | } | ||
35 | |||
36 | bool SingleMailController::isUnread() const | ||
37 | { | ||
38 | return m_isUnread; | ||
39 | } | ||
40 | |||
41 | void SingleMailController::deleteMail() | ||
42 | { | ||
43 | qDebug() << "UserAction: deleteMail: " << m_akonadiId; | ||
44 | } | ||
45 | |||
46 | void SingleMailController::markMailImportant(bool important) | ||
47 | { | ||
48 | qDebug() << "UserAction: markMailImportant: " << m_akonadiId; | ||
49 | |||
50 | if (m_isImportant != important) { | ||
51 | m_isImportant = important; | ||
52 | emit isImportantChanged(); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | void SingleMailController::markMailUnread(bool unread) | ||
57 | { | ||
58 | qDebug() << "UserAction: markMailUnread: " << m_akonadiId; | ||
59 | |||
60 | if (m_isUnread != unread) { | ||
61 | m_isUnread = unread; | ||
62 | emit isUnreadChanged(); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | void SingleMailController::loadMessage(const QString &id) | ||
67 | { | ||
68 | //load message from akoandi | ||
69 | m_message = "The message as HTML"; | ||
70 | emit messageChanged(); | ||
71 | } | ||