File indexing completed on 2023-12-03 08:28:34
0001 /* 0002 * Copyright (C) 2013 Daniel Vrátil <dvratil@redhat.com> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0017 * 0018 */ 0019 0020 #ifndef KTP_PENDINGLOGGERSEARCH_H 0021 #define KTP_PENDINGLOGGERSEARCH_H 0022 0023 #include <KTp/Logger/pending-logger-operation.h> 0024 #include <KTp/Logger/log-search-hit.h> 0025 0026 #include <KTp/ktpcommoninternals_export.h> 0027 0028 namespace KTp { 0029 0030 /** 0031 * @brief An operation that will retrieve list of chat logs matching given search 0032 * term. 0033 * 0034 * The operation will emit finished(KTp::PendingLoggerOperation*) signal when 0035 * search is finished. When an error occurs in any backend hasError() will be 0036 * set to true. Use error() to retrieve the error message. 0037 * 0038 * @since 0.7 0039 * @author Daniel Vrátil <dvratil@redhat.com> 0040 */ 0041 class KTPCOMMONINTERNALS_EXPORT PendingLoggerSearch : public KTp::PendingLoggerOperation 0042 { 0043 Q_OBJECT 0044 0045 public: 0046 /** 0047 * Destructor. 0048 */ 0049 ~PendingLoggerSearch() override; 0050 0051 /** 0052 * Returns the search term that is used. 0053 */ 0054 QString term() const; 0055 0056 /** 0057 * Returns list of hits matching givem search term. 0058 */ 0059 QList<KTp::LogSearchHit> searchHits() const; 0060 0061 protected: 0062 explicit PendingLoggerSearch(const QString &term, 0063 QObject *parent = nullptr); 0064 0065 void appendSearchHits(const QList<KTp::LogSearchHit> &searchHits); 0066 void appendSearchHit(const KTp::LogSearchHit &searchHit); 0067 0068 private: 0069 class Private; 0070 Private * const d; 0071 0072 }; 0073 0074 } // namespace KTp 0075 0076 #endif // KTP_PENDINGLOGGERSEARCH_H