/usr/include/KF5/messagecomposer/messagehelper.h is in libkf5messagecomposer-dev 4:17.12.3-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | /*
Copyright (C) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
Copyright (c) 2009 Andras Mantia <andras@kdab.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KMAIL_MESSAGE_HELPER_H
#define KMAIL_MESSAGE_HELPER_H
#include "messagecomposer_export.h"
#include <kmime/kmime_headers.h>
#include <kmime/kmime_message.h>
#include <item.h>
namespace KIdentityManagement {
class IdentityManager;
}
namespace KMime {
class Message;
}
/**
* Contains random helper methods when dealing with messages.
* TODO: cleanup and organize, along with similar methods in messageviewer.
*/
namespace MessageHelper {
/** Initialize header fields. Should be called on new messages
if they are not set manually. E.g. before composing. Calling
of setAutomaticFields(), see below, is still required. */
void MESSAGECOMPOSER_EXPORT initHeader(const KMime::Message::Ptr &message, const KIdentityManagement::IdentityManager *identMan, uint id = 0);
/** Set the from, to, cc, bcc, encrytion etc headers as specified in the
* given identity. */
void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement::IdentityManager *identMan, uint id);
/** Initialize headers fields according to the identity and the transport
header of the given original message */
void initFromMessage(const KMime::Message::Ptr &msg, const KMime::Message::Ptr &orgiMsg, KIdentityManagement::IdentityManager *, uint id, bool idHeaders = true);
KMime::Types::AddrSpecList MESSAGECOMPOSER_EXPORT extractAddrSpecs(const KMime::Message::Ptr &msg, const QByteArray &header);
/** Check for prefixes @p prefixRegExps in #subject(). If none
is found, @p newPrefix + ' ' is prepended to the subject and the
resulting string is returned. If @p replace is true, any
sequence of whitespace-delimited prefixes at the beginning of
#subject() is replaced by @p newPrefix
**/
QString cleanSubject(const KMime::Message::Ptr &msg, const QStringList &prefixRegExps, bool replace, const QString &newPrefix);
/** Return this mails subject, with all "forward" and "reply"
prefixes removed */
QString cleanSubject(const KMime::Message::Ptr &msg);
/** Return this mails subject, formatted for "forward" mails */
QString forwardSubject(const KMime::Message::Ptr &msg);
/** Return this mails subject, formatted for "reply" mails */
QString replySubject(const KMime::Message::Ptr &msg);
/** Check for prefixes @p prefixRegExps in @p str. If none
is found, @p newPrefix + ' ' is prepended to @p str and the
resulting string is returned. If @p replace is true, any
sequence of whitespace-delimited prefixes at the beginning of
@p str is replaced by @p newPrefix.
**/
QString replacePrefixes(const QString &str, const QStringList &prefixRegExps, bool replace, const QString &newPrefix);
/** Set fields that are either automatically set (Message-id)
or that do not change from one message to another (MIME-Version).
Call this method before sending *after* all changes to the message
are done because this method does things different if there are
attachments / multiple body parts. */
void setAutomaticFields(const KMime::Message::Ptr &msg, bool isMultipart = false);
/** Returns @p str with all "forward" and "reply" prefixes stripped off.
**/
QString stripOffPrefixes(const QString &str);
}
#endif
|