~ci-train-bot/history-service/history-service-ubuntu-yakkety-landing-052

« back to all changes in this revision

Viewing changes to src/participant.h

Request contact information for all known participants on history-daemon initialization, and use this cached information on the models.
Approved by: Tiago Salem Herrmann, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
 
6
 *
 
7
 * This file is part of history-service.
 
8
 *
 
9
 * history-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
 * history-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 HISTORY_PARTICIPANT_H
 
23
#define HISTORY_PARTICIPANT_H
 
24
 
 
25
#include <QDBusArgument>
 
26
#include <QList>
 
27
#include <QSharedPointer>
 
28
#include <QString>
 
29
#include <QVariantList>
 
30
#include <QVariantMap>
 
31
 
 
32
namespace History
 
33
{
 
34
 
 
35
class ParticipantPrivate;
 
36
 
 
37
class Participant
 
38
{
 
39
    Q_DECLARE_PRIVATE(Participant)
 
40
public:
 
41
    explicit Participant();
 
42
    Participant(const QString &accountId,
 
43
                const QString &identifier,
 
44
                const QString &contactId = QString::null,
 
45
                const QString &alias = QString::null,
 
46
                const QString &avatar = QString::null,
 
47
                const QVariantMap &detailProperties = QVariantMap());
 
48
    Participant(const Participant &other);
 
49
    Participant& operator=(const Participant &other);
 
50
    virtual ~Participant();
 
51
 
 
52
    QString accountId() const;
 
53
    QString identifier() const;
 
54
    QString contactId() const;
 
55
    QString alias() const;
 
56
    QString avatar() const;
 
57
    QVariantMap detailProperties() const;
 
58
 
 
59
    bool isNull() const;
 
60
    bool operator==(const Participant &other) const;
 
61
    bool operator<(const Participant &other) const;
 
62
 
 
63
    virtual QVariantMap properties() const;
 
64
 
 
65
    static Participant fromProperties(const QVariantMap &properties);
 
66
 
 
67
protected:
 
68
    QSharedPointer<ParticipantPrivate> d_ptr;
 
69
};
 
70
 
 
71
// define the participants list with toVariantList() and fromVariantList() helpers
 
72
class Participants : public QList<Participant>
 
73
{
 
74
public:
 
75
    QStringList identifiers() const;
 
76
    static Participants fromVariant(const QVariant &variant);
 
77
    static Participants fromVariantList(const QVariantList &list);
 
78
    QVariantList toVariantList() const;
 
79
 
 
80
};
 
81
 
 
82
const QDBusArgument &operator>>(const QDBusArgument &argument, Participants &participants);
 
83
 
 
84
}
 
85
 
 
86
#endif // HISTORY_PARTICIPANT_H