Debian Codegraph @

plugins/ubuntu-notification-plugin/service/notificationwatcher.h

raw symbols SCIP
1 /* Copyright (C) 2017 Dan Chapman <[email protected]>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef NOTIFICATIONWATCHER_H
19 #define NOTIFICATIONWATCHER_H
20
21 #include <QObject>
22 #include <QDateTime>
23 #include <QString>
24 #include <QJsonObject>
25 #include <qmailmessage.h>
26 #include <Accounts.h>
27
28 class NotificationWatcher : public QObject
29 {
30 Q_OBJECT
31 public:
32 explicit NotificationWatcher(QObject *parent = 0);
33
34 enum NotificationType {
35 NONE,
36 INBOX_ONLY,
37 CONTACTS_ONLY,
38 EVERYTHING
39 };
40
41 signals:
42 void newMessage(const QMailAccountId &account, const QJsonObject &message);
43
44 public slots:
45 void handleNewMessages(const QMailMessageIdList &msgList);
46 void handleUpdatedMessages(const QMailMessageIdList &msgList);
47 void handleRemovedMessages(const QMailMessageIdList &msgList);
48
49 private:
50 QJsonObject buildMessage(const QMailMessage &msg);
51 QJsonObject buildSummaryMessage(const QString &msg);
52 QJsonObject card(const QMailMessage &msg);
53 QJsonObject vibrate();
54 QJsonObject emblemCounter();
55 bool notifyEnabled(const QMailMessageMetaData &meta);
56 NotificationType notificationType(const QMailMessageMetaData &meta);
57 bool canPostNotification(const QMailMessageMetaData &meta);
58 Account *getAccount(const quint64 &id);
59 QString getTag(const QMailMessageId &id);
60
61 private:
62 QDateTime m_started;
63 QScopedPointer<Accounts> m_accounts;
64 };
65
66 #endif // NOTIFICATIONWATCHER_H