File indexing completed on 2024-05-12 05:20:46

0001 /*
0002     SPDX-FileCopyrightText: 2005 Till Adam <adam@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kmail_private_export.h"
0010 #include <Akonadi/Collection>
0011 #include <Akonadi/Item>
0012 #include <MailCommon/FolderSettings>
0013 
0014 namespace KMail
0015 {
0016 /**
0017  * The Util namespace contains a collection of helper functions use in
0018  * various places.
0019  */
0020 namespace Util
0021 {
0022 /**
0023  * Returns any mailing list post addresses set on the
0024  *  parent collection (the mail folder) of the item.
0025  */
0026 KMAILTESTS_TESTS_EXPORT KMime::Types::Mailbox::List mailingListsFromMessage(const Akonadi::Item &item);
0027 
0028 /**
0029  * Whether or not the mail item has the keep-reply-in-folder
0030  *  attribute set.
0031  */
0032 KMAILTESTS_TESTS_EXPORT Akonadi::Item::Id putRepliesInSameFolder(const Akonadi::Item &item);
0033 
0034 /**
0035  * Handles a clicked URL, but only in case the viewer didn't handle it.
0036  * Currently only support mailto.
0037  */
0038 [[nodiscard]] KMAILTESTS_TESTS_EXPORT bool
0039 handleClickedURL(const QUrl &url,
0040                  const QSharedPointer<MailCommon::FolderSettings> &folder = QSharedPointer<MailCommon::FolderSettings>(),
0041                  const Akonadi::Collection &collection = Akonadi::Collection());
0042 
0043 [[nodiscard]] KMAILTESTS_TESTS_EXPORT bool
0044 mailingListsHandleURL(const QList<QUrl> &lst, const QSharedPointer<MailCommon::FolderSettings> &folder, const Akonadi::Collection &collection);
0045 
0046 [[nodiscard]] KMAILTESTS_TESTS_EXPORT bool mailingListPost(const QSharedPointer<MailCommon::FolderSettings> &fd, const Akonadi::Collection &col);
0047 [[nodiscard]] KMAILTESTS_TESTS_EXPORT bool mailingListSubscribe(const QSharedPointer<MailCommon::FolderSettings> &fd, const Akonadi::Collection &col);
0048 [[nodiscard]] KMAILTESTS_TESTS_EXPORT bool mailingListUnsubscribe(const QSharedPointer<MailCommon::FolderSettings> &fd, const Akonadi::Collection &col);
0049 [[nodiscard]] KMAILTESTS_TESTS_EXPORT bool mailingListArchives(const QSharedPointer<MailCommon::FolderSettings> &fd, const Akonadi::Collection &col);
0050 [[nodiscard]] KMAILTESTS_TESTS_EXPORT bool mailingListHelp(const QSharedPointer<MailCommon::FolderSettings> &fd, const Akonadi::Collection &col);
0051 
0052 KMAILTESTS_TESTS_EXPORT void lastEncryptAndSignState(bool &lastEncrypt, bool &lastSign, const KMime::Message::Ptr &msg);
0053 
0054 KMAILTESTS_TESTS_EXPORT void addQActionHelpText(QAction *action, const QString &text);
0055 
0056 /**
0057  * Set an action's text, icon etc. as appropriate for whether a message is
0058  * in the trash folder (delete permanently) or any other (move to trash).
0059  */
0060 KMAILTESTS_TESTS_EXPORT void setActionTrashOrDelete(QAction *action, bool isInTrashFolder);
0061 }
0062 }