File indexing completed on 2024-05-05 16:16:34
0001 /* 0002 SPDX-FileCopyrightText: 2014 Aleix Pol i Gonzalez <aleixpol@blue-systems.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef KPEOPLE_ABSTRACT_CONTACT_H 0008 #define KPEOPLE_ABSTRACT_CONTACT_H 0009 0010 #include <QSharedData> 0011 #include <QVariant> 0012 #include <kpeoplebackend/kpeoplebackend_export.h> 0013 0014 namespace KPeople 0015 { 0016 /** 0017 * @brief KPeople::AbstractContact is the class to provide the data from a given 0018 * contact by the backends. 0019 * 0020 * To obtain it from a front-end application PersonData and PersonsModel 0021 * should be used. 0022 * 0023 * @since 5.8 0024 * @internal 0025 */ 0026 0027 class KPEOPLEBACKEND_EXPORT AbstractContact : public QSharedData 0028 { 0029 public: 0030 typedef QExplicitlySharedDataPointer<AbstractContact> Ptr; 0031 typedef QList<AbstractContact::Ptr> List; 0032 AbstractContact(); 0033 virtual ~AbstractContact(); 0034 0035 // well-known properties 0036 /** String property representing the display name of the contact */ 0037 static const QString NameProperty; 0038 0039 /** String property representing the preferred name of the contact */ 0040 static const QString EmailProperty; 0041 0042 /** String property representing the preferred phone number of the contact */ 0043 static const QString PhoneNumberProperty; 0044 0045 /** QVariantList property that lists all phone numbers the contact has */ 0046 static const QString AllPhoneNumbersProperty; 0047 0048 /** 0049 * String property representing the IM presence of the contact. 0050 * @sa KPeople::iconNameForPresenceString() 0051 */ 0052 static const QString PresenceProperty; 0053 0054 /** 0055 * QUrl or QPixmap property representing the contacts' avatar 0056 */ 0057 static const QString PictureProperty; 0058 0059 /** QVariantList property that lists the groups the contacts belongs to */ 0060 static const QString GroupsProperty; 0061 0062 /** QVariantList property that lists the emails the contact has */ 0063 static const QString AllEmailsProperty; 0064 0065 /** QByteArray with the raw vcard information */ 0066 static const QString VCardProperty; 0067 0068 /** 0069 * Generic method to access a random contact property 0070 * 0071 * @returns the value for the @p key property. 0072 */ 0073 virtual QVariant customProperty(const QString &key) const = 0; 0074 0075 private: 0076 Q_DISABLE_COPY(AbstractContact) 0077 }; 0078 0079 } 0080 0081 Q_DECLARE_METATYPE(KPeople::AbstractContact::List) 0082 Q_DECLARE_METATYPE(KPeople::AbstractContact::Ptr) 0083 0084 #endif