/* * Copyright (C) 2016 Canonical, Ltd. * * Authors: * Gustavo Pichorim Boiko * * This file is part of telephony-service. * * telephony-service is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * telephony-service is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef ACCOUNTLIST_H #define ACCOUNTLIST_H #include #include #include "telepathyhelper.h" class AccountEntry; class AccountList : public QObject { Q_OBJECT Q_PROPERTY(QQmlListProperty all READ qmlAllAccounts NOTIFY allAccountsChanged) Q_PROPERTY(QQmlListProperty active READ qmlActiveAccounts NOTIFY activeAccountsChanged) Q_PROPERTY(QQmlListProperty displayed READ qmlDisplayedAccounts NOTIFY displayedAccountsChanged) public: AccountList(Protocol::Features features = Protocol::AllFeatures, const QString &protocol = QString::null, QObject *parent = 0); QQmlListProperty qmlAllAccounts(); QQmlListProperty qmlActiveAccounts(); QQmlListProperty qmlDisplayedAccounts(); static int allAccountsCount(QQmlListProperty *p); static AccountEntry *allAccountsAt(QQmlListProperty *p, int index); static int activeAccountsCount(QQmlListProperty *p); static AccountEntry *activeAccountsAt(QQmlListProperty *p, int index); static int displayedAccountsCount(QQmlListProperty *p); static AccountEntry *displayedAccountsAt(QQmlListProperty *p, int index); QList accounts(); QList activeAccounts(); QList displayedAccounts(); Q_SIGNALS: void allAccountsChanged(); void activeAccountsChanged(); void displayedAccountsChanged(); protected Q_SLOTS: void init(); void filterAccounts(); private: Protocol::Features mFeatures; QString mProtocol; QList mAccounts; }; #endif // ACCOUNTLIST_H