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

connection-manager.h

00001 /*
00002  * This file is part of TelepathyQt4
00003  *
00004  * Copyright (C) 2008-2010 Collabora Ltd. <http://www.collabora.co.uk/>
00005  * Copyright (C) 2008-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_connection_manager_h_HEADER_GUARD_
00023 #define _TelepathyQt4_connection_manager_h_HEADER_GUARD_
00024 
00025 #ifndef IN_TELEPATHY_QT4_HEADER
00026 #error IN_TELEPATHY_QT4_HEADER
00027 #endif
00028 
00029 #include <TelepathyQt4/_gen/cli-connection-manager.h>
00030 
00031 #include <TelepathyQt4/ChannelFactory>
00032 #include <TelepathyQt4/ConnectionFactory>
00033 #include <TelepathyQt4/Constants>
00034 #include <TelepathyQt4/ContactFactory>
00035 #include <TelepathyQt4/DBus>
00036 #include <TelepathyQt4/DBusProxy>
00037 #include <TelepathyQt4/OptionalInterfaceFactory>
00038 #include <TelepathyQt4/ProtocolInfo>
00039 #include <TelepathyQt4/ProtocolParameter>
00040 #include <TelepathyQt4/ReadinessHelper>
00041 #include <TelepathyQt4/SharedPtr>
00042 #include <TelepathyQt4/Types>
00043 
00044 namespace Tp
00045 {
00046 
00047 class ConnectionManagerLowlevel;
00048 class PendingConnection;
00049 class PendingStringList;
00050 
00051 class TELEPATHY_QT4_EXPORT ConnectionManager : public StatelessDBusProxy,
00052                 public OptionalInterfaceFactory<ConnectionManager>
00053 {
00054     Q_OBJECT
00055     Q_DISABLE_COPY(ConnectionManager)
00056     Q_PROPERTY(QString name READ name)
00057     Q_PROPERTY(QStringList supportedProtocols READ supportedProtocols)
00058     Q_PROPERTY(ProtocolInfoList protocols READ protocols)
00059 
00060 public:
00061     static const Feature FeatureCore;
00062 
00063     static ConnectionManagerPtr create(const QDBusConnection &bus,
00064             const QString &name);
00065     static ConnectionManagerPtr create(const QString &name,
00066             const ConnectionFactoryConstPtr &connectionFactory =
00067                 ConnectionFactory::create(QDBusConnection::sessionBus()),
00068             const ChannelFactoryConstPtr &channelFactory =
00069                 ChannelFactory::create(QDBusConnection::sessionBus()),
00070             const ContactFactoryConstPtr &contactFactory =
00071                 ContactFactory::create());
00072     static ConnectionManagerPtr create(const QDBusConnection &bus,
00073             const QString &name,
00074             const ConnectionFactoryConstPtr &connectionFactory,
00075             const ChannelFactoryConstPtr &channelFactory,
00076             const ContactFactoryConstPtr &contactFactory =
00077                 ContactFactory::create());
00078 
00079     virtual ~ConnectionManager();
00080 
00081     QString name() const;
00082 
00083     ConnectionFactoryConstPtr connectionFactory() const;
00084     ChannelFactoryConstPtr channelFactory() const;
00085     ContactFactoryConstPtr contactFactory() const;
00086 
00087     QStringList supportedProtocols() const;
00088     const ProtocolInfoList &protocols() const;
00089     bool hasProtocol(const QString &protocolName) const;
00090     ProtocolInfo protocol(const QString &protocolName) const;
00091 
00092     static PendingStringList *listNames(
00093             const QDBusConnection &bus = QDBusConnection::sessionBus());
00094 
00095 #if defined(BUILDING_TELEPATHY_QT4) || defined(TP_QT4_ENABLE_LOWLEVEL_API)
00096     ConnectionManagerLowlevelPtr lowlevel();
00097     ConnectionManagerLowlevelConstPtr lowlevel() const;
00098 #endif
00099 
00100 protected:
00101     ConnectionManager(const QDBusConnection &bus, const QString &name,
00102             const ConnectionFactoryConstPtr &connectionFactory,
00103             const ChannelFactoryConstPtr &channelFactory,
00104             const ContactFactoryConstPtr &contactFactory);
00105 
00106     Client::ConnectionManagerInterface *baseInterface() const;
00107 
00108 private Q_SLOTS:
00109     void gotMainProperties(QDBusPendingCallWatcher *);
00110     void gotProtocolsLegacy(QDBusPendingCallWatcher *);
00111     void gotParametersLegacy(QDBusPendingCallWatcher *);
00112     void onProtocolReady(Tp::PendingOperation *);
00113 
00114 private:
00115     friend class PendingConnection;
00116 
00117     struct Private;
00118     friend struct Private;
00119     Private *mPriv;
00120 };
00121 
00122 } // Tp
00123 
00124 #endif


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