File indexing completed on 2024-05-12 05:20:46
0001 /* 0002 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Akonadi/Collection> 0010 #include <QModelIndex> 0011 #include <QObject> 0012 class QDBusServiceWatcher; 0013 class QAbstractItemModel; 0014 class QWindow; 0015 namespace KMail 0016 { 0017 class KMSystemTray; 0018 class UnityServiceManager : public QObject 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit UnityServiceManager(QObject *parent = nullptr); 0023 ~UnityServiceManager() override; 0024 0025 void updateSystemTray(); 0026 [[nodiscard]] bool haveSystemTrayApplet() const; 0027 0028 [[nodiscard]] bool canQueryClose(); 0029 void toggleSystemTray(QWidget *parent); 0030 void initListOfCollection(); 0031 [[nodiscard]] bool excludeFolder(const Akonadi::Collection &collection) const; 0032 [[nodiscard]] bool ignoreNewMailInFolder(const Akonadi::Collection &collection); 0033 void updateCount(); 0034 0035 void setSystemTryAssociatedWindow(QWindow *window); 0036 0037 private: 0038 void unreadMail(const QAbstractItemModel *model, const QModelIndex &parentIndex = {}); 0039 void slotCollectionStatisticsChanged(Akonadi::Collection::Id id, const Akonadi::CollectionStatistics &); 0040 void initUnity(); 0041 [[nodiscard]] bool hasUnreadMail() const; 0042 QDBusServiceWatcher *const mUnityServiceWatcher; 0043 KMail::KMSystemTray *mSystemTray = nullptr; 0044 int mCount = 0; 0045 bool mUnityServiceAvailable = false; 0046 }; 0047 }