Adjust to removed QueryMatch::Type enum in KRunner

master
Alexander Lohnau 10 months ago
parent 8102c8cf72
commit 22dfc8978e

@ -19,7 +19,6 @@ Dependencies:
'frameworks/knewstuff': '@latest-kf6'
'frameworks/knotifications': '@latest-kf6'
'frameworks/kpackage': '@latest-kf6'
'frameworks/krunner': '@latest-kf6'
'frameworks/kservice': '@latest-kf6'
'frameworks/ksvg': '@latest-kf6'
'frameworks/kwidgetsaddons': '@latest-kf6'

@ -129,13 +129,6 @@ set_package_properties(KF6DocTools PROPERTIES
)
add_feature_info("KF6DocTools" KF6DocTools_FOUND "Enable building documentation")
find_package(KF6Runner ${KF6_MIN_VERSION} CONFIG)
set_package_properties(KF6Runner PROPERTIES
PURPOSE "Enable building of KWin with krunner support"
TYPE OPTIONAL
)
add_feature_info("KF6Runner" KF6Runner_FOUND "Enable building of KWin with krunner support")
find_package(KF6Kirigami2 ${KF6_MIN_VERSION} CONFIG)
set_package_properties(KF6Kirigami2 PROPERTIES
DESCRIPTION "A QtQuick based components set"
@ -379,7 +372,7 @@ ecm_find_qmlmodule(org.kde.plasma.components 2.0)
########### configure tests ###############
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF6Activities_FOUND" OFF)
cmake_dependent_option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON "KF6Runner_FOUND" OFF)
option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON)
set(HAVE_GLX ${epoxy_HAS_GLX})
get_target_property(QT_DISABLED_FEATURES Qt6::Gui QT_DISABLED_PUBLIC_FEATURES)

@ -6,6 +6,6 @@ set(krunnerintegration_SOURCES
qt_add_dbus_adaptor(krunnerintegration_SOURCES org.kde.krunner1.xml windowsrunnerinterface.h KWin::WindowsRunner)
kcoreaddons_add_plugin(krunnerintegration SOURCES ${krunnerintegration_SOURCES} INSTALL_NAMESPACE "kwin/plugins")
target_link_libraries(krunnerintegration kwin KF6::I18n KF6::Runner)
target_link_libraries(krunnerintegration kwin KF6::I18n)
install(FILES kwin-runner-windows.desktop DESTINATION ${KDE_INSTALL_DATAROOTDIR}/krunner/dbusplugins)

@ -10,19 +10,21 @@
#pragma once
#include <KRunner/QueryMatch>
#include <QDBusArgument>
#include <QList>
#include <QString>
#include <QVariantMap>
const qreal HighestCategoryRelevance = 100; // KRunner::QueryMatch::CategoryRelevance::Highest
const qreal LowCategoryRelevance = 30;
struct RemoteMatch
{
// sssuda{sv}
QString id;
QString text;
QString iconName;
KRunner::QueryMatch::Type type = KRunner::QueryMatch::NoMatch;
int categoryRelevance = HighestCategoryRelevance;
qreal relevance = 0;
QVariantMap properties;
};
@ -56,7 +58,7 @@ inline QDBusArgument &operator<<(QDBusArgument &argument, const RemoteMatch &mat
argument << match.id;
argument << match.text;
argument << match.iconName;
argument << match.type;
argument << match.categoryRelevance;
argument << match.relevance;
argument << match.properties;
argument.endStructure();
@ -69,9 +71,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteMatc
argument >> match.id;
argument >> match.text;
argument >> match.iconName;
uint type;
argument >> type;
match.type = (KRunner::QueryMatch::Type)type;
argument >> match.categoryRelevance;
argument >> match.relevance;
argument >> match.properties;
argument.endStructure();

@ -172,9 +172,9 @@ RemoteMatches WindowsRunner::Match(const QString &searchTerm)
const QString appName = window->resourceClass();
const QString name = window->caption();
if (name.startsWith(term, Qt::CaseInsensitive) || appName.startsWith(term, Qt::CaseInsensitive)) {
matches << windowsMatch(window, action, 0.8, KRunner::QueryMatch::ExactMatch);
matches << windowsMatch(window, action, 0.8, HighestCategoryRelevance);
} else if ((name.contains(term, Qt::CaseInsensitive) || appName.contains(term, Qt::CaseInsensitive)) && actionSupported(window, action)) {
matches << windowsMatch(window, action, 0.7, KRunner::QueryMatch::PossibleMatch);
matches << windowsMatch(window, action, 0.7, LowCategoryRelevance);
}
}
@ -192,7 +192,7 @@ RemoteMatches WindowsRunner::Match(const QString &searchTerm)
continue;
}
if ((window->desktops().contains(desktop) || window->isOnAllDesktops()) && actionSupported(window, action)) {
matches << windowsMatch(window, action, 0.5, KRunner::QueryMatch::PossibleMatch);
matches << windowsMatch(window, action, 0.5, LowCategoryRelevance);
}
}
}
@ -254,7 +254,7 @@ RemoteMatch WindowsRunner::desktopMatch(const VirtualDesktop *desktop, const Win
{
RemoteMatch match;
match.id = QString::number(action) + QLatin1Char('_') + desktop->id();
match.type = KRunner::QueryMatch::ExactMatch;
match.categoryRelevance = HighestCategoryRelevance;
match.iconName = QStringLiteral("user-desktop");
match.text = desktop->name();
match.relevance = relevance;
@ -266,14 +266,14 @@ RemoteMatch WindowsRunner::desktopMatch(const VirtualDesktop *desktop, const Win
return match;
}
RemoteMatch WindowsRunner::windowsMatch(const Window *window, const WindowsRunnerAction action, qreal relevance, KRunner::QueryMatch::Type type) const
RemoteMatch WindowsRunner::windowsMatch(const Window *window, const WindowsRunnerAction action, qreal relevance, qreal categoryRelevance) const
{
RemoteMatch match;
match.id = QString::number((int)action) + QLatin1Char('_') + window->internalId().toString();
match.text = window->caption();
match.iconName = window->icon().name();
match.relevance = relevance;
match.type = type;
match.categoryRelevance = categoryRelevance;
QVariantMap properties;
const QList<VirtualDesktop *> desktops = window->desktops();

@ -15,8 +15,6 @@
#include "dbusutils_p.h"
#include "plugin.h"
#include <KRunner/QueryMatch>
#include <QDBusArgument>
#include <QDBusContext>
#include <QDBusMessage>
@ -56,7 +54,7 @@ private:
};
RemoteMatch desktopMatch(const VirtualDesktop *desktop, const WindowsRunnerAction action = ActivateDesktopAction, qreal relevance = 1.0) const;
RemoteMatch windowsMatch(const Window *window, const WindowsRunnerAction action = ActivateAction, qreal relevance = 1.0, KRunner::QueryMatch::Type type = KRunner::QueryMatch::ExactMatch) const;
RemoteMatch windowsMatch(const Window *window, const WindowsRunnerAction action = ActivateAction, qreal relevance = 1.0, qreal categoryRelevance = HighestCategoryRelevance) const;
bool actionSupported(const Window *window, const WindowsRunnerAction action) const;
};
}

Loading…
Cancel
Save