2
* Copyright (C) 2016 Canonical, Ltd.
5
* Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
7
* This file is part of telephony-service.
9
* telephony-service is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 3.
13
* telephony-service is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26
#include <QQmlListProperty>
27
#include "telepathyhelper.h"
31
class AccountList : public QObject
34
Q_PROPERTY(QQmlListProperty<AccountEntry> all READ qmlAllAccounts NOTIFY allAccountsChanged)
35
Q_PROPERTY(QQmlListProperty<AccountEntry> active READ qmlActiveAccounts NOTIFY activeAccountsChanged)
36
Q_PROPERTY(QQmlListProperty<AccountEntry> displayed READ qmlDisplayedAccounts NOTIFY displayedAccountsChanged)
38
AccountList(Protocol::Features features = Protocol::AllFeatures, const QString &protocol = QString::null, QObject *parent = 0);
39
QQmlListProperty<AccountEntry> qmlAllAccounts();
40
QQmlListProperty<AccountEntry> qmlActiveAccounts();
41
QQmlListProperty<AccountEntry> qmlDisplayedAccounts();
43
static int allAccountsCount(QQmlListProperty<AccountEntry> *p);
44
static AccountEntry *allAccountsAt(QQmlListProperty<AccountEntry> *p, int index);
45
static int activeAccountsCount(QQmlListProperty<AccountEntry> *p);
46
static AccountEntry *activeAccountsAt(QQmlListProperty<AccountEntry> *p, int index);
47
static int displayedAccountsCount(QQmlListProperty<AccountEntry> *p);
48
static AccountEntry *displayedAccountsAt(QQmlListProperty<AccountEntry> *p, int index);
50
QList<AccountEntry*> accounts();
51
QList<AccountEntry*> activeAccounts();
52
QList<AccountEntry*> displayedAccounts();
55
void allAccountsChanged();
56
void activeAccountsChanged();
57
void displayedAccountsChanged();
61
void filterAccounts();
64
Protocol::Features mFeatures;
66
QList<AccountEntry*> mAccounts;
71
#endif // ACCOUNTLIST_H