File indexing completed on 2024-06-16 04:59:10
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 "mailcommon_export.h" 0010 0011 #include <Akonadi/AgentInstance> 0012 #include <Akonadi/Collection> 0013 0014 class OrgKdeAkonadiPOP3SettingsInterface; 0015 0016 namespace Akonadi 0017 { 0018 class Item; 0019 } 0020 class KJob; 0021 0022 class QString; 0023 0024 namespace MailCommon 0025 { 0026 /** 0027 * The Util namespace contains a collection of helper functions use in 0028 * various places. 0029 */ 0030 namespace Util 0031 { 0032 [[nodiscard]] MAILCOMMON_EXPORT OrgKdeAkonadiPOP3SettingsInterface *createPop3SettingsInterface(const QString &ident); 0033 0034 [[nodiscard]] MAILCOMMON_EXPORT bool isVirtualCollection(const Akonadi::Collection &col); 0035 0036 [[nodiscard]] MAILCOMMON_EXPORT bool isVirtualCollection(const QString &resource); 0037 0038 [[nodiscard]] MAILCOMMON_EXPORT QString fullCollectionPath(const Akonadi::Collection &collection, bool addAccountName = true); 0039 [[nodiscard]] MAILCOMMON_EXPORT QString fullCollectionRemoveIdPath(const Akonadi::Collection &collection, bool addAccountName = true); 0040 0041 MAILCOMMON_EXPORT bool showJobErrorMessage(KJob *job); 0042 0043 [[nodiscard]] MAILCOMMON_EXPORT Akonadi::AgentInstance::List agentInstances(bool excludeMailTransport = true); 0044 0045 [[nodiscard]] MAILCOMMON_EXPORT bool isMailAgent(const Akonadi::AgentInstance &instance, bool excludeMailTransport = true); 0046 0047 [[nodiscard]] MAILCOMMON_EXPORT bool isUnifiedMailboxesAgent(const Akonadi::Collection &col); 0048 0049 /** 0050 * Returns the identity of the folder that contains the given Akonadi::Item. 0051 */ 0052 [[nodiscard]] MAILCOMMON_EXPORT uint folderIdentity(const Akonadi::Item &item); 0053 0054 [[nodiscard]] MAILCOMMON_EXPORT QString realFolderPath(const QString &path); 0055 0056 MAILCOMMON_EXPORT void expireOldMessages(const Akonadi::Collection &collection, bool immediate); 0057 0058 [[nodiscard]] MAILCOMMON_EXPORT Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &folder); 0059 [[nodiscard]] MAILCOMMON_EXPORT QString convertFolderPathToCollectionStr(const QString &folder); 0060 0061 MAILCOMMON_EXPORT void foundMailer(QStringList &lst, const QString &name); 0062 [[nodiscard]] MAILCOMMON_EXPORT QStringList foundMailer(); 0063 [[nodiscard]] MAILCOMMON_EXPORT bool isLocalCollection(const QString &resource); 0064 } 0065 }