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 QByteArray selectCharset(const QList<QByteArray> &charsets, const QString &text);
29
30[[nodiscard]] MESSAGECOMPOSER_EXPORT QStringList AttachmentKeywords();
31[[nodiscard]] MESSAGECOMPOSER_EXPORT QString cleanedUpHeaderString(const QString &s);
32
33[[nodiscard]] MESSAGECOMPOSER_EXPORT bool sendMailDispatcherIsOnline(QWidget *parent = nullptr);
34
35/**
36 * find mimetype in message
37 */
38[[nodiscard]] MESSAGECOMPOSER_EXPORT KMime::Content *findTypeInMessage(KMime::Content *data, const QByteArray &mimeType, const QByteArray &subType);
39
40/**
41 * Adds private headers to the given @p message that links it to the original message.
42 *
43 * @param message The message to add the link information to.
44 * @param id The item id of the original message.
45 * @param status The status (replied or forwarded) that links the message to the original message.
46 */
47MESSAGECOMPOSER_EXPORT void addLinkInformation(const KMime::Message::Ptr &message, Akonadi::Item::Id item, Akonadi::MessageStatus status);
48
49/**
50 * Reads the private headers of the given @p message to extract link information to its original message.
51 *
52 * @param message The message to read the link information from.
53 * @param id Will contain the item id of the original message.
54 * @param status Will contain the status (replied or forwarded) that linked the message to the original message.
55 * @returns Whether the mail contains valid link information or not.
56 */
57[[nodiscard]] MESSAGECOMPOSER_EXPORT bool
59
60/**
61 * Returns whether the item represents a valid KMime::Message that is not
62 * in the Akonadi store (yet). This happens when operating on messages
63 * attached to other mails, for example. Such items are not "valid", in
64 * the akonadi sense, since jobs cannot sensibly use them, but they do
65 * contain a valid message pointer.
66 */
67[[nodiscard]] MESSAGECOMPOSER_EXPORT bool isStandaloneMessage(const Akonadi::Item &item);
68
69/**
70 * Retrieve the KMime::Message from the item, if there is one.
71 * @returns A valid message pointer, or 0, is the item does not contain
72 * a valid message.
73 */
74[[nodiscard]] MESSAGECOMPOSER_EXPORT KMime::Message::Ptr message(const Akonadi::Item &item);
75
76[[nodiscard]] MESSAGECOMPOSER_EXPORT bool hasMissingAttachments(const QStringList &attachmentKeywords, QTextDocument *doc, const QString &subj);
77
78[[nodiscard]] MESSAGECOMPOSER_EXPORT QStringList cleanEmailList(const QStringList &emails);
79[[nodiscard]] MESSAGECOMPOSER_EXPORT QStringList cleanUpEmailListAndEncoding(const QStringList &emails);
80MESSAGECOMPOSER_EXPORT void addCustomHeaders(const KMime::Message::Ptr &message, const QMap<QByteArray, QString> &customHeader);
81}
82}
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 Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.