diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/mail/CMakeLists.txt | 1 | ||||
-rw-r--r-- | framework/mail/composer.cpp | 109 | ||||
-rw-r--r-- | framework/mail/composer.h | 71 | ||||
-rw-r--r-- | framework/mail/mailplugin.cpp | 2 |
4 files changed, 183 insertions, 0 deletions
diff --git a/framework/mail/CMakeLists.txt b/framework/mail/CMakeLists.txt index 9957adc3..6616e492 100644 --- a/framework/mail/CMakeLists.txt +++ b/framework/mail/CMakeLists.txt | |||
@@ -9,6 +9,7 @@ set(mailplugin_SRCS | |||
9 | objecttreesource.cpp | 9 | objecttreesource.cpp |
10 | stringhtmlwriter.cpp | 10 | stringhtmlwriter.cpp |
11 | csshelper.cpp | 11 | csshelper.cpp |
12 | composer.cpp | ||
12 | ) | 13 | ) |
13 | add_definitions(-DMAIL_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data") | 14 | add_definitions(-DMAIL_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data") |
14 | 15 | ||
diff --git a/framework/mail/composer.cpp b/framework/mail/composer.cpp new file mode 100644 index 00000000..aa1ec7fc --- /dev/null +++ b/framework/mail/composer.cpp | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This library is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU Library General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to the | ||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
17 | 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | |||
21 | #include "composer.h" | ||
22 | |||
23 | Composer::Composer(QObject *parent) : QObject(parent) | ||
24 | { | ||
25 | |||
26 | } | ||
27 | |||
28 | QString Composer::to() const | ||
29 | { | ||
30 | return m_to; | ||
31 | } | ||
32 | |||
33 | void Composer::setTo(const QString &to) | ||
34 | { | ||
35 | if(m_to != to) { | ||
36 | m_to = to; | ||
37 | emit toChanged(); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | QString Composer::cc() const | ||
42 | { | ||
43 | return m_cc; | ||
44 | } | ||
45 | |||
46 | void Composer::setCc(const QString &cc) | ||
47 | { | ||
48 | if(m_cc != cc) { | ||
49 | m_cc = cc; | ||
50 | emit ccChanged(); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | QString Composer::bcc() const | ||
55 | { | ||
56 | return m_bcc; | ||
57 | } | ||
58 | |||
59 | void Composer::setBcc(const QString &bcc) | ||
60 | { | ||
61 | if(m_bcc != bcc) { | ||
62 | m_bcc = bcc; | ||
63 | emit bccChanged(); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | QString Composer::subject() const | ||
68 | { | ||
69 | return m_subject; | ||
70 | } | ||
71 | |||
72 | void Composer::setSubject(const QString &subject) | ||
73 | { | ||
74 | if(m_subject != subject) { | ||
75 | m_subject = subject; | ||
76 | emit subjectChanged(); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | QString Composer::body() const | ||
81 | { | ||
82 | return m_body; | ||
83 | } | ||
84 | |||
85 | void Composer::setBody(const QString &body) | ||
86 | { | ||
87 | if(m_body != body) { | ||
88 | m_body = body; | ||
89 | emit bodyChanged(); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | void Composer::send() | ||
94 | { | ||
95 | //TODO | ||
96 | clear(); | ||
97 | } | ||
98 | |||
99 | void Composer::saveAsDraft() | ||
100 | { | ||
101 | //TODO | ||
102 | clear(); | ||
103 | } | ||
104 | |||
105 | void Composer::clear() | ||
106 | { | ||
107 | setSubject(""); | ||
108 | setBody(""); | ||
109 | } \ No newline at end of file | ||
diff --git a/framework/mail/composer.h b/framework/mail/composer.h new file mode 100644 index 00000000..a9741f6b --- /dev/null +++ b/framework/mail/composer.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This library is free software; you can redistribute it and/or modify it | ||
5 | under the terms of the GNU Library General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or (at your | ||
7 | option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to the | ||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
17 | 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | #pragma once | ||
21 | |||
22 | #include <QObject> | ||
23 | #include <QString> | ||
24 | |||
25 | |||
26 | class Composer : public QObject | ||
27 | { | ||
28 | Q_OBJECT | ||
29 | Q_PROPERTY (QString to READ to WRITE setTo NOTIFY toChanged) | ||
30 | Q_PROPERTY (QString cc READ cc WRITE setCc NOTIFY ccChanged) | ||
31 | Q_PROPERTY (QString bcc READ bcc WRITE setBcc NOTIFY bccChanged) | ||
32 | Q_PROPERTY (QString subject READ subject WRITE setSubject NOTIFY subjectChanged) | ||
33 | Q_PROPERTY (QString body READ body WRITE setBody NOTIFY bodyChanged) | ||
34 | |||
35 | public: | ||
36 | explicit Composer(QObject *parent = Q_NULLPTR); | ||
37 | |||
38 | QString to() const; | ||
39 | void setTo(const QString &to); | ||
40 | |||
41 | QString cc() const; | ||
42 | void setCc(const QString &cc); | ||
43 | |||
44 | QString bcc() const; | ||
45 | void setBcc(const QString &bcc); | ||
46 | |||
47 | QString subject() const; | ||
48 | void setSubject(const QString &subject); | ||
49 | |||
50 | QString body() const; | ||
51 | void setBody(const QString &body); | ||
52 | |||
53 | signals: | ||
54 | void subjectChanged(); | ||
55 | void bodyChanged(); | ||
56 | void toChanged(); | ||
57 | void ccChanged(); | ||
58 | void bccChanged(); | ||
59 | |||
60 | public slots: | ||
61 | void send(); | ||
62 | void saveAsDraft(); | ||
63 | void clear(); | ||
64 | |||
65 | private: | ||
66 | QString m_to; | ||
67 | QString m_cc; | ||
68 | QString m_bcc; | ||
69 | QString m_subject; | ||
70 | QString m_body; | ||
71 | }; | ||
diff --git a/framework/mail/mailplugin.cpp b/framework/mail/mailplugin.cpp index 8b35dfb7..691d4a15 100644 --- a/framework/mail/mailplugin.cpp +++ b/framework/mail/mailplugin.cpp | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include "maillistmodel.h" | 23 | #include "maillistmodel.h" |
24 | #include "folderlistmodel.h" | 24 | #include "folderlistmodel.h" |
25 | #include "composer.h" | ||
25 | 26 | ||
26 | #include <QtQml> | 27 | #include <QtQml> |
27 | 28 | ||
@@ -31,4 +32,5 @@ void MailPlugin::registerTypes (const char *uri) | |||
31 | 32 | ||
32 | qmlRegisterType<FolderListModel>(uri, 1, 0, "FolderListModel"); | 33 | qmlRegisterType<FolderListModel>(uri, 1, 0, "FolderListModel"); |
33 | qmlRegisterType<MailListModel>(uri, 1, 0, "MailListModel"); | 34 | qmlRegisterType<MailListModel>(uri, 1, 0, "MailListModel"); |
35 | qmlRegisterType<Composer>(uri, 1, 0, "Composer"); | ||
34 | } | 36 | } |