KPeople 5.109.0
persondata.h
1/*
2 KPeople
3 SPDX-FileCopyrightText: 2013 David Edmundson (davidedmundson@kde.org)
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef PERSONDATA_H
9#define PERSONDATA_H
10
11#include <kpeople/kpeople_export.h>
12
13#include <QObject>
14#include <QPixmap>
15
16#include "global.h"
17
18namespace KPeople
19{
20class PersonDataPrivate;
21
22class PersonData;
23
34class KPEOPLE_EXPORT PersonData : public QObject
35{
36 Q_OBJECT
37 Q_PROPERTY(QString name READ name NOTIFY dataChanged)
38 Q_PROPERTY(QPixmap photo READ photo NOTIFY dataChanged)
39 Q_PROPERTY(QString presenceIconName READ presenceIconName NOTIFY dataChanged)
40
41
46 Q_PROPERTY(bool isEditable READ isEditable CONSTANT)
47
48public:
53 PersonData(const QString &id, QObject *parent = nullptr);
54
55 ~PersonData() override;
56
61 bool isValid() const;
62
64 QString personUri() const;
65
69 QStringList contactUris() const;
70
74 QString name() const;
75
79 QString presenceIconName() const;
80
84 QPixmap photo() const;
85
89 Q_SCRIPTABLE QVariant contactCustomProperty(const QString &key) const;
90
100 Q_SCRIPTABLE bool setContactCustomProperty(const QString &key, const QVariant &value);
101
105 QString presence() const;
106
110 QString email() const;
111
115 QUrl pictureUrl() const;
116
118 QStringList groups() const;
119
121 QStringList allEmails() const;
122
128 bool isEditable() const;
129
130 // struct PhoneNumber {
131 // QString name;
132 // QString number;
133 // };
134 // QVector<PhoneNumber> phoneNumbers() const { createPhoneNumbers(customProperty("phoneNumbers")); };
135
136Q_SIGNALS:
141
142private Q_SLOTS:
143 KPEOPLE_NO_EXPORT void onContactChanged();
144
145private:
146 Q_DISABLE_COPY(PersonData)
147 Q_DECLARE_PRIVATE(PersonData)
148 PersonDataPrivate *d_ptr;
149};
150}
151
152#endif // PERSONDATA_H
Allows to query the information about a given person.
Definition persondata.h:35
QString email() const
Returns the contact's preferred email address.
bool setContactCustomProperty(const QString &key, const QVariant &value)
Sends a desired value for the contact according to the key.
void dataChanged()
One of the contact sources has changed.
QUrl pictureUrl() const
Returns a the url of the picture that represents the contact.
QPixmap photo() const
QString name() const
QStringList allEmails() const
Returns all e-mail addresses from the person.
QString presence() const
Returns the contact's online presence.
PersonData(const QString &id, QObject *parent=nullptr)
Creates a Person object from a given ID.
QString personUri() const
Returns the person's id.
bool isValid() const
Returns true if this PersonData is mapped to some existing contact.
QStringList contactUris() const
Returns a list of contact ids that identify the PersonData instance.
QString presenceIconName() const
QStringList groups() const
Returns all groups the person is in.
bool isEditable() const
QVariant contactCustomProperty(const QString &key) const