~phablet-team/telephony-service/trunk

« back to all changes in this revision

Viewing changes to libtelephonyservice/accountlist.h

  • Committer: Bileto Bot
  • Author(s): Gustavo Pichorim Boiko
  • Date: 2016-11-29 01:08:23 UTC
  • mfrom: (1211.1.25 staging)
  • Revision ID: ci-train-bot@canonical.com-20161129010823-u97pajkho1jfm44s
Group chat support.

Approved by: Gustavo Pichorim Boiko, Tiago Salem Herrmann

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2016 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
 
6
 *
 
7
 * This file is part of telephony-service.
 
8
 *
 
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.
 
12
 *
 
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.
 
17
 *
 
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/>.
 
20
 */
 
21
 
 
22
#ifndef ACCOUNTLIST_H
 
23
#define ACCOUNTLIST_H
 
24
 
 
25
#include <QObject>
 
26
#include <QQmlListProperty>
 
27
#include "telepathyhelper.h"
 
28
 
 
29
class AccountEntry;
 
30
 
 
31
class AccountList : public QObject
 
32
{
 
33
    Q_OBJECT
 
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)
 
37
public:
 
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();
 
42
 
 
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);
 
49
 
 
50
    QList<AccountEntry*> accounts();
 
51
    QList<AccountEntry*> activeAccounts();
 
52
    QList<AccountEntry*> displayedAccounts();
 
53
 
 
54
Q_SIGNALS:
 
55
    void allAccountsChanged();
 
56
    void activeAccountsChanged();
 
57
    void displayedAccountsChanged();
 
58
 
 
59
protected Q_SLOTS:
 
60
    void init();
 
61
    void filterAccounts();
 
62
 
 
63
private:
 
64
    Protocol::Features mFeatures;
 
65
    QString mProtocol;
 
66
    QList<AccountEntry*> mAccounts;
 
67
};
 
68
 
 
69
 
 
70
 
 
71
#endif // ACCOUNTLIST_H