diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-23 21:00:50 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-05-23 21:00:50 +0200 |
commit | 31bf3102fe8f8cdd3f1448f0f22f182d0c2820d2 (patch) | |
tree | b5b508c3f065e0f51c8ce40aaf97d7070b5f9ef5 /framework/src/domain/mime/messageparser.cpp | |
parent | 1948369d4da2d0bc23b6af93683982b0e65d4992 (diff) | |
download | kube-31bf3102fe8f8cdd3f1448f0f22f182d0c2820d2.tar.gz kube-31bf3102fe8f8cdd3f1448f0f22f182d0c2820d2.zip |
Moved MIME related stuff to a mime subdir
Diffstat (limited to 'framework/src/domain/mime/messageparser.cpp')
-rw-r--r-- | framework/src/domain/mime/messageparser.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/framework/src/domain/mime/messageparser.cpp b/framework/src/domain/mime/messageparser.cpp new file mode 100644 index 00000000..76c060f0 --- /dev/null +++ b/framework/src/domain/mime/messageparser.cpp | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com> | ||
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 | #include "messageparser.h" | ||
20 | |||
21 | #include "modeltest.h" | ||
22 | #include "mimetreeparser/interface.h" | ||
23 | |||
24 | #include <QDebug> | ||
25 | |||
26 | class MessagePartPrivate | ||
27 | { | ||
28 | public: | ||
29 | std::shared_ptr<Parser> mParser; | ||
30 | }; | ||
31 | |||
32 | MessageParser::MessageParser(QObject *parent) | ||
33 | : QObject(parent) | ||
34 | , d(std::unique_ptr<MessagePartPrivate>(new MessagePartPrivate)) | ||
35 | { | ||
36 | |||
37 | } | ||
38 | |||
39 | MessageParser::~MessageParser() | ||
40 | { | ||
41 | |||
42 | } | ||
43 | |||
44 | QVariant MessageParser::message() const | ||
45 | { | ||
46 | return QVariant(); | ||
47 | } | ||
48 | |||
49 | void MessageParser::setMessage(const QVariant &message) | ||
50 | { | ||
51 | d->mParser = std::shared_ptr<Parser>(new Parser(message.toByteArray())); | ||
52 | emit htmlChanged(); | ||
53 | } | ||
54 | |||
55 | QAbstractItemModel *MessageParser::newTree() const | ||
56 | { | ||
57 | if (!d->mParser) { | ||
58 | return nullptr; | ||
59 | } | ||
60 | const auto model = new NewModel(d->mParser); | ||
61 | // new ModelTest(model, model); | ||
62 | return model; | ||
63 | } | ||
64 | |||
65 | QAbstractItemModel *MessageParser::attachments() const | ||
66 | { | ||
67 | if (!d->mParser) { | ||
68 | return nullptr; | ||
69 | } | ||
70 | const auto model = new AttachmentModel(d->mParser); | ||
71 | // new ModelTest(model, model); | ||
72 | return model; | ||
73 | } | ||