Waste less space in nested layouts.
[kdepim.git] / messagecomposer / util.h
blobc6dc6ab84079c081e1d24a842ea6e1031541cd56
1 /*
2 Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
3 Copyright (C) 2009 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
4 Copyright (c) 2009 Leo Franchi <lfranchi@kde.org>
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Library General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at your
9 option) any later version.
11 This library is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301, USA.
22 #ifndef MESSAGECOMPOSER_UTIL_H
23 #define MESSAGECOMPOSER_UTIL_H
25 #include "messagecomposer_export.h"
26 #include "kleo/enum.h"
28 #include <QtCore/QString>
31 namespace KMime {
32 class Content;
35 namespace Message {
37 namespace Util {
39 /**
40 * Sets the proper structural information such as content-type, cte, and charset on the encoded body content. Depending on the crypto options,
41 * original content may be needed to determine some of the values
43 KMime::Content* composeHeadersAndBody( KMime::Content* orig, QByteArray encodedBody, Kleo::CryptoMessageFormat format, bool sign, QByteArray hashAlgo = "pgp-sha1" );
45 /**
46 * Sets the content-type for the top level of the mime content, based on the crypto format and if a signature is used.
48 void makeToplevelContentType( KMime::Content* content, Kleo::CryptoMessageFormat format, bool sign, QByteArray hashAlgo = "pgp-sha1" );
50 /**
51 * Sets the nested content type of the content, for crypto operations.
53 void setNestedContentType( KMime::Content* content, Kleo::CryptoMessageFormat format, bool sign );
55 /**
56 * Sets the nested content dispositions for the crypto operations.
58 void setNestedContentDisposition( KMime::Content* content, Kleo::CryptoMessageFormat format, bool sign );
60 /**
61 * Helper that returns whether or not the current combination of crypto format and signing choice means that the
62 * resulting message will be a mime message or not.
64 bool makeMultiMime( Kleo::CryptoMessageFormat f, bool sign );
66 /**
67 * Whether or not to make the message signed and multi-part
69 bool makeMultiPartSigned( Kleo::CryptoMessageFormat f );
71 MESSAGECOMPOSER_EXPORT QByteArray selectCharset( const QList<QByteArray> &charsets,
72 const QString &text );
78 #endif