File indexing completed on 2024-05-12 15:51:16

0001 // SPDX-FileCopyrightText: 2015 Dan Leinir Turthra Jensen <admin@leinir.dk>
0002 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
0003 // SPDX-License-Identifier: LGPL-2.1-only or LGPL-3.0-only or LicenseRef-KDE-Accepted-LGPL
0004 
0005 #pragma once
0006 
0007 #include "contentlisterbase.h"
0008 #include <memory>
0009 
0010 #include <Baloo/QueryRunnable>
0011 
0012 #include <QString>
0013 
0014 class BalooContentLister : public ContentListerBase
0015 {
0016     Q_OBJECT
0017 public:
0018     explicit BalooContentLister(QObject *parent = nullptr);
0019     ~BalooContentLister() override;
0020 
0021     /**
0022      * @returns whether Baloo is enabled. If baloo is not available on the system, we cannot use it.
0023      */
0024     bool balooEnabled() const;
0025 
0026     /**
0027      * \brief Start a search.
0028      * @param queries  List of ContentQueries that the search should be limited to.
0029      */
0030     void startSearch(const QList<ContentQuery *> &queries) override;
0031 
0032 private:
0033     class Private;
0034     std::unique_ptr<Private> d;
0035 
0036     Q_SLOT void queryCompleted(Baloo::QueryRunnable *query);
0037     void queryResult(const ContentQuery *query, const QString &location, const QString &file);
0038 };