Home · All Classes · All Namespaces · Modules · Functions · Files
contact-search-channel.h
1 
23 #ifndef _TelepathyQt_contact_search_channel_h_HEADER_GUARD_
24 #define _TelepathyQt_contact_search_channel_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/Channel>
31 #include <TelepathyQt/Contact>
32 #include <TelepathyQt/Types>
33 
34 namespace Tp
35 {
36 
37 class TP_QT_EXPORT ContactSearchChannel : public Channel
38 {
39  Q_OBJECT
40  Q_DISABLE_COPY(ContactSearchChannel)
41 
42 public:
43  static const Feature FeatureCore;
44 
46  {
47  public:
51 
52  bool isValid() const { return mPriv.constData() != 0; }
53 
54  SearchStateChangeDetails &operator=(const SearchStateChangeDetails &other);
55 
56  bool hasDebugMessage() const { return allDetails().contains(QLatin1String("debug-message")); }
57  QString debugMessage() const { return qdbus_cast<QString>(allDetails().value(QLatin1String("debug-message"))); }
58 
59  QVariantMap allDetails() const;
60 
61  private:
62  friend class ContactSearchChannel;
63 
64  TP_QT_NO_EXPORT SearchStateChangeDetails(const QVariantMap &details);
65 
66  struct Private;
67  friend struct Private;
68  QSharedDataPointer<Private> mPriv;
69  };
70 
71  typedef QHash<ContactPtr, Contact::InfoFields> SearchResult;
72 
73  static ContactSearchChannelPtr create(const ConnectionPtr &connection,
74  const QString &objectPath, const QVariantMap &immutableProperties);
75 
76  virtual ~ContactSearchChannel();
77 
78  ChannelContactSearchState searchState() const;
79  uint limit() const;
80  QStringList availableSearchKeys() const;
81  QString server() const;
82 
83  PendingOperation *search(const QString &searchKey, const QString &searchTerm);
84  PendingOperation *search(const ContactSearchMap &searchTerms);
85  void continueSearch();
86  void stopSearch();
87 
88 Q_SIGNALS:
89  void searchStateChanged(Tp::ChannelContactSearchState state, const QString &errorName,
91  void searchResultReceived(const Tp::ContactSearchChannel::SearchResult &result);
92 
93 protected:
94  ContactSearchChannel(const ConnectionPtr &connection, const QString &objectPath,
95  const QVariantMap &immutableProperties, const Feature &coreFeature);
96 
97 private Q_SLOTS:
98  TP_QT_NO_EXPORT void gotProperties(QDBusPendingCallWatcher *watcher);
99  TP_QT_NO_EXPORT void gotSearchState(QDBusPendingCallWatcher *watcher);
100  TP_QT_NO_EXPORT void onSearchStateChanged(uint state, const QString &error, const QVariantMap &details);
101  TP_QT_NO_EXPORT void onSearchResultReceived(const Tp::ContactSearchResultMap &result);
102  TP_QT_NO_EXPORT void gotSearchResultContacts(Tp::PendingOperation *op);
103 
104 private:
105  class PendingSearch;
106 
107  struct Private;
108  friend struct Private;
109  Private *mPriv;
110 };
111 
112 } // Tp
113 
114 #endif
ChannelContactSearchState
Definition: build/TelepathyQt/_gen/constants.h:2533
The PendingOperation class is a base class for pending asynchronous operations.
Definition: pending-operation.h:45
Definition: build/TelepathyQt/_gen/types.h:1271
QString debugMessage() const
Definition: contact-search-channel.h:57
QHash< ContactPtr, Contact::InfoFields > SearchResult
Definition: contact-search-channel.h:71
The ContactSearchChannel::SearchStateChangeDetails class provides a wrapper around the details for a ...
Definition: contact-search-channel.h:45
The ContactSearchChannel class represents a Telepathy channel of type ContactSearch.
Definition: contact-search-channel.h:37
bool isValid() const
Definition: contact-search-channel.h:52
static const Feature FeatureCore
Definition: contact-search-channel.h:43
Definition: abstract-adaptor.cpp:31
bool hasDebugMessage() const
Definition: contact-search-channel.h:56
The Feature class represents a feature that can be enabled on demand.
Definition: feature.h:41
The Channel class represents a Telepathy channel.
Definition: channel.h:51
Definition: build/TelepathyQt/_gen/types.h:3491


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt 0.9.7