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

krunner: Load RunCommand.qml file from qrc rather than lookandfeel package

This way we do not load old or broken third party RunCommand.qml files in KRunner.
This also allows us to get rid of compatibility logic for old versions of this file.

BUG: 457174
parent d75ea4c0
Pipeline #227583 passed with stage
in 13 minutes and 20 seconds
set(krunner_SRCS
main.cpp
view.cpp
qml/krunner.qrc
)
set(krunner_dbusAppXML dbus/org.kde.krunner.App.xml)
......
#! /usr/bin/env bash
$XGETTEXT *.cpp -o $podir/krunner.pot
$XGETTEXT *.cpp qml/*.qml -o $podir/krunner.pot
......@@ -72,11 +72,11 @@ ColumnLayout {
runnerWindow.visible = false
runnerWindow.displayConfiguration()
}
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Configure")
Accessible.description: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Configure KRunner Behavior")
Accessible.name: i18n("Configure")
Accessible.description: i18n("Configure KRunner Behavior")
visible: KCMShell.authorize("kcm_krunnersettings.desktop").length > 0
PlasmaComponents3.ToolTip {
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Configure KRunner…")
text: i18n("Configure KRunner…")
}
}
PlasmaExtras.SearchField {
......@@ -87,11 +87,9 @@ ColumnLayout {
Layout.maximumWidth: PlasmaCore.Units.gridUnit * 25
activeFocusOnPress: true
placeholderText: results.runnerName ? i18ndc("plasma_lookandfeel_org.kde.lookandfeel",
"Textfield placeholder text, query specific KRunner",
placeholderText: results.runnerName ? i18nc("Textfield placeholder text, query specific KRunner",
"Search '%1'…", results.runnerName)
: i18ndc("plasma_lookandfeel_org.kde.lookandfeel",
"Textfield placeholder text", "Search…")
: i18nc("Textfield placeholder text", "Search…")
PlasmaComponents3.BusyIndicator {
anchors {
......@@ -227,10 +225,10 @@ ColumnLayout {
// Reset if out quers starts with "?", otherwise set it to "?"
onClicked: root.query = root.query.startsWith("?") ? "" : "?"
icon.name: "question"
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Show Usage Help")
Accessible.description: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Show Usage Help")
Accessible.name: i18n("Show Usage Help")
Accessible.description: i18n("Show Usage Help")
PlasmaComponents3.ToolTip {
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Show Usage Help")
text: i18n("Show Usage Help")
}
}
PlasmaComponents3.ToolButton {
......@@ -238,10 +236,10 @@ ColumnLayout {
checked: runnerWindow.pinned
onToggled: runnerWindow.pinned = checked
icon.name: "window-pin"
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Pin")
Accessible.description: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Pin Search")
Accessible.name: i18n("Pin")
Accessible.description: i18n("Pin Search")
PlasmaComponents3.ToolTip {
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Keep Open")
text: i18n("Keep Open")
}
}
}
......@@ -319,10 +317,10 @@ ColumnLayout {
delegate: Milou.ResultDelegate {
id: resultDelegate
width: listView.width
typeText: index === 0 ? i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Recent Queries") : ""
typeText: index === 0 ? i18n("Recent Queries") : ""
additionalActions: [{
icon: "list-remove",
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Remove")
text: i18n("Remove")
}]
Accessible.description: i18n("in category recent queries")
}
......
<!DOCTYPE RCC>
<!--
SPDX-FileCopyrightText: 2022 Alexander Lohnau <alexander.lohnau@gmx.de>
SPDX-License-Identifier: CC0-1.0
-->
<RCC version="1.0">
<qresource prefix="/krunner/">
<file>RunCommand.qml</file>
</qresource>
</RCC>
......@@ -26,9 +26,6 @@
#include <kdeclarative/qmlobject.h>
#include <KPackage/Package>
#include <KPackage/PackageLoader>
#include <KWayland/Client/connection_thread.h>
#include <KWayland/Client/registry.h>
#include <KWayland/Client/surface.h>
......@@ -72,15 +69,8 @@ View::View(QWindow *)
m_qmlObj->setInitializationDelayed(true);
connect(m_qmlObj, &KDeclarative::QmlObject::finished, this, &View::objectIncubated);
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"));
KConfigGroup cg(KSharedConfig::openConfig(), "KDE");
const QString packageName = cg.readEntry("LookAndFeelPackage", QString());
if (!packageName.isEmpty()) {
package.setPath(packageName);
}
m_qmlObj->engine()->rootContext()->setContextProperty(QStringLiteral("runnerWindow"), this);
m_qmlObj->setSource(package.fileUrl("runcommandmainscript"));
m_qmlObj->setSource(QUrl(QStringLiteral("qrc:/krunner/RunCommand.qml")));
m_qmlObj->completeInitialization();
auto screenRemoved = [this](QScreen *screen) {
......@@ -363,16 +353,3 @@ void View::setPinned(bool pinned)
Q_EMIT pinnedChanged();
}
}
void View::removeFromHistory(int index)
{
if (m_manager) {
m_manager->removeFromHistory(index);
Q_EMIT historyChanged();
}
}
QStringList View::history() const
{
return m_manager ? m_manager->history() : QStringList();
}
......@@ -40,9 +40,6 @@ class View : public PlasmaQuick::Dialog
Q_CLASSINFO("D-Bus Interface", "org.kde.krunner.App")
Q_PROPERTY(bool pinned READ pinned WRITE setPinned NOTIFY pinnedChanged)
Q_PROPERTY(QStringList history READ history NOTIFY historyChanged)
// TODO KF6 This is kept for compatibility with third party themes which override the RunCommand.qml file
Q_PROPERTY(Plasma::RunnerManager *runnerManager WRITE setRunnerManager)
Q_PROPERTY(bool helpEnabled READ helpEnabled NOTIFY helpEnabledChanged)
public:
......@@ -54,23 +51,9 @@ public:
bool freeFloating() const;
void setFreeFloating(bool floating);
QStringList history() const;
bool pinned() const;
void setPinned(bool pinned);
// TODO KF6 This is kept for compatibility with third party themes which override the RunCommand.qml file
Q_SIGNAL void historyChanged();
Q_INVOKABLE void addToHistory(const QString &)
{
// Kept for compatibility, since milou f442b33af3c292c49743083493423275a51c118a the KRunner framework logic is used for handling this
}
Q_INVOKABLE void removeFromHistory(int index);
void setRunnerManager(Plasma::RunnerManager *manager)
{
m_manager = manager;
}
bool helpEnabled()
{
const static auto metaData = KPluginMetaData(QStringLiteral("kf5/krunner/helprunner"));
......
Supports Markdown
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