Fix layout
[kdepim.git] / kmail / kmsystemtray.h
blob9633ba80178c74424d216a9b0fdbfe0feb2ffa1e
1 /***************************************************************************
2 kmsystemtray.h - description
3 -------------------
4 begin : Fri Aug 31 22:38:44 EDT 2001
5 copyright : (C) 2001 by Ryan Breen
6 email : ryan@porivo.com
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef KMSYSTEMTRAY_H
19 #define KMSYSTEMTRAY_H
21 #include <AkonadiCore/collection.h>
22 #include <qicon.h>
23 #include <kstatusnotifieritem.h>
25 #include <QAction>
26 #include <QAbstractItemModel>
28 class QMenu;
30 /**
31 * KMSystemTray extends KStatusNotifierItem and handles system
32 * tray notification for KMail
34 namespace KMail
36 class KMSystemTray : public KStatusNotifierItem
38 Q_OBJECT
39 public:
40 /** construtor */
41 explicit KMSystemTray(QObject *parent = Q_NULLPTR);
42 /** destructor */
43 ~KMSystemTray();
45 void setShowUnreadCount(bool showUnreadCount);
47 /**
48 * Use this method to disable any systray icon changing.
49 * By default this is enabled and you'll see the "new e-mail" icon whenever there's
50 * new e-mail.
52 void setSystrayIconNotificationsEnabled(bool enable);
54 void setMode(int mode);
55 int mode() const;
57 void hideKMail();
58 bool hasUnreadMail() const;
60 void updateSystemTray();
62 private Q_SLOTS:
63 void slotActivated();
64 void slotContextMenuAboutToShow();
65 void slotSelectCollection(QAction *act);
66 void initListOfCollection();
67 void slotCollectionStatisticsChanged(Akonadi::Collection::Id, const Akonadi::CollectionStatistics &);
68 void slotGeneralPaletteChanged();
69 void slotGeneralFontChanged();
71 private:
72 bool mainWindowIsOnCurrentDesktop();
73 bool buildPopupMenu();
74 void updateCount();
75 void fillFoldersMenu(QMenu *menu, const QAbstractItemModel *model, const QString &parentName = QString(), const QModelIndex &parentIndex = QModelIndex());
76 void unreadMail(const QAbstractItemModel *model, const QModelIndex &parentIndex = QModelIndex());
77 bool excludeFolder(const Akonadi::Collection &collection) const;
78 bool ignoreNewMailInFolder(const Akonadi::Collection &collection);
80 private:
81 QColor mTextColor;
82 QIcon mIcon;
83 int mDesktopOfMainWin;
85 int mMode;
86 int mCount;
88 bool mShowUnreadMailCount;
89 bool mIconNotificationsEnabled;
91 QMenu *mNewMessagesPopup;
92 QAction *mSendQueued;
95 #endif