00001
00023 #ifndef _TelepathyQt4_simple_observer_h_HEADER_GUARD_
00024 #define _TelepathyQt4_simple_observer_h_HEADER_GUARD_
00025
00026 #include <TelepathyQt4/AbstractClientObserver>
00027 #include <TelepathyQt4/ChannelClassFeatures>
00028 #include <TelepathyQt4/Types>
00029
00030 #include <QObject>
00031
00032 namespace Tp
00033 {
00034
00035 class PendingOperation;
00036
00037 class TELEPATHY_QT4_EXPORT SimpleObserver : public QObject, public RefCounted
00038 {
00039 Q_OBJECT
00040 Q_DISABLE_COPY(SimpleObserver)
00041
00042 public:
00043 static SimpleObserverPtr create(const AccountPtr &account,
00044 const ChannelClassSpecList &channelFilter,
00045 const QList<ChannelClassFeatures> &extraChannelFeatures =
00046 QList<ChannelClassFeatures>());
00047 static SimpleObserverPtr create(const AccountPtr &account,
00048 const ChannelClassSpecList &channelFilter,
00049 const ContactPtr &contact,
00050 const QList<ChannelClassFeatures> &extraChannelFeatures =
00051 QList<ChannelClassFeatures>());
00052 static SimpleObserverPtr create(const AccountPtr &account,
00053 const ChannelClassSpecList &channelFilter,
00054 const QString &contactIdentifier,
00055 const QList<ChannelClassFeatures> &extraChannelFeatures =
00056 QList<ChannelClassFeatures>());
00057
00058 virtual ~SimpleObserver();
00059
00060 AccountPtr account() const;
00061 ChannelClassSpecList channelFilter() const;
00062 QString contactIdentifier() const;
00063 QList<ChannelClassFeatures> extraChannelFeatures() const;
00064
00065 QList<ChannelPtr> channels() const;
00066
00067 Q_SIGNALS:
00068 void newChannels(const QList<Tp::ChannelPtr> &channels);
00069 void channelInvalidated(const Tp::ChannelPtr &channel, const QString &errorName,
00070 const QString &errorMessage);
00071
00072 private Q_SLOTS:
00073 TELEPATHY_QT4_NO_EXPORT void onAccountConnectionChanged(const Tp::ConnectionPtr &connection);
00074 TELEPATHY_QT4_NO_EXPORT void onAccountConnectionConnected();
00075 TELEPATHY_QT4_NO_EXPORT void onContactConstructed(Tp::PendingOperation *op);
00076
00077 TELEPATHY_QT4_NO_EXPORT void onNewChannels(const Tp::AccountPtr &channelsAccount,
00078 const QList<Tp::ChannelPtr> &channels);
00079 TELEPATHY_QT4_NO_EXPORT void onChannelInvalidated(const Tp::AccountPtr &channelAccount,
00080 const Tp::ChannelPtr &channel, const QString &errorName, const QString &errorMessage);
00081
00082 private:
00083 friend class SimpleCallObserver;
00084 friend class SimpleTextObserver;
00085
00086 TELEPATHY_QT4_NO_EXPORT static SimpleObserverPtr create(const AccountPtr &account,
00087 const ChannelClassSpecList &channelFilter,
00088 const QString &contactIdentifier,
00089 bool requiresNormalization,
00090 const QList<ChannelClassFeatures> &extraChannelFeatures);
00091
00092 TELEPATHY_QT4_NO_EXPORT SimpleObserver(const AccountPtr &account,
00093 const ChannelClassSpecList &channelFilter,
00094 const QString &contactIdentifier,
00095 bool requiresNormalization,
00096 const QList<ChannelClassFeatures> &extraChannelFeatures);
00097
00098 struct Private;
00099 friend struct Private;
00100 Private *mPriv;
00101 };
00102
00103 }
00104
00105 #endif