KPeople::PersonData Class

class KPeople::PersonData

Allows querying the information about a given person. More...

Header: #include <KPeople/PersonData>
CMake: find_package(KF6 REQUIRED COMPONENTS People)
target_link_libraries(mytarget PRIVATE KF6::People)
Since: 5.8
In QML: personData

Properties

Public Functions

PersonData(const QString &id, QObject *parent = nullptr)
QStringList allEmails() const
QVariant contactCustomProperty(const QString &key) const
QStringList contactUris() const
QString email() const
QStringList groups() const
(since 5.62) bool isEditable() const
(since 5.22) bool isValid() const
QString name() const
QString personUri() const
QPixmap photo() const
QUrl pictureUrl() const
QString presence() const
QString presenceIconName() const
(since 5.62) bool setContactCustomProperty(const QString &key, const QVariant &value)

Signals

void dataChanged()

Detailed Description

PersonData exposes the information of a given person (in contrast to everyone available, which is done by PersonsModel). This class will provide comfortable interfaces so it can be easily adopted in any application.

Property Documentation

[read-only, since 5.62] isEditable : const bool

Returns whether setContactCustomProperty can be called on this contact

This property was introduced in 5.62.

Access functions:

bool isEditable() const

[read-only] name : const QString

Access functions:

QString name() const

Notifier signal:

void dataChanged()

[read-only] photo : const QPixmap

Access functions:

QPixmap photo() const

Notifier signal:

void dataChanged()

[read-only] presenceIconName : const QString

Access functions:

QString presenceIconName() const

Notifier signal:

void dataChanged()

Member Function Documentation

PersonData::PersonData(const QString &id, QObject *parent = nullptr)

Creates a Person object from a given ID. The ID can be either a local application specific ID (such as akonadi://?item=15) or a kpeople ID in the form kpeople://15

QStringList PersonData::allEmails() const

Returns all e-mail addresses from the person.

QVariant PersonData::contactCustomProperty(const QString &key) const

Returns the property for a said key.

See also setContactCustomProperty().

QStringList PersonData::contactUris() const

Returns a list of contact ids that identify the PersonData instance.

[signal] void PersonData::dataChanged()

One of the contact sources has changed

Note: Notifier signal for property name. Notifier signal for property photo. Notifier signal for property presenceIconName.

QString PersonData::email() const

Returns the contact's preferred email address.

QStringList PersonData::groups() const

Returns all groups the person is in.

[since 5.62] bool PersonData::isEditable() const

Returns whether the contact can be edited.

Note: Getter function for property isEditable.

This function was introduced in 5.62.

[since 5.22] bool PersonData::isValid() const

Returns true if this PersonData is mapped to some existing contact

This function was introduced in 5.22.

QString PersonData::name() const

Returns the name of the person

Note: Getter function for property name.

QString PersonData::personUri() const

Returns the person's id

QPixmap PersonData::photo() const

Returns a pixmap with the photo of the person, or a default one if not available

Note: Getter function for property photo.

QUrl PersonData::pictureUrl() const

Returns a the url of the picture that represents the contact.

QString PersonData::presence() const

Returns the contact's online presence.

QString PersonData::presenceIconName() const

Returns an icon name that represents the IM status of the person

Note: Getter function for property presenceIconName.

[since 5.62] bool PersonData::setContactCustomProperty(const QString &key, const QVariant &value)

Sends a desired value for the contact according to the key. It's not necessarily implemented. The back-end gets to decide whether a property can be set or not.

Returns whether the property value was changed

This function was introduced in 5.62.

See also contactCustomProperty().