File indexing completed on 2024-11-10 04:40:53

0001 /*
0002     SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 #include <QSet>
0011 #include <QStringList>
0012 
0013 namespace Akonadi
0014 {
0015 /**
0016  * @class AbstractSearchPlugin
0017  *
0018  * 3rd party applications can install a search plugin for Akonadi server to
0019  * provide access to their search capability.
0020  *
0021  * When the server performs a search, it will send the query to all available
0022  * search plugins and merge the results.
0023  *
0024  * @since 1.12
0025  */
0026 class AbstractSearchPlugin
0027 {
0028 public:
0029     /**
0030      * Destructor.
0031      */
0032     virtual ~AbstractSearchPlugin() = default;
0033 
0034     /**
0035      * Reimplement this method to provide the actual search capability.
0036      *
0037      * The implementation can block.
0038      *
0039      * @param query Search query to execute.
0040      * @return List of Akonadi Item IDs referring to items that are matching
0041      *         the query.
0042      */
0043     virtual QSet<qint64> search(const QString &query, const QList<qint64> &collections, const QStringList &mimeTypes) = 0;
0044 
0045 protected:
0046     explicit AbstractSearchPlugin() = default;
0047 
0048 private:
0049     Q_DISABLE_COPY_MOVE(AbstractSearchPlugin)
0050 };
0051 
0052 }
0053 
0054 Q_DECLARE_INTERFACE(Akonadi::AbstractSearchPlugin, "org.freedesktop.Akonadi.AbstractSearchPlugin")