00001
00023 #ifndef _TelepathyQt_profile_h_HEADER_GUARD_
00024 #define _TelepathyQt_profile_h_HEADER_GUARD_
00025
00026 #ifndef IN_TP_QT_HEADER
00027 #error IN_TP_QT_HEADER
00028 #endif
00029
00030 #include <TelepathyQt/RequestableChannelClassSpec>
00031 #include <TelepathyQt/Types>
00032
00033 #include <QDBusSignature>
00034 #include <QObject>
00035 #include <QString>
00036 #include <QVariant>
00037
00038 namespace Tp
00039 {
00040
00041 class ProtocolInfo;
00042
00043 class TP_QT_EXPORT Profile : public RefCounted
00044 {
00045 Q_DISABLE_COPY(Profile);
00046
00047 public:
00048 static ProfilePtr createForServiceName(const QString &serviceName);
00049 static ProfilePtr createForFileName(const QString &fileName);
00050
00051 ~Profile();
00052
00053 QString serviceName() const;
00054
00055 bool isValid() const;
00056
00057 bool isFake() const;
00058
00059 QString type() const;
00060 QString provider() const;
00061 QString name() const;
00062 QString iconName() const;
00063 QString cmName() const;
00064 QString protocolName() const;
00065
00066 class Parameter
00067 {
00068 public:
00069 Parameter();
00070 Parameter(const Parameter &other);
00071 Parameter(const QString &name,
00072 const QDBusSignature &dbusSignature,
00073 const QVariant &value,
00074 const QString &label,
00075 bool mandatory);
00076 ~Parameter();
00077
00078 QString name() const;
00079 QDBusSignature dbusSignature() const;
00080 QVariant::Type type() const;
00081 QVariant value() const;
00082 QString label() const;
00083
00084 bool isMandatory() const;
00085
00086
00087
00088 Parameter &operator=(const Parameter &other);
00089
00090 private:
00091 friend class Profile;
00092
00093 TP_QT_NO_EXPORT void setName(const QString &name);
00094 TP_QT_NO_EXPORT void setDBusSignature(const QDBusSignature &dbusSignature);
00095 TP_QT_NO_EXPORT void setValue(const QVariant &value);
00096 TP_QT_NO_EXPORT void setLabel(const QString &label);
00097 TP_QT_NO_EXPORT void setMandatory(bool mandatory);
00098
00099 struct Private;
00100 friend struct Private;
00101 Private *mPriv;
00102 };
00103 typedef QList<Parameter> ParameterList;
00104
00105 ParameterList parameters() const;
00106 bool hasParameter(const QString &name) const;
00107 Parameter parameter(const QString &name) const;
00108
00109 class Presence
00110 {
00111 public:
00112 Presence();
00113 Presence(const Presence &other);
00114 Presence(const QString &id,
00115 const QString &label,
00116 const QString &iconName,
00117 const QString &message,
00118 bool disabled);
00119 ~Presence();
00120
00121 QString id() const;
00122 QString label() const;
00123 QString iconName() const;
00124 bool canHaveStatusMessage() const;
00125
00126 bool isDisabled() const;
00127
00128 Presence &operator=(const Presence &other);
00129
00130 private:
00131 friend class Profile;
00132
00133 TP_QT_NO_EXPORT void setId(const QString &id);
00134 TP_QT_NO_EXPORT void setLabel(const QString &label);
00135 TP_QT_NO_EXPORT void setIconName(const QString &iconName);
00136 TP_QT_NO_EXPORT void setMessage(const QString &message);
00137 TP_QT_NO_EXPORT void setDisabled(bool disabled);
00138
00139 struct Private;
00140 friend struct Private;
00141 Private *mPriv;
00142 };
00143 typedef QList<Presence> PresenceList;
00144
00145 bool allowOtherPresences() const;
00146 PresenceList presences() const;
00147 bool hasPresence(const QString &id) const;
00148 Presence presence(const QString &id) const;
00149
00150 RequestableChannelClassSpecList unsupportedChannelClassSpecs() const;
00151
00152 private:
00153 friend class Account;
00154 friend class ProfileManager;
00155
00156 TP_QT_NO_EXPORT Profile();
00157 TP_QT_NO_EXPORT Profile(const QString &serviceName, const QString &cmName,
00158 const QString &protocolName, const ProtocolInfo &protocolInfo);
00159
00160 TP_QT_NO_EXPORT void setServiceName(const QString &serviceName);
00161 TP_QT_NO_EXPORT void setFileName(const QString &fileName);
00162
00163 TP_QT_NO_EXPORT static QStringList searchDirs();
00164
00165 struct Private;
00166 friend struct Private;
00167 Private *mPriv;
00168 };
00169
00170 }
00171
00172 Q_DECLARE_METATYPE(Tp::Profile::Parameter);
00173 Q_DECLARE_METATYPE(Tp::Profile::Presence);
00174
00175 #endif