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         Parameter &operator=(const Parameter &other);
00086 
00087     private:
00088         friend class Profile;
00089 
00090         void setName(const QString &name);
00091         void setDBusSignature(const QDBusSignature &dbusSignature);
00092         void setValue(const QVariant &value);
00093         void setLabel(const QString &label);
00094         void setMandatory(bool mandatory);
00095 
00096         struct Private;
00097         friend struct Private;
00098         Private *mPriv;
00099     };
00100     typedef QList<Parameter> ParameterList;
00101 
00102     ParameterList parameters() const;
00103     bool hasParameter(const QString &name) const;
00104     Parameter parameter(const QString &name) const;
00105 
00106     class Presence
00107     {
00108     public:
00109         Presence();
00110         Presence(const Presence &other);
00111         Presence(const QString &id,
00112                  const QString &label,
00113                  const QString &iconName,
00114                  const QString &message,
00115                  bool disabled);
00116         ~Presence();
00117 
00118         QString id() const;
00119         QString label() const;
00120         QString iconName() const;
00121         QString message() const;
00122 
00123         bool isDisabled() const;
00124 
00125         Presence &operator=(const Presence &other);
00126 
00127     private:
00128         friend class Profile;
00129 
00130         void setId(const QString &id);
00131         void setLabel(const QString &label);
00132         void setIconName(const QString &iconName);
00133         void setMessage(const QString &message);
00134         void setDisabled(bool disabled);
00135 
00136         struct Private;
00137         friend struct Private;
00138         Private *mPriv;
00139     };
00140     typedef QList<Presence> PresenceList;
00141 
00142     bool allowOtherPresences() const;
00143     PresenceList presences() const;
00144     bool hasPresence(const QString &id) const;
00145     Presence presence(const QString &id) const;
00146 
00147     TELEPATHY_QT4_DEPRECATED RequestableChannelClassList unsupportedChannelClasses() const;
00148     RequestableChannelClassSpecList unsupportedChannelClassSpecs() const;
00149 
00150 private:
00151     friend class Account;
00152     friend class ProfileManager;
00153 
00154     Profile();
00155     Profile(const QString &serviceName, const QString &cmName,
00156             const QString &protocolName, const ProtocolInfo *protocolInfo);
00157 
00158     void setServiceName(const QString &serviceName);
00159     void setFileName(const QString &fileName);
00160 
00161     static QStringList searchDirs();
00162 
00163     struct Private;
00164     friend struct Private;
00165     Private *mPriv;
00166 };
00167 
00168 } // Tp
00169 
00170 #endif


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