Messagelib

messagecomposer/src/utils/util.h
1/*
2 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
3 SPDX-FileCopyrightText: 2009 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
4 SPDX-FileCopyrightText: 2009 Leo Franchi <lfranchi@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#pragma once
10
11#include "messagecomposer_export.h"
12#include <Akonadi/Item>
13#include <Akonadi/MessageStatus>
14#include <KMime/Message>
15#include <Libkleo/Enum>
16
17class QTextDocument;
18
19namespace KMime
20{
21class Content;
22}
23
24namespace MessageComposer
25{
26namespace Util
27{
28[[nodiscard]] MESSAGECOMPOSER_EXPORT QStringList AttachmentKeywords();
29[[nodiscard]] MESSAGECOMPOSER_EXPORT QString cleanedUpHeaderString(const QString &s);
30
31[[nodiscard]] MESSAGECOMPOSER_EXPORT bool sendMailDispatcherIsOnline(QWidget *parent = nullptr);
32
33/**
34 * find mimetype in message
35 */
36[[nodiscard]] MESSAGECOMPOSER_EXPORT KMime::Content *findTypeInMessage(KMime::Content *data, const QByteArray &mimeType, const QByteArray &subType);
37
38/**
39 * Adds private headers to the given @p message that links it to the original message.
40 *
41 * @param message The message to add the link information to.
42 * @param id The item id of the original message.
43 * @param status The status (replied or forwarded) that links the message to the original message.
44 */
45MESSAGECOMPOSER_EXPORT void addLinkInformation(const KMime::Message::Ptr &message, Akonadi::Item::Id item, Akonadi::MessageStatus status);
46
47/**
48 * Reads the private headers of the given @p message to extract link information to its original message.
49 *
50 * @param message The message to read the link information from.
51 * @param id Will contain the item id of the original message.
52 * @param status Will contain the status (replied or forwarded) that linked the message to the original message.
53 * @returns Whether the mail contains valid link information or not.
54 */
55[[nodiscard]] MESSAGECOMPOSER_EXPORT bool
57
58/**
59 * Returns whether the item represents a valid KMime::Message that is not
60 * in the Akonadi store (yet). This happens when operating on messages
61 * attached to other mails, for example. Such items are not "valid", in
62 * the akonadi sense, since jobs cannot sensibly use them, but they do
63 * contain a valid message pointer.
64 */
65[[nodiscard]] MESSAGECOMPOSER_EXPORT bool isStandaloneMessage(const Akonadi::Item &item);
66
67/**
68 * Retrieve the KMime::Message from the item, if there is one.
69 * @returns A valid message pointer, or 0, is the item does not contain
70 * a valid message.
71 */
72[[nodiscard]] MESSAGECOMPOSER_EXPORT KMime::Message::Ptr message(const Akonadi::Item &item);
73
74[[nodiscard]] MESSAGECOMPOSER_EXPORT bool hasMissingAttachments(const QStringList &attachmentKeywords, QTextDocument *doc, const QString &subj);
75
76[[nodiscard]] MESSAGECOMPOSER_EXPORT QStringList cleanEmailList(const QStringList &emails);
77[[nodiscard]] MESSAGECOMPOSER_EXPORT QStringList cleanUpEmailListAndEncoding(const QStringList &emails);
78MESSAGECOMPOSER_EXPORT void addCustomHeaders(const KMime::Message::Ptr &message, const QMap<QByteArray, QString> &customHeader);
79}
80}
Q_SCRIPTABLE CaptureState status()
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.