Commit afff43ef authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

baloosearchruner: Emit DBus error when baloo is disabled

Otherwise we exit and KRunner runner into a long timeout.

By making this a dedicated DBus error KRunner can also know, that this
runner can not be started. Consequently making new attempts to query
this runner can be prevented.

Because the runner is DBus-Activated, we can not exit the process, otherwise other
processes (like the search in the app launcher) will have the same issue with the timeout.
BUG: 445342


(cherry picked from commit fa5ac3fe)
parent 4caf3673
......@@ -31,10 +31,6 @@ static const QString s_openParentDirId = QStringLiteral("openParentDir");
int main(int argc, char **argv)
{
Baloo::IndexerConfig config;
if (!config.fileIndexingEnabled()) {
return -1;
}
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager);
QApplication::setQuitOnLastWindowClosed(false);
QApplication app(argc, argv); // KRun needs widgets for error message boxes
......@@ -60,11 +56,21 @@ SearchRunner::~SearchRunner()
RemoteActions SearchRunner::Actions()
{
Baloo::IndexerConfig config;
if (!config.fileIndexingEnabled()) {
sendErrorReply(QDBusError::ErrorType::NotSupported);
}
return RemoteActions({RemoteAction{s_openParentDirId, i18n("Open Containing Folder"), QStringLiteral("document-open-folder")}});
}
RemoteMatches SearchRunner::Match(const QString &searchTerm)
{
Baloo::IndexerConfig config;
if (!config.fileIndexingEnabled()) {
sendErrorReply(QDBusError::ErrorType::NotSupported);
return {};
}
// Do not try to show results for queries starting with =
// this should trigger the calculator, but the AdvancedQueryParser::parse method
// in baloo interpreted it as an operator, BUG 345134
......
......@@ -14,7 +14,7 @@
#include "dbusutils_p.h"
#include <KRunner/QueryMatch>
class SearchRunner : public QObject
class SearchRunner : public QObject, protected QDBusContext
{
Q_OBJECT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment