Debian Codegraph @

online-accounts-ui/src/access-model.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2013 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <[email protected]>
5 *
6 * This file is part of lomiri-online-accounts-ui
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef OAU_ACCESS_MODEL_H
22 #define OAU_ACCESS_MODEL_H
23
24 #include <QSortFilterProxyModel>
25
26 namespace OnlineAccountsUi {
27
28 class AccessModelPrivate;
29 class AccessModel: public QSortFilterProxyModel
30 {
31 Q_OBJECT
32 Q_PROPERTY(QAbstractItemModel *accountModel READ accountModel \
33 WRITE setAccountModel NOTIFY accountModelChanged)
34 Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
35 Q_PROPERTY(QString applicationId READ applicationId \
36 WRITE setApplicationId NOTIFY applicationIdChanged)
37
38 public:
39 explicit AccessModel(QObject *parent = 0);
40 ~AccessModel();
41
42 void setAccountModel(QAbstractItemModel *accountModel);
43 QAbstractItemModel *accountModel() const;
44
45 void setApplicationId(const QString &applicationId);
46 QString applicationId() const;
47
48 Q_INVOKABLE QVariant get(int row, const QString &roleName) const;
49
50 protected:
51 bool filterAcceptsRow(int source_row,
52 const QModelIndex &source_parent) const Q_DECL_OVERRIDE;
53
54 Q_SIGNALS:
55 void accountModelChanged();
56 void countChanged();
57 void applicationIdChanged();
58
59 private:
60 AccessModelPrivate *d_ptr;
61 Q_DECLARE_PRIVATE(AccessModel)
62 };
63
64 } // namespace
65
66 #endif // OAU_ACCESS_MODEL_H