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

0001 /*
0002    SPDX-FileCopyrightText: 2001 by Ryan Breen <ryan@porivo.com>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <Akonadi/Collection>
0010 #include <KStatusNotifierItem>
0011 
0012 #include <QAbstractItemModel>
0013 #include <QAction>
0014 
0015 class QMenu;
0016 
0017 /**
0018  * KMSystemTray extends KStatusNotifierItem and handles system
0019  * tray notification for KMail
0020  */
0021 namespace KMail
0022 {
0023 class UnityServiceManager;
0024 class KMSystemTray : public KStatusNotifierItem
0025 {
0026     Q_OBJECT
0027 public:
0028     /** constructor */
0029     explicit KMSystemTray(QObject *parent = nullptr);
0030     /** destructor */
0031     ~KMSystemTray() override;
0032 
0033     void hideKMail();
0034 
0035     void updateStatus(int count);
0036     void updateCount(int count);
0037     void setUnityServiceManager(KMail::UnityServiceManager *unityServiceManager);
0038     void initialize(int count);
0039     void updateToolTip(int count);
0040 
0041 private:
0042     void slotActivated();
0043     void slotContextMenuAboutToShow();
0044     void slotSelectCollection(QAction *act);
0045 
0046     [[nodiscard]] bool buildPopupMenu();
0047     void fillFoldersMenu(QMenu *menu, const QAbstractItemModel *model, const QString &parentName = QString(), const QModelIndex &parentIndex = QModelIndex());
0048     int mDesktopOfMainWin = 0;
0049     bool mBuiltContextMenu = false;
0050 
0051     bool mHasUnreadMessage = false;
0052 
0053     QMenu *mNewMessagesPopup = nullptr;
0054     QAction *mSendQueued = nullptr;
0055     KMail::UnityServiceManager *mUnityServiceManager = nullptr;
0056 };
0057 }