Home · All Classes · All Namespaces · Modules · Functions · Files
contact-search-channel.h
00001 
00023 #ifndef _TelepathyQt4_contact_search_channel_h_HEADER_GUARD_
00024 #define _TelepathyQt4_contact_search_channel_h_HEADER_GUARD_
00025 
00026 #ifndef IN_TELEPATHY_QT4_HEADER
00027 #error IN_TELEPATHY_QT4_HEADER
00028 #endif
00029 
00030 #include <TelepathyQt4/Channel>
00031 #include <TelepathyQt4/Contact>
00032 #include <TelepathyQt4/Types>
00033 
00034 namespace Tp
00035 {
00036 
00037 class TELEPATHY_QT4_EXPORT ContactSearchChannel : public Channel
00038 {
00039     Q_OBJECT
00040     Q_DISABLE_COPY(ContactSearchChannel)
00041 
00042 public:
00043     static const Feature FeatureCore;
00044 
00045     class SearchStateChangeDetails
00046     {
00047     public:
00048         SearchStateChangeDetails();
00049         SearchStateChangeDetails(const SearchStateChangeDetails &other);
00050         ~SearchStateChangeDetails();
00051 
00052         bool isValid() const { return mPriv.constData() != 0; }
00053 
00054         SearchStateChangeDetails &operator=(const SearchStateChangeDetails &other);
00055 
00056         bool hasDebugMessage() const { return allDetails().contains(QLatin1String("debug-message")); }
00057         QString debugMessage() const { return qdbus_cast<QString>(allDetails().value(QLatin1String("debug-message"))); }
00058 
00059         QVariantMap allDetails() const;
00060 
00061     private:
00062         friend class ContactSearchChannel;
00063 
00064         TELEPATHY_QT4_NO_EXPORT SearchStateChangeDetails(const QVariantMap &details);
00065 
00066         struct Private;
00067         friend struct Private;
00068         QSharedDataPointer<Private> mPriv;
00069     };
00070 
00071     typedef QHash<ContactPtr, Contact::InfoFields> SearchResult;
00072 
00073     static ContactSearchChannelPtr create(const ConnectionPtr &connection,
00074             const QString &objectPath, const QVariantMap &immutableProperties);
00075 
00076     virtual ~ContactSearchChannel();
00077 
00078     ChannelContactSearchState searchState() const;
00079     uint limit() const;
00080     QStringList availableSearchKeys() const;
00081     QString server() const;
00082 
00083     PendingOperation *search(const QString &searchKey, const QString &searchTerm);
00084     PendingOperation *search(const ContactSearchMap &searchTerms);
00085     void continueSearch();
00086     void stopSearch();
00087 
00088 Q_SIGNALS:
00089     void searchStateChanged(Tp::ChannelContactSearchState state, const QString &errorName,
00090             const Tp::ContactSearchChannel::SearchStateChangeDetails &details);
00091     void searchResultReceived(const Tp::ContactSearchChannel::SearchResult &result);
00092 
00093 protected:
00094     ContactSearchChannel(const ConnectionPtr &connection, const QString &objectPath,
00095             const QVariantMap &immutableProperties, const Feature &coreFeature);
00096 
00097 private Q_SLOTS:
00098     TELEPATHY_QT4_NO_EXPORT void gotProperties(QDBusPendingCallWatcher *watcher);
00099     TELEPATHY_QT4_NO_EXPORT void gotSearchState(QDBusPendingCallWatcher *watcher);
00100     TELEPATHY_QT4_NO_EXPORT void onSearchStateChanged(uint state, const QString &error, const QVariantMap &details);
00101     TELEPATHY_QT4_NO_EXPORT void onSearchResultReceived(const Tp::ContactSearchResultMap &result);
00102     TELEPATHY_QT4_NO_EXPORT void gotSearchResultContacts(Tp::PendingOperation *op);
00103 
00104 private:
00105     class PendingSearch;
00106 
00107     struct Private;
00108     friend struct Private;
00109     Private *mPriv;
00110 };
00111 
00112 } // Tp
00113 
00114 #endif


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.6.5