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


Copyright © 2008-2010 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.3.11