Astyle kdelibs
[kdepim.git] / akonadiconsole / monitorsmodel.h
blobdc6f6759955571cddd4032f4a264f27ef80f6cef
1 /*
2 * Copyright (C) 2013 Daniel Vrátil <dvratil@redhat.com>
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 along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef MONITORSMODEL_H
21 #define MONITORSMODEL_H
23 #include <QAbstractItemModel>
24 #include <QtDBus/QDBusObjectPath>
26 #include "notificationmanagerinterface.h"
28 class MonitorItem;
30 class MonitorsModel : public QAbstractItemModel
32 Q_OBJECT
34 public:
35 enum Column {
36 IdentifierColumn = 0,
37 IsAllMonitoredColumn,
38 MonitoredCollectionsColumn,
39 MonitoredItemsColumn,
40 MonitoredResourcesColumn,
41 MonitoredMimeTypesColumn,
42 IgnoredSessionsColumn,
44 ColumnsCount
47 explicit MonitorsModel(QObject *parent = Q_NULLPTR);
48 virtual ~MonitorsModel();
50 void setEnabled(bool enabled);
52 QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
53 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
54 int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
55 int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
56 QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
57 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
59 private Q_SLOTS:
60 void init();
62 void slotItemChanged(MonitorsModel::Column row);
63 void slotSubscriberSubscribed(const QDBusObjectPath &identifier);
64 void slotSubscriberUnsubscribed(const QDBusObjectPath &identifier);
66 private:
67 QMap<QDBusObjectPath, MonitorItem * > mData;
68 org::freedesktop::Akonadi::NotificationManager *mManager;
71 #endif // MONITORSMODEL_H