libqutim 0.2.80.1
|
00001 /**************************************************************************** 00002 ** 00003 ** qutIM - instant messenger 00004 ** 00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru> 00006 ** 00007 ***************************************************************************** 00008 ** 00009 ** $QUTIM_BEGIN_LICENSE$ 00010 ** This program is free software: you can redistribute it and/or modify 00011 ** it under the terms of the GNU General Public License as published by 00012 ** the Free Software Foundation, either version 3 of the License, or 00013 ** (at your option) any later version. 00014 ** 00015 ** This program is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 ** See the GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see http://www.gnu.org/licenses/. 00022 ** $QUTIM_END_LICENSE$ 00023 ** 00024 ****************************************************************************/ 00025 #ifndef ABSTRACTSEARCHREQUEST_H 00026 #define ABSTRACTSEARCHREQUEST_H 00027 00028 #include <QVariant> 00029 #include <QSharedData> 00030 #include "localizedstring.h" 00031 #include "dataforms.h" 00032 00033 namespace qutim_sdk_0_3 00034 { 00035 class AbstractSearchFactoryPrivate; 00036 00037 class LIBQUTIM_EXPORT AbstractSearchRequest : public QObject 00038 { 00039 Q_OBJECT 00040 Q_DISABLE_COPY(AbstractSearchRequest) 00041 public: 00042 AbstractSearchRequest(); 00043 virtual ~AbstractSearchRequest(); 00044 virtual DataItem fields() const = 0; 00045 virtual QSet<QString> services() const; 00046 virtual void setService(const QString &service); 00047 virtual void start(const DataItem &fields) = 0; 00048 virtual void cancel() = 0; 00049 virtual int actionCount() const = 0; 00050 virtual QVariant actionData(int index, int role = Qt::DisplayRole) = 0; 00051 virtual void actionActivated(int actionIndex, int row) = 0; 00052 virtual int columnCount() const = 0; 00053 virtual QVariant headerData(int column, int role = Qt::DisplayRole) = 0; 00054 virtual int rowCount() const = 0; 00055 virtual QVariant data(int row, int column, int role = Qt::DisplayRole) = 0; 00056 signals: 00057 void done(bool ok); 00058 void rowAboutToBeAdded(int row); 00059 void rowAdded(int row); 00060 void fieldsUpdated(); 00061 void servicesUpdated(); 00062 void actionsUpdated(); 00063 }; 00064 00065 class LIBQUTIM_EXPORT AbstractSearchFactory : public QObject 00066 { 00067 Q_OBJECT 00068 Q_DISABLE_COPY(AbstractSearchFactory ) 00069 Q_DECLARE_PRIVATE(AbstractSearchFactory ) 00070 public: 00071 AbstractSearchFactory(); 00072 virtual ~AbstractSearchFactory(); 00073 virtual QStringList requestList() const = 0; 00074 virtual QVariant data(const QString &request, int role = Qt::DisplayRole); 00075 virtual AbstractSearchRequest *request(const QString &name) const = 0; 00076 signals: 00077 void requestAdded(const QString &request); 00078 void requestRemoved(const QString &request); 00079 void requestUpdated(const QString &request); 00080 protected: 00081 AbstractSearchFactory(AbstractSearchFactoryPrivate *d); 00082 QScopedPointer<AbstractSearchFactoryPrivate> d_ptr; 00083 }; 00084 00085 } // namespace qutim_sdk_0_3 00086 00087 #endif // ABSTRACTSEARCHREQUEST_H 00088