summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mimetreeparser/otp/bodypart.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-23 21:00:50 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-23 21:00:50 +0200
commit31bf3102fe8f8cdd3f1448f0f22f182d0c2820d2 (patch)
treeb5b508c3f065e0f51c8ce40aaf97d7070b5f9ef5 /framework/src/domain/mimetreeparser/otp/bodypart.h
parent1948369d4da2d0bc23b6af93683982b0e65d4992 (diff)
downloadkube-31bf3102fe8f8cdd3f1448f0f22f182d0c2820d2.tar.gz
kube-31bf3102fe8f8cdd3f1448f0f22f182d0c2820d2.zip
Moved MIME related stuff to a mime subdir
Diffstat (limited to 'framework/src/domain/mimetreeparser/otp/bodypart.h')
-rw-r--r--framework/src/domain/mimetreeparser/otp/bodypart.h209
1 files changed, 0 insertions, 209 deletions
diff --git a/framework/src/domain/mimetreeparser/otp/bodypart.h b/framework/src/domain/mimetreeparser/otp/bodypart.h
deleted file mode 100644
index f50c0360..00000000
--- a/framework/src/domain/mimetreeparser/otp/bodypart.h
+++ /dev/null
@@ -1,209 +0,0 @@
1/* -*- mode: C++; c-file-style: "gnu" -*-
2 bodypart.h
3
4 This file is part of KMail's plugin interface.
5 Copyright (c) 2004 Marc Mutz <mutz@kde.org>,
6 Ingo Kloecker <kloecker@kde.org>
7
8 KMail is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 KMail is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
22 In addition, as a special exception, the copyright holders give
23 permission to link the code of this program with any edition of
24 the Qt library by Trolltech AS, Norway (or with modified versions
25 of Qt that use the same license as Qt), and distribute linked
26 combinations including the two. You must obey the GNU General
27 Public License in all respects for all of the code used other than
28 Qt. If you modify this file, you may extend this exception to
29 your version of the file, but you are not obligated to do so. If
30 you do not wish to do so, delete this exception statement from
31 your version.
32*/
33
34#ifndef __MIMETREEPARSER_INTERFACES_BODYPART_H__
35#define __MIMETREEPARSER_INTERFACES_BODYPART_H__
36
37#include <QByteArray>
38#include <QString>
39
40namespace KMime
41{
42class Content;
43}
44
45namespace MimeTreeParser
46{
47class NodeHelper;
48class ObjectTreeParser;
49class ProcessResult;
50
51namespace Interface
52{
53
54class ObjectTreeSource;
55
56/*FIXME(Andras) review, port
57 class Observer;
58 class Observable;
59*/
60/**
61 @short interface of classes that implement status for BodyPartFormatters.
62*/
63class BodyPartMemento
64{
65public:
66 virtual ~BodyPartMemento();
67
68 virtual void detach() = 0;
69#if 0
70//FIXME(Andras) review, port
71 /** If your BodyPartMemento implementation also implements the
72 Observer interface, simply implement these as
73 <code>return this;</code>, else as <code>return
74 0;</code>. This is needed to avoid forcing a dependency of
75 plugins on internal KMail classes.
76 */
77 virtual Observer *asObserver() = 0;
78
79 /** If your BodyPartMemento implementation also implements the
80 Observable interface, simply implement these as
81 <code>return this;</code>, else as <code>return
82 0;</code>. This is needed to avoid forcing a dependency of
83 plugins on internal KMail classes.
84 */
85 virtual Observable *asObservable() = 0;
86#endif
87};
88
89/**
90 @short interface of message body parts.
91*/
92class BodyPart
93{
94public:
95 virtual ~BodyPart();
96
97 /**
98 @return a string respresentation of an URL that can be used
99 to invoke a BodyPartURLHandler for this body part.
100 */
101 virtual QString makeLink(const QString &path) const = 0;
102
103 /**
104 @return the decoded (CTE, canonicalisation, and charset
105 encoding undone) text contained in the body part, or
106 QString(), it the body part is not of type "text".
107 */
108 virtual QString asText() const = 0;
109
110 /**
111 @return the decoded (CTE undone) content of the body part, or
112 a null array if this body part instance is of type text.
113 */
114 virtual QByteArray asBinary() const = 0;
115
116 /**
117 @return the value of the content-type header field parameter
118 with name \a parameter, or QString(), if that that
119 parameter is not present in the body's content-type header
120 field. RFC 2231 encoding is removed first.
121
122 Note that this method will suppress queries to certain
123 standard parameters (most notably "charset") to keep plugins
124 decent.
125
126 Note2 that this method preserves the case of the parameter
127 value returned. So, if the parameter you want to use defines
128 the value to be case-insensitive (such as the smime-type
129 parameter), you need to make sure you do the casemap yourself
130 before comparing to a reference value.
131 */
132 virtual QString contentTypeParameter(const char *parameter) const = 0;
133
134 /**
135 @return the content of the content-description header field,
136 or QString() if that header is not present in this body
137 part. RFC 2047 encoding is decoded first.
138 */
139 virtual QString contentDescription() const = 0;
140
141 //virtual int contentDisposition() const = 0;
142 /**
143 @return the value of the content-disposition header field
144 parameter with name \a parameter, or QString() if that
145 parameter is not present in the body's content-disposition
146 header field. RFC 2231 encoding is removed first.
147
148 The notes made for contentTypeParameter() above apply here as
149 well.
150 */
151 virtual QString contentDispositionParameter(const char *parameter) const = 0;
152
153 /**
154 @return whether this part already has it's complete body
155 fetched e.g. from an IMAP server.
156 */
157 virtual bool hasCompleteBody() const = 0;
158
159 /**
160 @return the BodyPartMemento set for this part, or null, if
161 none is set.
162 */
163 virtual BodyPartMemento *memento() const = 0;
164
165 /**
166 @return register an implementation of the BodyPartMemento
167 interface as a status object with this part.
168 */
169 virtual void setBodyPartMemento(BodyPartMemento *) = 0;
170
171 enum Display { None, AsIcon, Inline };
172 /**
173 @return whether this body part should be displayed iconic or inline
174 */
175 virtual Display defaultDisplay() const = 0;
176
177 /** Returns the KMime::Content node represented here. Makes most of the above obsolete
178 and probably should be used in the interfaces in the first place.
179 */
180 virtual KMime::Content *content() const = 0;
181
182 /**
183 * Returns the top-level content.
184 * Note that this is _not_ necessarily the same as content()->topLevel(), for example the later
185 * will not work for "extra nodes", i.e. nodes in encrypted parts of the mail.
186 * topLevelContent() will return the correct result in this case. Also note that
187 * topLevelContent()
188 */
189 virtual KMime::Content *topLevelContent() const = 0;
190
191 /**
192 * Ok, this is ugly, exposing the node helper here, but there is too much useful stuff in there
193 * for real-world plugins. Still, there should be a nicer way for this.
194 */
195 virtual MimeTreeParser::NodeHelper *nodeHelper() const = 0;
196
197 /**
198 * For making it easier to refactor, add objectTreeParser
199 */
200 virtual MimeTreeParser::ObjectTreeParser *objectTreeParser() const = 0;
201 virtual MimeTreeParser::Interface::ObjectTreeSource *source() const = 0;
202 virtual MimeTreeParser::ProcessResult *processResult() const = 0;
203};
204
205} // namespace Interface
206
207}
208
209#endif // __MIMETREEPARSER_INTERFACES_BODYPART_H__