File indexing completed on 2024-12-22 05:00:56

0001 /*
0002    SPDX-FileCopyrightText: 2018 Daniel Vrátil <dvratil@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <MailCommon/MailInterfaces>
0010 #include <QObject>
0011 
0012 namespace Akonadi
0013 {
0014 class EntityTreeModel;
0015 class EntityMimeTypeFilterModel;
0016 }
0017 
0018 namespace MailCommon
0019 {
0020 class FolderCollectionMonitor;
0021 }
0022 
0023 class MailKernel : public QObject, public MailCommon::IKernel, public MailCommon::ISettings
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit MailKernel(const KSharedConfigPtr &config, QObject *parent = nullptr);
0028     ~MailKernel() override;
0029 
0030     KIdentityManagementCore::IdentityManager *identityManager() override;
0031     MessageComposer::MessageSender *msgSender() override;
0032 
0033     Akonadi::EntityMimeTypeFilterModel *collectionModel() const override;
0034     KSharedConfig::Ptr config() override;
0035     void syncConfig() override;
0036     MailCommon::JobScheduler *jobScheduler() const override;
0037     Akonadi::ChangeRecorder *folderCollectionMonitor() const override;
0038     void updateSystemTray() override;
0039 
0040     [[nodiscard]] qreal closeToQuotaThreshold() override;
0041     [[nodiscard]] bool excludeImportantMailFromExpiry() override;
0042     [[nodiscard]] QStringList customTemplates() override;
0043     [[nodiscard]] Akonadi::Collection::Id lastSelectedFolder() override;
0044     void setLastSelectedFolder(Akonadi::Collection::Id col) override;
0045     [[nodiscard]] bool showPopupAfterDnD() override;
0046     void expunge(Akonadi::Collection::Id id, bool sync) override;
0047 
0048 private:
0049     Q_DISABLE_COPY(MailKernel)
0050 
0051     KSharedConfigPtr mConfig;
0052     KIdentityManagementCore::IdentityManager *const mIdentityManager;
0053     MessageComposer::MessageSender *const mMessageSender;
0054     MailCommon::FolderCollectionMonitor *mFolderCollectionMonitor = nullptr;
0055     Akonadi::EntityTreeModel *mEntityTreeModel = nullptr;
0056     Akonadi::EntityMimeTypeFilterModel *mCollectionModel = nullptr;
0057 };