profile.h Source File

| Home · All Classes · All Namespaces · Modules · Functions · Files

profile.h
1
23 #ifndef _TelepathyQt_profile_h_HEADER_GUARD_
24 #define _TelepathyQt_profile_h_HEADER_GUARD_
25
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29
30 #include <TelepathyQt/RequestableChannelClassSpec>
31 #include <TelepathyQt/Types>
32
33 #include <QDBusSignature>
34 #include <QObject>
35 #include <QString>
36 #include <QVariant>
37
38 namespace Tp
39 {
40
41 class ProtocolInfo;
42
43 class TP_QT_EXPORT Profile : public RefCounted
44 {
45 Q_DISABLE_COPY(Profile);
46
47 public:
48 static ProfilePtr createForServiceName(const QString &serviceName);
49 static ProfilePtr createForFileName(const QString &fileName);
50
51 ~Profile();
52
53 QString serviceName() const;
54
55 bool isValid() const;
56
57 bool isFake() const;
58
59 QString type() const;
60 QString provider() const;
61 QString name() const;
62 QString iconName() const;
63 QString cmName() const;
64 QString protocolName() const;
65
66 class Parameter
67 {
68 public:
69 Parameter();
70 Parameter(const Parameter &other);
71 Parameter(const QString &name,
72 const QDBusSignature &dbusSignature,
73 const QVariant &value,
74 const QString &label,
75 bool mandatory);
76 ~Parameter();
77
78 QString name() const;
79 QDBusSignature dbusSignature() const;
80 QVariant::Type type() const;
81 QVariant value() const;
82 QString label() const;
83
84 bool isMandatory() const;
85
86 // TODO Add matches(Tp::Presence) method
87
88 Parameter &operator=(const Parameter &other);
89
90 private:
91 friend class Profile;
92
93 TP_QT_NO_EXPORT void setName(const QString &name);
94 TP_QT_NO_EXPORT void setDBusSignature(const QDBusSignature &dbusSignature);
95 TP_QT_NO_EXPORT void setValue(const QVariant &value);
96 TP_QT_NO_EXPORT void setLabel(const QString &label);
97 TP_QT_NO_EXPORT void setMandatory(bool mandatory);
98
99 struct Private;
100 friend struct Private;
101 Private *mPriv;
102 };
103 typedef QList<Parameter> ParameterList;
104
105 ParameterList parameters() const;
106 bool hasParameter(const QString &name) const;
107 Parameter parameter(const QString &name) const;
108
109 class Presence
110 {
111 public:
112 Presence();
113 Presence(const Presence &other);
114 Presence(const QString &id,
115 const QString &label,
116 const QString &iconName,
117 const QString &message,
118 bool disabled);
119 ~Presence();
120
121 QString id() const;
122 QString label() const;
123 QString iconName() const;
124 bool canHaveStatusMessage() const;
125
126 bool isDisabled() const;
127
128 Presence &operator=(const Presence &other);
129
130 private:
131 friend class Profile;
132
133 TP_QT_NO_EXPORT void setId(const QString &id);
134 TP_QT_NO_EXPORT void setLabel(const QString &label);
135 TP_QT_NO_EXPORT void setIconName(const QString &iconName);
136 TP_QT_NO_EXPORT void setMessage(const QString &message);
137 TP_QT_NO_EXPORT void setDisabled(bool disabled);
138
139 struct Private;
140 friend struct Private;
141 Private *mPriv;
142 };
143 typedef QList<Presence> PresenceList;
144
145 bool allowOtherPresences() const;
146 PresenceList presences() const;
147 bool hasPresence(const QString &id) const;
148 Presence presence(const QString &id) const;
149
150 RequestableChannelClassSpecList unsupportedChannelClassSpecs() const;
151
152 private:
153 friend class Account;
154 friend class ProfileManager;
155
156 TP_QT_NO_EXPORT Profile();
157 TP_QT_NO_EXPORT Profile(const QString &serviceName, const QString &cmName,
158 const QString &protocolName, const ProtocolInfo &protocolInfo);
159
160 TP_QT_NO_EXPORT void setServiceName(const QString &serviceName);
161 TP_QT_NO_EXPORT void setFileName(const QString &fileName);
162
163 TP_QT_NO_EXPORT static QStringList searchDirs();
164
165 struct Private;
166 friend struct Private;
167 Private *mPriv;
168 };
169
170 } // Tp
171
172 Q_DECLARE_METATYPE(Tp::Profile::Parameter);
173 Q_DECLARE_METATYPE(Tp::Profile::Presence);
174
175 #endif
Tp::Profile::Parameter
The Profile::Parameter class represents a parameter defined in .profile files.
Definition: profile.h:66
Tp::Profile::Presence
The Profile::Presence class represents a presence defined in .profile files.
Definition: profile.h:109
Tp::Profile
The Profile class provides an easy way to read Telepathy profile files according to http://telepathy...
Definition: profile.h:43
Tp::ProtocolInfo
The ProtocolInfo class represents a Telepathy Protocol.
Definition: protocol-info.h:46
Tp::Profile::ParameterList
QList< Parameter > ParameterList
Definition: profile.h:103
Tp::Profile::PresenceList
QList< Presence > PresenceList
Definition: profile.h:143
Tp::ProfileManager
The ProfileManager class provides helper methods to retrieve Profile objects.
Definition: profile-manager.h:43
Tp::RefCounted
The RefCounted class is a base class for shared objects used by SharedPtr.
Definition: shared-ptr.h:42
Tp::RequestableChannelClassSpecList
The RequestableChannelClassSpecList class represents a list of RequestableChannelClassSpec.
Definition: requestable-channel-class-spec.h:101
Tp::Account
The Account class represents a Telepathy account.
Definition: account.h:68