File indexing completed on 2024-05-05 16:16:34
0001 /* 0002 SPDX-FileCopyrightText: 2013 David Edmundson <D.Edmundson@lboro.ac.uk> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #include "declarativepersondata.h" 0008 0009 #include "../persondata.h" 0010 #include "avatarimageprovider.h" 0011 #include "kpeople_debug.h" 0012 #include <imageprovideruri_p.h> 0013 0014 #include <QStringBuilder> 0015 0016 DeclarativePersonData::DeclarativePersonData(QObject *parent) 0017 : QObject(parent) 0018 , m_person(nullptr) 0019 { 0020 connect(this, &DeclarativePersonData::personChanged, this, &DeclarativePersonData::photoImageProviderUriChanged); 0021 } 0022 0023 void DeclarativePersonData::setPersonUri(const QString &id) 0024 { 0025 if (id == m_id) { 0026 return; 0027 } 0028 0029 m_id = id; 0030 delete m_person; 0031 if (m_id.isEmpty()) { 0032 m_person = nullptr; 0033 } else { 0034 m_person = new KPeople::PersonData(id, this); 0035 connect(m_person, &KPeople::PersonData::dataChanged, this, &DeclarativePersonData::photoImageProviderUriChanged); 0036 } 0037 0038 Q_EMIT personChanged(); 0039 } 0040 0041 KPeople::PersonData *DeclarativePersonData::person() const 0042 { 0043 return m_person; 0044 } 0045 0046 QString DeclarativePersonData::photoImageProviderUri() const 0047 { 0048 return ::photoImageProviderUri(m_id); 0049 } 0050 0051 QString DeclarativePersonData::personUri() const 0052 { 0053 return m_id; 0054 } 0055 0056 #include "moc_declarativepersondata.cpp"