Messagelib

messageviewerutil.h
1 /*******************************************************************************
2 **
3 ** Filename : util
4 ** Created on : 03 April, 2005
5 ** SPDX-FileCopyrightText : 2005 Till Adam <[email protected]>
6 **
7 *******************************************************************************/
8 
9 /*******************************************************************************
10 **
11 ** This program is free software; you can redistribute it and/or modify
12 ** it under the terms of the GNU General Public License as published by
13 ** the Free Software Foundation; either version 2 of the License, or
14 ** (at your option) any later version.
15 **
16 ** It is distributed in the hope that it will be useful, but
17 ** WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
20 **
21 ** You should have received a copy of the GNU General Public License
22 ** along with this program; if not, write to the Free Software
23 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 **
25 ** In addition, as a special exception, the copyright holders give
26 ** permission to link the code of this program with any edition of
27 ** the Qt library by Trolltech AS, Norway (or with modified versions
28 ** of Qt that use the same license as Qt), and distribute linked
29 ** combinations including the two. You must obey the GNU General
30 ** Public License in all respects for all of the code used other than
31 ** Qt. If you modify this file, you may extend this exception to
32 ** your version of the file, but you are not obligated to do so. If
33 ** you do not wish to do so, delete this exception statement from
34 ** your version.
35 **
36 *******************************************************************************/
37 #pragma once
38 
39 #include "messageviewer_export.h"
40 #include <Akonadi/Item>
41 #include <KMime/Content>
42 #include <KService>
43 
44 class QUrl;
45 class QWidget;
46 class QActionGroup;
47 class QAction;
48 
49 namespace KMime
50 {
51 class Message;
52 }
53 
54 namespace MessageViewer
55 {
56 /**
57  * The Util namespace contains a collection of helper functions use in
58  * various places.
59  */
60 namespace Util
61 {
62 // return true if we should proceed, false if we should abort
63 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT bool containsExternalReferences(const QString &str, const QString &extraHead);
64 Q_REQUIRED_RESULT bool MESSAGEVIEWER_EXPORT checkOverwrite(const QUrl &url, QWidget *w);
65 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT bool
66 saveMessageInMboxAndGetUrl(QUrl &url, const Akonadi::Item::List &retrievedMsgs, QWidget *parent, bool appendMessages = false);
67 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT bool saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs, QWidget *parent, bool appendMessages = false);
68 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT bool excludeExtraHeader(const QString &s);
69 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT QString generateMboxFileName(const Akonadi::Item &msgBase);
70 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT bool saveAttachments(const KMime::Content::List &contents, QWidget *parent, QList<QUrl> &saveUrl);
71 
72 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT QAction *createAppAction(const KService::Ptr &service, bool singleOffer, QActionGroup *actionGroup, QObject *parent);
73 /** Return a QTextCodec for the specified charset.
74  * This function is a bit more tolerant, than QTextCodec::codecForName */
75 MESSAGEVIEWER_EXPORT const QTextCodec *codecForName(const QByteArray &_str);
76 
77 struct HtmlMessageInfo {
78  QString htmlSource;
79  QString extraHead;
80  QString bodyStyle;
81  Q_REQUIRED_RESULT bool operator==(const HtmlMessageInfo &other) const
82  {
83  return other.htmlSource == htmlSource && other.extraHead == extraHead && other.bodyStyle == bodyStyle;
84  }
85 };
86 
87 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT HtmlMessageInfo processHtml(const QString &htmlSource);
88 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT QByteArray htmlCodec(const QByteArray &data, const QByteArray &currentCodec);
89 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT QString generateFileNameForExtension(const Akonadi::Item &msgBase, const QString &extension);
90 Q_REQUIRED_RESULT MESSAGEVIEWER_EXPORT QString parseBodyStyle(const QString &style);
91 }
92 }
93 Q_DECLARE_TYPEINFO(MessageViewer::Util::HtmlMessageInfo, Q_MOVABLE_TYPE);
94 Q_DECLARE_METATYPE(MessageViewer::Util::HtmlMessageInfo)
95 MESSAGEVIEWER_EXPORT QDebug operator<<(QDebug d, const MessageViewer::Util::HtmlMessageInfo &t);
96 Q_DECLARE_METATYPE(KService::Ptr)
MESSAGEVIEWER_EXPORT bool containsExternalReferences(const QString &str, const QString &extraHead)
Checks whether str contains external references.
KIMAP_EXPORT QTextCodec * codecForName(const QString &name)
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Nov 26 2021 23:16:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.