SVN_SILENT made messages (.desktop file) - always resolve ours
[kdepim.git] / akonadiconsole / notificationmodel.h
blob99df5e0ee25e4f80056e3ff7bf65bfaa6f51e7be
1 /*
2 Copyright (c) 2009 Volker Krause <vkrause@kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 USA.
20 #ifndef AKONADICONSOLE_NOTIFICATIONMODEL_H
21 #define AKONADICONSOLE_NOTIFICATIONMODEL_H
23 #include <QAbstractItemModel>
24 #include <QDateTime>
25 #include <QDBusInterface>
27 class QDBusInterface;
29 class NotificationModel : public QAbstractItemModel
31 Q_OBJECT
32 public:
33 explicit NotificationModel(QObject *parent);
34 ~NotificationModel();
36 int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
37 int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
38 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
39 QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
40 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
41 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
43 bool isEnabled() const
45 if (!m_manager) {
46 return false;
48 QDBusMessage reply = m_manager->call(QStringLiteral("debugEnabled"));
49 if (reply.arguments().size() == 1) {
50 return reply.arguments().at(0).toBool();
51 } else {
52 return false;
56 public Q_SLOTS:
57 void clear();
58 void setEnabled(bool enable);
60 private Q_SLOTS:
61 void slotNotify(const QVector<QByteArray> &msgs);
63 private:
64 class Item;
65 class NotificationBlock;
66 class NotificationNode;
67 class NotificationEntity;
69 QList<NotificationBlock *> m_data;
71 QDBusInterface *m_manager;
74 #endif