diff options
Diffstat (limited to 'framework/mail/filehtmlwriter.cpp')
-rw-r--r-- | framework/mail/filehtmlwriter.cpp | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/framework/mail/filehtmlwriter.cpp b/framework/mail/filehtmlwriter.cpp deleted file mode 100644 index e435e1be..00000000 --- a/framework/mail/filehtmlwriter.cpp +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | /* -*- c++ -*- | ||
2 | filehtmlwriter.cpp | ||
3 | |||
4 | This file is part of KMail, the KDE mail client. | ||
5 | Copyright (c) 2003 Marc Mutz <mutz@kde.org> | ||
6 | |||
7 | KMail is free software; you can redistribute it and/or modify it | ||
8 | under the terms of the GNU General Public License, version 2, as | ||
9 | published by the Free Software Foundation. | ||
10 | |||
11 | KMail is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | |||
20 | In addition, as a special exception, the copyright holders give | ||
21 | permission to link the code of this program with any edition of | ||
22 | the Qt library by Trolltech AS, Norway (or with modified versions | ||
23 | of Qt that use the same license as Qt), and distribute linked | ||
24 | combinations including the two. You must obey the GNU General | ||
25 | Public License in all respects for all of the code used other than | ||
26 | Qt. If you modify this file, you may extend this exception to | ||
27 | your version of the file, but you are not obligated to do so. If | ||
28 | you do not wish to do so, delete this exception statement from | ||
29 | your version. | ||
30 | */ | ||
31 | |||
32 | #include "filehtmlwriter.h" | ||
33 | |||
34 | #include <QTextStream> | ||
35 | |||
36 | FileHtmlWriter::FileHtmlWriter(const QString &filename) | ||
37 | : MessageViewer::HtmlWriter(), | ||
38 | mFile(filename.isEmpty() ? QStringLiteral("filehtmlwriter.out") : filename) | ||
39 | { | ||
40 | mStream.setCodec("UTF-8"); | ||
41 | } | ||
42 | |||
43 | FileHtmlWriter::~FileHtmlWriter() | ||
44 | { | ||
45 | if (mFile.isOpen()) { | ||
46 | mStream.setDevice(0); | ||
47 | mFile.close(); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | void FileHtmlWriter::begin(const QString &css) | ||
52 | { | ||
53 | openOrWarn(); | ||
54 | if (!css.isEmpty()) { | ||
55 | write(QLatin1String("<!-- CSS Definitions \n") + css + QLatin1String("-->\n")); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | void FileHtmlWriter::end() | ||
60 | { | ||
61 | flush(); | ||
62 | mStream.setDevice(0); | ||
63 | mFile.close(); | ||
64 | } | ||
65 | |||
66 | void FileHtmlWriter::reset() | ||
67 | { | ||
68 | if (mFile.isOpen()) { | ||
69 | mStream.setDevice(0); | ||
70 | mFile.close(); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | void FileHtmlWriter::write(const QString &str) | ||
75 | { | ||
76 | mStream << str.toUtf8(); | ||
77 | flush(); | ||
78 | } | ||
79 | |||
80 | void FileHtmlWriter::queue(const QString &str) | ||
81 | { | ||
82 | write(str); | ||
83 | } | ||
84 | |||
85 | void FileHtmlWriter::flush() | ||
86 | { | ||
87 | mStream.flush(); | ||
88 | mFile.flush(); | ||
89 | } | ||
90 | |||
91 | void FileHtmlWriter::openOrWarn() | ||
92 | { | ||
93 | if (mFile.isOpen()) { | ||
94 | mStream.setDevice(0); | ||
95 | mFile.close(); | ||
96 | } | ||
97 | if (!mFile.open(QIODevice::WriteOnly)) { | ||
98 | } else { | ||
99 | mStream.setDevice(&mFile); | ||
100 | } | ||
101 | } | ||
102 | |||
103 | void FileHtmlWriter::embedPart(const QByteArray &contentId, const QString &url) | ||
104 | { | ||
105 | mStream << "<!-- embedPart(contentID=" << contentId << ", url=" << url << ") -->" << endl; | ||
106 | flush(); | ||
107 | } | ||
108 | void FileHtmlWriter::extraHead(const QString &) | ||
109 | { | ||
110 | |||
111 | } \ No newline at end of file | ||