KPeople

declarativepersondata.cpp
1/*
2 SPDX-FileCopyrightText: 2013 David Edmundson <D.Edmundson@lboro.ac.uk>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#include "declarativepersondata.h"
8
9#include "../persondata.h"
10#include "avatarimageprovider.h"
11#include "kpeople_debug.h"
12#include <imageprovideruri_p.h>
13
14#include <QStringBuilder>
15
16DeclarativePersonData::DeclarativePersonData(QObject *parent)
17 : QObject(parent)
18 , m_person(nullptr)
19{
20 connect(this, &DeclarativePersonData::personChanged, this, &DeclarativePersonData::photoImageProviderUriChanged);
21}
22
23void DeclarativePersonData::setPersonUri(const QString &id)
24{
25 if (id == m_id) {
26 return;
27 }
28
29 m_id = id;
30 delete m_person;
31 if (m_id.isEmpty()) {
32 m_person = nullptr;
33 } else {
34 m_person = new KPeople::PersonData(id, this);
35 connect(m_person, &KPeople::PersonData::dataChanged, this, &DeclarativePersonData::photoImageProviderUriChanged);
36 }
37
38 Q_EMIT personChanged();
39}
40
41KPeople::PersonData *DeclarativePersonData::person() const
42{
43 return m_person;
44}
45
46QString DeclarativePersonData::photoImageProviderUri() const
47{
48 return ::photoImageProviderUri(m_id);
49}
50
51QString DeclarativePersonData::personUri() const
52{
53 return m_id;
54}
55
56#include "moc_declarativepersondata.cpp"
Allows to query the information about a given person.
Definition persondata.h:35
void dataChanged()
One of the contact sources has changed.
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool isEmpty() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.