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

# profile.h

    00001 /*
    00002  * This file is part of TelepathyQt4
    00003  *
    00004  * Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
    00005  * Copyright (C) 2010 Nokia Corporation
    00006  *
    00007  * This library is free software; you can redistribute it and/or
    00008  * modify it under the terms of the GNU Lesser General Public
    00009  * License as published by the Free Software Foundation; either
    00010  * version 2.1 of the License, or (at your option) any later version.
    00011  *
    00012  * This library is distributed in the hope that it will be useful,
    00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  * Lesser General Public License for more details.
    00016  *
    00017  * You should have received a copy of the GNU Lesser General Public
    00018  * License along with this library; if not, write to the Free Software
    00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    00020  */
    00021
    00022 #ifndef _TelepathyQt4_profile_h_HEADER_GUARD_
    00023 #define _TelepathyQt4_profile_h_HEADER_GUARD_
    00024
    00025 #ifndef IN_TELEPATHY_QT4_HEADER
    00026 #error IN_TELEPATHY_QT4_HEADER
    00027 #endif
    00028
    00029 #include <TelepathyQt4/RequestableChannelClassSpec>
    00030 #include <TelepathyQt4/Types>
    00031
    00032 #include <QDBusSignature>
    00033 #include <QObject>
    00034 #include <QString>
    00035 #include <QVariant>
    00036
    00037 namespace Tp
    00038 {
    00039
    00040 class ProtocolInfo;
    00041
    00042 class TELEPATHY_QT4_EXPORT Profile : public RefCounted
    00043 {
    00044     Q_DISABLE_COPY(Profile);
    00045
    00046 public:
    00047     static ProfilePtr createForServiceName(const QString &serviceName);
    00048     static ProfilePtr createForFileName(const QString &fileName);
    00049
    00050     ~Profile();
    00051
    00052     QString serviceName() const;
    00053
    00054     bool isValid() const;
    00055
    00056     bool isFake() const;
    00057
    00058     QString type() const;
    00059     QString provider() const;
    00060     QString name() const;
    00061     QString iconName() const;
    00062     QString cmName() const;
    00063     QString protocolName() const;
    00064
    00065     class Parameter
    00066     {
    00067     public:
    00068         Parameter();
    00069         Parameter(const Parameter &other);
    00070         Parameter(const QString &name,
    00071                   const QDBusSignature &dbusSignature,
    00072                   const QVariant &value,
    00073                   const QString &label,
    00074                   bool mandatory);
    00075         ~Parameter();
    00076
    00077         QString name() const;
    00078         QDBusSignature dbusSignature() const;
    00079         QVariant::Type type() const;
    00080         QVariant value() const;
    00081         QString label() const;
    00082
    00083         bool isMandatory() const;
    00084
    00085         // TODO Add matches(Tp::Presence) method
    00086
    00087         Parameter &operator=(const Parameter &other);
    00088
    00089     private:
    00090         friend class Profile;
    00091
    00092         void setName(const QString &name);
    00093         void setDBusSignature(const QDBusSignature &dbusSignature);
    00094         void setValue(const QVariant &value);
    00095         void setLabel(const QString &label);
    00096         void setMandatory(bool mandatory);
    00097
    00098         struct Private;
    00099         friend struct Private;
    00100         Private *mPriv;
    00101     };
    00102     typedef QList<Parameter> ParameterList;
    00103
    00104     ParameterList parameters() const;
    00105     bool hasParameter(const QString &name) const;
    00106     Parameter parameter(const QString &name) const;
    00107
    00108     class Presence
    00109     {
    00110     public:
    00111         Presence();
    00112         Presence(const Presence &other);
    00113         Presence(const QString &id,
    00114                  const QString &label,
    00115                  const QString &iconName,
    00116                  const QString &message,
    00117                  bool disabled);
    00118         ~Presence();
    00119
    00120         QString id() const;
    00121         QString label() const;
    00122         QString iconName() const;
    00123         QString message() const;
    00124
    00125         bool isDisabled() const;
    00126
    00127         Presence &operator=(const Presence &other);
    00128
    00129     private:
    00130         friend class Profile;
    00131
    00132         void setId(const QString &id);
    00133         void setLabel(const QString &label);
    00134         void setIconName(const QString &iconName);
    00135         void setMessage(const QString &message);
    00136         void setDisabled(bool disabled);
    00137
    00138         struct Private;
    00139         friend struct Private;
    00140         Private *mPriv;
    00141     };
    00142     typedef QList<Presence> PresenceList;
    00143
    00144     bool allowOtherPresences() const;
    00145     PresenceList presences() const;
    00146     bool hasPresence(const QString &id) const;
    00147     Presence presence(const QString &id) const;
    00148
    00149     TELEPATHY_QT4_DEPRECATED RequestableChannelClassList unsupportedChannelClasses() const;
    00150     RequestableChannelClassSpecList unsupportedChannelClassSpecs() const;
    00151
    00152 private:
    00153     friend class Account;
    00154     friend class ProfileManager;
    00155
    00156     Profile();
    00157     Profile(const QString &serviceName, const QString &cmName,
    00158             const QString &protocolName, const ProtocolInfo *protocolInfo);
    00159
    00160     void setServiceName(const QString &serviceName);
    00161     void setFileName(const QString &fileName);
    00162
    00163     static QStringList searchDirs();
    00164
    00165     struct Private;
    00166     friend struct Private;
    00167     Private *mPriv;
    00168 };
    00169
    00170 } // Tp
    00171
    00172 Q_DECLARE_METATYPE(Tp::Profile::Parameter);
    00173 Q_DECLARE_METATYPE(Tp::Profile::Presence);
    00174
    00175 #endif