Akonadi

agentsearchinterface.h
1/*
2 SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadiagentbase_export.h"
10#include <QString>
11
12#include <memory>
13
14namespace Akonadi
15{
16class Collection;
17class AgentSearchInterfacePrivate;
18class ImapSet;
19
20/**
21 * @short An interface for agents (or resources) that support searching in their backend.
22 *
23 * Inherit from this additionally to Akonadi::AgentBase (or Akonadi::ResourceBase)
24 * and implement its two pure virtual methods.
25 *
26 * Make sure to add the @c Search capability to the agent desktop file.
27 *
28 * @since 4.5
29 */
30class AKONADIAGENTBASE_EXPORT AgentSearchInterface
31{
32public:
33 enum ResultScope {
34 Uid,
35 Rid,
36 };
37
38 /**
39 * Creates a new agent search interface.
40 */
42
43 /**
44 * Destroys the agent search interface.
45 */
47
48 /**
49 * Adds a new search.
50 *
51 * @param query The query string, using the language specified in @p queryLanguage
52 * @param queryLanguage The query language used for @p query
53 * @param resultCollection The destination collection for the search results. It's a virtual
54 * collection, results can be added/removed using Akonadi::LinkJob and Akonadi::UnlinkJob respectively.
55 */
56 virtual void addSearch(const QString &query, const QString &queryLanguage, const Akonadi::Collection &resultCollection) = 0;
57
58 /**
59 * Removes a previously added search.
60 * @param resultCollection The result collection given in an previous addSearch() call.
61 * You do not need to take care of deleting results in there, the collection is just provided as a way to
62 * identify the search.
63 */
64 virtual void removeSearch(const Akonadi::Collection &resultCollection) = 0;
65
66 /**
67 * Perform a search on remote storage and return results using SearchResultJob.
68 *
69 * @since 4.13
70 */
71 virtual void search(const QString &query, const Collection &collection) = 0;
72
73 void searchFinished(const QList<qint64> &result, ResultScope scope);
74 Q_DECL_DEPRECATED_X("Use searchFinished(const QList<qint64> &, ResultScope) instead")
75 void searchFinished(const ImapSet &result, ResultScope scope);
76 void searchFinished(const QList<QByteArray> &result);
77
78private:
79 /// @cond PRIVATE
80 std::unique_ptr<AgentSearchInterfacePrivate> const d;
81 /// @endcond
82};
83
84}
An interface for agents (or resources) that support searching in their backend.
virtual void addSearch(const QString &query, const QString &queryLanguage, const Akonadi::Collection &resultCollection)=0
Adds a new search.
virtual void removeSearch(const Akonadi::Collection &resultCollection)=0
Removes a previously added search.
virtual ~AgentSearchInterface()
Destroys the agent search interface.
virtual void search(const QString &query, const Collection &collection)=0
Perform a search on remote storage and return results using SearchResultJob.
Represents a collection of PIM items.
Definition collection.h:62
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:49:11 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.