2
* Copyright (C) 2013 Canonical, Ltd.
5
* Michael Terry <michael.terry@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/>.
22
#ifndef GREETERCONTACTS_H
23
#define GREETERCONTACTS_H
26
#include <QContactFilter>
27
#include <QDBusMessage>
30
class QDBusPendingCallWatcher;
33
* When running under the greeter, we don't have our own contacts database.
34
* Instead, we query AccountsService for the information.
36
class GreeterContacts : public QObject
41
GreeterContacts(QObject *parent = 0);
44
void setFilter(const QtContacts::QContactFilter &filter);
46
// Records contact info for currently-logged-in user
47
static void emitContact(const QtContacts::QContact &contact);
49
// These are really implementation details, but are public for ease of unit testing
50
static QVariantMap contactToMap(const QtContacts::QContact &contact);
51
static QtContacts::QContact mapToContact(const QVariantMap &map);
54
void contactUpdated(const QtContacts::QContact &contact);
57
void greeterPropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
58
void accountsPropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated, const QDBusMessage &message);
60
void greeterGetEntryReply(QDBusPendingCallWatcher *watcher);
61
void accountsGetUsersReply(QDBusPendingCallWatcher *watcher);
62
void accountsGetContactReply(QDBusPendingCallWatcher *watcher);
66
void queryContact(const QString &user);
67
void updateActiveUser(const QString &username);
68
QtContacts::QContact lookupContact();
69
void signalIfNeeded();
71
QtContacts::QContactFilter mFilter;
73
QMap<QString, QVariantMap> mContacts;
76
#endif // GREETERCONTACTS_H