Changeset View
Changeset View
Standalone View
Standalone View
src/impp.h
Show All 33 Lines | |||||
34 | * IMPP stands for "Instant Messaging and Presence Protocol". This field is defined | 34 | * IMPP stands for "Instant Messaging and Presence Protocol". This field is defined | ||
35 | * in the vCard 3.0 extension RFC 4770 and is part of vCard 4.0 (RFC 6350). | 35 | * in the vCard 3.0 extension RFC 4770 and is part of vCard 4.0 (RFC 6350). | ||
36 | * | 36 | * | ||
37 | * @since 4.14.5 | 37 | * @since 4.14.5 | ||
38 | */ | 38 | */ | ||
39 | class KCONTACTS_EXPORT Impp | 39 | class KCONTACTS_EXPORT Impp | ||
40 | { | 40 | { | ||
41 | Q_GADGET | 41 | Q_GADGET | ||
42 | Q_PROPERTY(bool isValid READ isValid) | ||||
43 | Q_PROPERTY(QUrl address READ address WRITE setAddress) | ||||
42 | Q_PROPERTY(bool isPreferred READ isPreferred WRITE setPreferred) | 44 | Q_PROPERTY(bool isPreferred READ isPreferred WRITE setPreferred) | ||
45 | Q_PROPERTY(QString serviceType READ serviceType) | ||||
46 | Q_PROPERTY(QString serviceLabel READ serviceLabel) | ||||
47 | Q_PROPERTY(QString serviceIcon READ serviceIcon) | ||||
43 | 48 | | |||
44 | friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Impp &); | 49 | friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Impp &); | ||
45 | friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Impp &); | 50 | friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Impp &); | ||
46 | public: | 51 | public: | ||
47 | Impp(); | 52 | Impp(); | ||
48 | Impp(const Impp &other); | 53 | Impp(const Impp &other); | ||
49 | Impp(const QString &address); | 54 | Impp(const QUrl &address); | ||
50 | 55 | | |||
51 | ~Impp(); | 56 | ~Impp(); | ||
52 | 57 | | |||
53 | typedef QVector<Impp> List; | 58 | typedef QVector<Impp> List; | ||
54 | enum ImppType { | | |||
55 | Unknown = 0, | | |||
56 | Skype = 1, | | |||
57 | Xmpp = 2, | | |||
58 | Jabber = 3, | | |||
59 | Sip = 4, | | |||
60 | Aim = 5, | | |||
61 | Msn = 6, | | |||
62 | Twitter = 7, | | |||
63 | GoogleTalk = 8, | | |||
64 | Yahoo = 9, | | |||
65 | Qq = 10, | | |||
66 | GaduGadu = 11, | | |||
67 | Ownclound = 12, | | |||
68 | Icq = 13, | | |||
69 | Facebook = 14, | | |||
70 | EndList | | |||
71 | }; | | |||
72 | Q_REQUIRED_RESULT bool isValid() const; | 59 | Q_REQUIRED_RESULT bool isValid() const; | ||
73 | 60 | | |||
74 | Q_REQUIRED_RESULT ImppType type() const; | 61 | void setAddress(const QUrl &address); | ||
75 | void setType(ImppType type); | 62 | Q_REQUIRED_RESULT QUrl address() const; | ||
76 | 63 | | |||
77 | void setAddress(const QString &address); | 64 | /** | ||
78 | Q_REQUIRED_RESULT QString address() const; | 65 | * Returns the messaging service this address is for. | ||
66 | * This is equivalent to address().scheme(). | ||||
67 | * @since 5.12 | ||||
68 | */ | ||||
69 | QString serviceType() const; | ||||
70 | /** | ||||
71 | * Returns a translated label for the service type. | ||||
72 | * @since 5.12 | ||||
73 | */ | ||||
74 | QString serviceLabel() const; | ||||
75 | /** | ||||
76 | * Returns the name of an icon representing the service type. | ||||
77 | * @since 5.12 | ||||
78 | */ | ||||
79 | QString serviceIcon() const; | ||||
79 | 80 | | |||
80 | /** | 81 | /** | ||
81 | * Returns whether this is the preferred messaging address. | 82 | * Returns whether this is the preferred messaging address. | ||
82 | * @since 5.12 | 83 | * @since 5.12 | ||
83 | */ | 84 | */ | ||
84 | bool isPreferred() const; | 85 | bool isPreferred() const; | ||
85 | /** | 86 | /** | ||
86 | * Sets that this is the preferred messaging address. | 87 | * Sets that this is the preferred messaging address. | ||
87 | * @since 5.12 | 88 | * @since 5.12 | ||
88 | */ | 89 | */ | ||
89 | void setPreferred(bool preferred); | 90 | void setPreferred(bool preferred); | ||
90 | 91 | | |||
91 | void setParameters(const QMap<QString, QStringList> ¶ms); | 92 | void setParameters(const QMap<QString, QStringList> ¶ms); | ||
92 | Q_REQUIRED_RESULT QMap<QString, QStringList> parameters() const; | 93 | Q_REQUIRED_RESULT QMap<QString, QStringList> parameters() const; | ||
93 | 94 | | |||
94 | Q_REQUIRED_RESULT bool operator==(const Impp &other) const; | 95 | Q_REQUIRED_RESULT bool operator==(const Impp &other) const; | ||
95 | Q_REQUIRED_RESULT bool operator!=(const Impp &other) const; | 96 | Q_REQUIRED_RESULT bool operator!=(const Impp &other) const; | ||
96 | 97 | | |||
97 | Impp &operator=(const Impp &other); | 98 | Impp &operator=(const Impp &other); | ||
98 | 99 | | |||
99 | Q_REQUIRED_RESULT QString toString() const; | 100 | Q_REQUIRED_RESULT QString toString() const; | ||
100 | 101 | | |||
101 | Q_REQUIRED_RESULT static QString typeToString(ImppType type); | | |||
102 | | ||||
103 | /** | 102 | /** | ||
104 | * Returns a translated name of the given IM service. | 103 | * Returns a translated name of the given IM service. | ||
105 | * @since 5.12 | 104 | * @since 5.12 | ||
106 | */ | 105 | */ | ||
107 | static QString serviceLabel(const QString &serviceType); | 106 | static QString serviceLabel(const QString &serviceType); | ||
108 | /** | 107 | /** | ||
109 | * Returns an icon name representing the given IM service. | 108 | * Returns an icon name representing the given IM service. | ||
110 | * @since 5.12 | 109 | * @since 5.12 | ||
Show All 22 Lines |