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

profile.h

    00001
    00023 #ifndef _TelepathyQt4_profile_h_HEADER_GUARD_
    00024 #define _TelepathyQt4_profile_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TELEPATHY_QT4_HEADER
    00027 #error IN_TELEPATHY_QT4_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt4/RequestableChannelClassSpec>
    00031 #include <TelepathyQt4/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 TELEPATHY_QT4_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         // TODO Add matches(Tp::Presence) method
    00087
    00088         Parameter &operator=(const Parameter &other);
    00089
    00090     private:
    00091         friend class Profile;
    00092
    00093         TELEPATHY_QT4_NO_EXPORT void setName(const QString &name);
    00094         TELEPATHY_QT4_NO_EXPORT void setDBusSignature(const QDBusSignature &dbusSignature);
    00095         TELEPATHY_QT4_NO_EXPORT void setValue(const QVariant &value);
    00096         TELEPATHY_QT4_NO_EXPORT void setLabel(const QString &label);
    00097         TELEPATHY_QT4_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         TELEPATHY_QT4_DEPRECATED QString message() const;
    00126
    00127         bool isDisabled() const;
    00128
    00129         Presence &operator=(const Presence &other);
    00130
    00131     private:
    00132         friend class Profile;
    00133
    00134         TELEPATHY_QT4_NO_EXPORT void setId(const QString &id);
    00135         TELEPATHY_QT4_NO_EXPORT void setLabel(const QString &label);
    00136         TELEPATHY_QT4_NO_EXPORT void setIconName(const QString &iconName);
    00137         TELEPATHY_QT4_NO_EXPORT void setMessage(const QString &message);
    00138         TELEPATHY_QT4_NO_EXPORT void setDisabled(bool disabled);
    00139
    00140         struct Private;
    00141         friend struct Private;
    00142         Private *mPriv;
    00143     };
    00144     typedef QList<Presence> PresenceList;
    00145
    00146     bool allowOtherPresences() const;
    00147     PresenceList presences() const;
    00148     bool hasPresence(const QString &id) const;
    00149     Presence presence(const QString &id) const;
    00150
    00151     RequestableChannelClassSpecList unsupportedChannelClassSpecs() const;
    00152
    00153 private:
    00154     friend class Account;
    00155     friend class ProfileManager;
    00156
    00157     TELEPATHY_QT4_NO_EXPORT Profile();
    00158     TELEPATHY_QT4_NO_EXPORT Profile(const QString &serviceName, const QString &cmName,
    00159             const QString &protocolName, const ProtocolInfo &protocolInfo);
    00160
    00161     TELEPATHY_QT4_NO_EXPORT void setServiceName(const QString &serviceName);
    00162     TELEPATHY_QT4_NO_EXPORT void setFileName(const QString &fileName);
    00163
    00164     TELEPATHY_QT4_NO_EXPORT static QStringList searchDirs();
    00165
    00166     struct Private;
    00167     friend struct Private;
    00168     Private *mPriv;
    00169 };
    00170
    00171 } // Tp
    00172
    00173 Q_DECLARE_METATYPE(Tp::Profile::Parameter);
    00174 Q_DECLARE_METATYPE(Tp::Profile::Presence);
    00175
    00176 #endif