KRunner
runnermanager.cpp
39 RunnerManagerPrivate(const KConfigGroup &configurationGroup, const KConfigGroup &stateConfigGroup, RunnerManager *parent)
47 matchChangeTimer.setTimerType(Qt::TimerType::PreciseTimer); // Without this, autotest will fail due to imprecision of this timer
65 // This will tell us if we are reseting the matches to start a new search. RunnerContext::reset() clears its query string for its emission
70 // We are starting a new search, we shall stall for some time before deciding to show an empty matches list.
71 // This stall should be enough for the engine to provide more meaningful result, so we avoid refreshing with
77 // We have an empty input string, so it's not a real query. We don't expect any results to come, so no need to stall
127 QObject::connect(runner->thread(), &QThread::finished, runner->thread(), &QObject::deleteLater);
149 bool selected = loadAll || disabledRunnerIds.contains(runnerName) || (isPluginEnabled && (noWhiteList || whiteList.contains(runnerName)));
190 qCWarning(KRUNNER).nospace() << "Could not load runner " << pluginMetaData.name() << ":" << res.errorString
229 // If there are any new matches scheduled to be notified, we should anticipate it and just refresh right now
282 bool matchesRegex = singleMode || !runner->hasMatchRegex() || runner->matchRegex().match(query).hasMatch();
293 QMetaObject::invokeMethod(runner, "matchInternal", Qt::QueuedConnection, Q_ARG(KRunner::RunnerContext, context));
301 q->connect(watcher.data(), &KConfigWatcher::configChanged, q, [this](const KConfigGroup &group, const QByteArrayList &changedNames) {
355 stateData.group(QStringLiteral("History")).writeEntry(historyEnvironmentIdentifier, historyEntries, KConfig::Notify);
361 return stateData.group(QStringLiteral("History")).readEntry(historyEnvironmentIdentifier, QStringList());
388RunnerManager::RunnerManager(const KConfigGroup &pluginConfigGroup, const KConfigGroup &stateConfigGroup, QObject *parent)
399 auto defaultStatePtr = KSharedConfig::openConfig(QStringLiteral("krunnerstaterc"), KConfig::NoGlobals, QStandardPaths::GenericDataLocation);
490 Q_EMIT requestUpdateQueryString(d->context.requestedQueryString(), d->context.requestedCursorPosition());
502 QList<KPluginMetaData> pluginMetaDatas = KPluginMetaData::findPlugins(QStringLiteral("kf6/krunner"));
510 QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("krunner/dbusplugins"), QStandardPaths::LocateDirectory);
511 const QStringList dbusRunnerFiles = KFileUtils::findAllUniqueFiles(dBusPlugindirs, QStringList(QStringLiteral("*.desktop")));
Notify
KConfigGroup group(const QString &group)
QString name() const
bool isValid() const
KConfig * config()
QString readEntry(const char *key, const char *aDefault=nullptr) const
KConfigGroup parent() const
static Ptr create(const KSharedConfig::Ptr &config)
void configChanged(const KConfigGroup &group, const QByteArrayList &names)
QString name() const
NoGlobals
QString pluginId() const
bool value(QStringView key, bool defaultValue) const
QString fileName() const
static QList< KPluginMetaData > findPlugins(const QString &directory, std::function< bool(const KPluginMetaData &)> filter={}, KPluginMetaDataOptions options={})
QString name() const
bool isEnabled(const T &config) const
bool isValid() const
An abstract base class for Plasma Runner plugins.
Definition abstractrunner.h:45
QString name() const
Returns the translated name from the runner's metadata.
Definition abstractrunner.cpp:88
void teardown()
This signal is emitted when a session of matches is complete, giving runners the opportunity to tear ...
virtual void run(const KRunner::RunnerContext &context, const KRunner::QueryMatch &match)
Called whenever an exact or possible match associated with this runner is triggered.
Definition abstractrunner.cpp:84
void prepare()
This signal is emitted when matching is about to commence, giving runners an opportunity to prepare t...
This class represents an action that will be shown next to a match.
Definition action.h:23
A match returned by an AbstractRunner in response to a given RunnerContext.
Definition querymatch.h:32
The RunnerContext class provides information related to a search, including the search term and colle...
Definition runnercontext.h:32
QList< QueryMatch > matches() const
Retrieves all available matches for the current search term.
Definition runnercontext.cpp:219
void setHistoryEnabled(bool enabled)
Enables/disabled the history feature for the RunnerManager instance.
Definition runnermanager.cpp:697
void setupMatchSession()
Call this method when the runners should be prepared for a query session.
Definition runnermanager.cpp:523
bool run(const QueryMatch &match, const KRunner::Action &action={})
Runs a given match.
Definition runnermanager.cpp:471
QList< QueryMatch > matches() const
Retrieves all available matches found so far for the previously launched query.
Definition runnermanager.cpp:466
RunnerManager(const KConfigGroup &pluginConfigGroup, const KConfigGroup &stateGroup, QObject *parent)
Constructs a RunnerManager with the given parameters.
Definition runnermanager.cpp:388
QMimeData * mimeDataForMatch(const QueryMatch &match) const
Definition runnermanager.cpp:495
AbstractRunner * runner(const QString &pluginId) const
Finds and returns a loaded runner or a nullptr.
Definition runnermanager.cpp:444
void reloadConfiguration()
Causes a reload of the current configuration This gets called automatically when the config in the KC...
Definition runnermanager.cpp:412
Q_INVOKABLE void setHistoryEnvironmentIdentifier(const QString &identifier)
Set the environment identifier for recording history and launch counts.
Definition runnermanager.cpp:708
static QList< KPluginMetaData > runnerMetaDataList()
Definition runnermanager.cpp:500
void setAllowedRunners(const QStringList &runners)
Sets a whitelist for the plugins that can be loaded by this manager.
Definition runnermanager.cpp:420
AbstractRunner * loadRunner(const KPluginMetaData &pluginMetaData)
Attempts to add the AbstractRunner plugin represented by the plugin info passed in.
Definition runnermanager.cpp:429
Q_INVOKABLE void removeFromHistory(int index)
Delete the given index from the history.
Definition runnermanager.cpp:653
void matchSessionComplete()
Call this method when the query session is finished for the time being.
Definition runnermanager.cpp:546
void historyEnabledChanged()
void matchesChanged(const QList< KRunner::QueryMatch > &matches)
Emitted each time a new match is added to the list.
Q_INVOKABLE QString getHistorySuggestion(const QString &typedQuery) const
Get the suggested history entry for the typed query.
Definition runnermanager.cpp:662
void requestUpdateQueryString(const QString &term, int cursorPosition)
Put the given search term in the KRunner search field.
void launchQuery(const QString &term, const QString &runnerId=QString())
Launch a query, this will create threads and return immediately.
Definition runnermanager.cpp:558
QList< AbstractRunner * > runners() const
Definition runnermanager.cpp:453
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
KCOREADDONS_EXPORT QStringList findAllUniqueFiles(const QStringList &dirs, const QStringList &nameFilters={})
qint64 currentMSecsSinceEpoch()
qint64 elapsed() const const
bool hasExpired(qint64 timeout) const const
qint64 restart()
void start()
iterator insert(const Key &key, const T &value)
void append(QList< T > &&value)
const T & constFirst() const const
bool contains(const AT &value) const const
qsizetype count() const const
bool isEmpty() const const
qsizetype length() const const
void prepend(parameter_type value)
void removeAt(qsizetype i)
void removeLast()
bool removeOne(const AT &t)
qsizetype size() const const
bool invokeMethod(QObject *context, Functor &&function, FunctorReturnType *ret)
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
QThread * thread() const const
bool contains(const QSet< T > &other) const const
iterator insert(const T &value)
bool isEmpty() const const
bool remove(const T &value)
void reserve(qsizetype size)
LocateDirectory
GenericDataLocation
QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options)
QString & insert(qsizetype position, QChar ch)
bool isEmpty() const const
qsizetype length() const const
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QString trimmed() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
CaseInsensitive
QueuedConnection
void finished()
bool isActive() const const
void setSingleShot(bool singleShot)
void start()
void stop()
void timeout()
void setTimerType(Qt::TimerType atype)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.