/usr/include/KF5/KRunner/krunner/runnermanager.h is in libkf5runner-dev 5.44.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | /*
* Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
* Copyright (C) 2007 Ryan P. Bitanga <ryan.bitanga@gmail.com>
* Copyright (C) 2008 Jordi Polo <mumismo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_RUNNERMANAGER_H
#define PLASMA_RUNNERMANAGER_H
#include <QtCore/QList>
#include <QtCore/QObject>
#include <kplugininfo.h>
#include "krunner_export.h"
#include "abstractrunner.h"
class QAction;
class KConfigGroup;
namespace Plasma
{
class QueryMatch;
class AbstractRunner;
class RunnerContext;
class RunnerManagerPrivate;
/**
* @class RunnerManager runnermanager.h <KRunner/RunnerManager>
*
* @short The RunnerManager class decides what installed runners are runnable,
* and their ratings. It is the main proxy to the runners.
*/
class KRUNNER_EXPORT RunnerManager : public QObject
{
Q_OBJECT
public:
explicit RunnerManager(QObject *parent=nullptr);
explicit RunnerManager(KConfigGroup &config, QObject *parent=nullptr);
~RunnerManager();
/**
* Finds and returns a loaded runner or NULL
* @param pluginName the name of the runner plugin
* @return Pointer to the runner
*/
AbstractRunner *runner(const QString &pluginName) const;
/**
* @return the currently active "single mode" runner, or null if none
* @since 4.4
*/
AbstractRunner *singleModeRunner() const;
/**
* Puts the manager into "single runner" mode using the given
* runner; if the runner does not exist or can not be loaded then
* the single runner mode will not be started and singleModeRunner()
* will return NULL
* @param id the id of the runner to use
* @since 4.4
*/
void setSingleModeRunnerId(const QString &id);
/**
* @return the id of the runner to use in single mode
* @since 4.4
*/
QString singleModeRunnerId() const;
/**
* @return true if the manager is set to run in single runner mode
* @since 4.4
*/
bool singleMode() const;
/**
* Sets whether or not the manager is in single mode.
*
* @param singleMode true if the manager should be in single mode, false otherwise
* @since 4.4
*/
void setSingleMode(bool singleMode);
/**
* Returns the translated name of a runner
* @param id the id of the runner
*
* @since 4.4
*/
QString runnerName(const QString &id) const;
/**
* @return the list of all currently loaded runners
*/
QList<AbstractRunner *> runners() const;
/**
* @return the names of all runners that advertise single query mode
* @since 4.4
*/
QStringList singleModeAdvertisedRunnerIds() const;
/**
* Retrieves the current context
* @return pointer to the current context
*/
RunnerContext *searchContext() const;
/**
* Retrieves all available matches found so far for the previously launched query
* @return List of matches
*/
QList<QueryMatch> matches() const;
/**
* Runs a given match
* @param match the match to be executed
*/
void run(const QueryMatch &match);
/**
* Runs a given match
* @param id the id of the match to run
*/
void run(const QString &id);
/**
* Retrieves the list of actions, if any, for a match
*/
QList<QAction*> actionsForMatch(const QueryMatch &match);
/**
* @return the current query term
*/
QString query() const;
/**
* Causes a reload of the current configuration
*/
void reloadConfiguration();
/**
* Sets a whitelist for the plugins that can be loaded
*
* @param plugins the plugin names of allowed runners
* @since 4.4
*/
void setAllowedRunners(const QStringList &runners);
/**
* Sets the list of categories which matches should be
* returned for. It also internally tries not to execute the
* runners which do not fall in this category.
*/
void setEnabledCategories(const QStringList &categories);
/**
* Attempts to add the AbstractRunner plugin represented
* by the KService passed in. Usually one can simply let
* the configuration of plugins handle loading Runner plugins,
* but in cases where specific runners should be loaded this
* allows for that to take place
*
* @param service the service to use to load the plugin
* @since 4.5
*/
void loadRunner(const KService::Ptr service);
/**
* Attempts to add the AbstractRunner from a Plasma::Package on disk.
* Usually one can simply let the configuration of plugins
* handle loading Runner plugins, but in cases where specific
* runners should be loaded this allows for that to take place
*
* @param path the path to a Runner package to load
* @since 4.5
*/
void loadRunner(const QString &path);
/**
* @return the list of allowed plugins
* @since 4.4
*/
QStringList allowedRunners() const;
/**
* @return the list of enabled categories
*/
QStringList enabledCategories() const;
/**
* @return mime data of the specified match
* @since 4.5
*/
QMimeData * mimeDataForMatch(const QueryMatch &match) const;
/**
* @return mime data of the specified match
* @since 4.5
*/
QMimeData * mimeDataForMatch(const QString &matchId) const;
/**
* Returns a list of all known Runner implementations
*
* @param parentApp the application to filter applets on. Uses the
* X-KDE-ParentApp entry (if any) in the plugin info.
* The default value of QString() will result in a
* list containing only applets not specifically
* registered to an application.
* @return list of AbstractRunners
* @since 4.6
**/
static KPluginInfo::List listRunnerInfo(const QString &parentApp = QString());
public Q_SLOTS:
/**
* Call this method when the runners should be prepared for a query session.
* Call matchSessionComplete when the query session is finished for the time
* being.
* @since 4.4
* @see matchSessionComplete
*/
void setupMatchSession();
/**
* Call this method when the query session is finished for the time
* being.
* @since 4.4
* @see prepareForMatchSession
*/
void matchSessionComplete();
/**
* Launch a query, this will create threads and return inmediately.
* When the information will be available can be known using the
* matchesChanged signal.
*
* @param term the term we want to find matches for
* @param runnerId optional, if only one specific runner is to be used;
* providing an id will put the manager into single runner mode
*/
void launchQuery(const QString &term, const QString &runnerId);
/**
* Convenience version of above
*/
void launchQuery(const QString &term);
/**
* Reset the current data and stops the query
*/
void reset();
Q_SIGNALS:
/**
* Emitted each time a new match is added to the list
*/
void matchesChanged(const QList<Plasma::QueryMatch> &matches);
/**
* Emitted when the launchQuery finish
* @since 4.5
*/
void queryFinished();
private:
Q_PRIVATE_SLOT(d, void scheduleMatchesChanged())
Q_PRIVATE_SLOT(d, void matchesChanged())
Q_PRIVATE_SLOT(d, void jobDone(ThreadWeaver::JobPointer))
Q_PRIVATE_SLOT(d, void unblockJobs())
Q_PRIVATE_SLOT(d, void runnerMatchingSuspended(bool))
RunnerManagerPrivate * const d;
friend class RunnerManagerPrivate;
};
}
#endif
|