summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mimetreeparser/otp/bodypartformatter.h
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/mimetreeparser/otp/bodypartformatter.h')
-rw-r--r--framework/src/domain/mimetreeparser/otp/bodypartformatter.h149
1 files changed, 0 insertions, 149 deletions
diff --git a/framework/src/domain/mimetreeparser/otp/bodypartformatter.h b/framework/src/domain/mimetreeparser/otp/bodypartformatter.h
deleted file mode 100644
index 0116c2e4..00000000
--- a/framework/src/domain/mimetreeparser/otp/bodypartformatter.h
+++ /dev/null
@@ -1,149 +0,0 @@
1/* -*- mode: C++; c-file-style: "gnu" -*-
2 bodypartformatter.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_INTERFACE_BODYPARTFORMATTER_H__
35#define __MIMETREEPARSER_INTERFACE_BODYPARTFORMATTER_H__
36
37#include <QObject>
38#include <QSharedPointer>
39
40#include "objecttreeparser.h"
41
42namespace MimeTreeParser
43{
44class HtmlWriter;
45
46namespace Interface
47{
48
49class BodyPartURLHandler;
50class BodyPart;
51class MessagePartPrivate;
52
53class MessagePart : public QObject
54{
55 Q_OBJECT
56 Q_PROPERTY(QString plaintextContent READ plaintextContent)
57 Q_PROPERTY(QString htmlContent READ htmlContent)
58public:
59 typedef QSharedPointer<MessagePart> Ptr;
60 explicit MessagePart();
61 explicit MessagePart(const BodyPart &part);
62 virtual ~MessagePart();
63
64 virtual void html(bool decorate);
65 virtual QString text() const;
66
67 void setParentPart(MessagePart *parentPart);
68 MessagePart *parentPart() const;
69
70 virtual QString plaintextContent() const;
71 virtual QString htmlContent() const;
72
73 virtual MimeTreeParser::HtmlWriter *htmlWriter() const;
74 virtual void setHtmlWriter(MimeTreeParser::HtmlWriter *htmlWriter) const;
75private:
76 MessagePartPrivate *d;
77
78 friend class BodyPartFormatter;
79};
80
81class BodyPartFormatter
82{
83public:
84 virtual ~BodyPartFormatter() {}
85
86 /**
87 @li Ok returned when format() generated some HTML
88 @li NeedContent returned when format() needs the body of the part
89 @li AsIcon returned when the part should be shown iconified
90 @li Failed returned when formatting failed. Currently equivalent to Ok
91 */
92 enum Result { Ok, NeedContent, AsIcon, Failed };
93
94 /**
95 Format body part \a part by generating some HTML and writing
96 that to \a writer.
97
98 @return the result code (see above)
99 */
100 virtual Result format(BodyPart *part, MimeTreeParser::HtmlWriter *writer) const = 0;
101
102 /**
103 Variant of format that allows implementors to hook notifications up to
104 a listener interested in the result, for async operations.
105
106 @return the result code (see above)
107 */
108 virtual Result format(BodyPart *part, MimeTreeParser::HtmlWriter *writer, QObject *asyncResultObserver) const
109 {
110 Q_UNUSED(asyncResultObserver);
111 return format(part, writer);
112 }
113
114 virtual void adaptProcessResult(ProcessResult &result) const
115 {
116 Q_UNUSED(result);
117 }
118 virtual MessagePart::Ptr process(BodyPart &part) const;
119};
120
121/**
122 @short interface for BodyPartFormatter plugins
123
124 The interface is queried by for types, subtypes, and the
125 corresponding bodypart formatter, and the result inserted into
126 the bodypart formatter factory.
127
128 Subtype alone or both type and subtype may be "*", which is
129 taken as a wildcard, so that e.g. type=text subtype=* matches
130 any text subtype, but with lesser specificity than a concrete
131 mimetype such as text/plain. type=* is only allowed when
132 subtype=*, too.
133*/
134class BodyPartFormatterPlugin
135{
136public:
137 virtual ~BodyPartFormatterPlugin() {}
138
139 virtual const BodyPartFormatter *bodyPartFormatter(int idx) const = 0;
140 virtual const char *type(int idx) const = 0;
141 virtual const char *subtype(int idx) const = 0;
142
143 virtual const BodyPartURLHandler *urlHandler(int idx) const = 0;
144};
145
146} // namespace Interface
147
148}
149#endif // __MIMETREEPARSER_INTERFACE_BODYPARTFORMATTER_H__