Verified Commit dc57d322 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

krunner: Restore history related property and methods for compatibility with third party themes

BUG: 433173

Test Plan:
Use install old RunCommand.qml files provided by bug reporters and
verify that adding/viewing/completing and deleting from history works.

https://bugs.kde.org/attachment.cgi?id=136815
https://bugs.kde.org/attachment.cgi?id=136816
parent d522ebba
...@@ -23,6 +23,7 @@ target_link_libraries(krunner ...@@ -23,6 +23,7 @@ target_link_libraries(krunner
KF5::Crash KF5::Crash
KF5::WaylandClient KF5::WaylandClient
KF5::QuickAddons KF5::QuickAddons
KF5::Runner
PW::KWorkspace PW::KWorkspace
) )
target_compile_definitions(krunner PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}") target_compile_definitions(krunner PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}")
......
...@@ -379,3 +379,16 @@ void View::setPinned(bool pinned) ...@@ -379,3 +379,16 @@ void View::setPinned(bool pinned)
Q_EMIT pinnedChanged(); 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();
}
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <QPointer> #include <QPointer>
#include <QQuickView> #include <QQuickView>
#include <KRunner/RunnerManager>
#include <KWayland/Client/plasmashell.h> #include <KWayland/Client/plasmashell.h>
#include <PlasmaQuick/Dialog> #include <PlasmaQuick/Dialog>
...@@ -52,6 +53,9 @@ class View : public PlasmaQuick::Dialog ...@@ -52,6 +53,9 @@ class View : public PlasmaQuick::Dialog
Q_PROPERTY(bool canConfigure READ canConfigure CONSTANT) Q_PROPERTY(bool canConfigure READ canConfigure CONSTANT)
Q_PROPERTY(bool pinned READ pinned WRITE setPinned NOTIFY pinnedChanged) 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)
public: public:
explicit View(QWindow *parent = nullptr); explicit View(QWindow *parent = nullptr);
...@@ -68,6 +72,18 @@ public: ...@@ -68,6 +72,18 @@ public:
bool pinned() const; bool pinned() const;
void setPinned(bool pinned); 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;
}
Q_SIGNALS: Q_SIGNALS:
void pinnedChanged(); void pinnedChanged();
...@@ -104,6 +120,8 @@ private: ...@@ -104,6 +120,8 @@ private:
bool m_floating : 1; bool m_floating : 1;
bool m_requestedVisible = false; bool m_requestedVisible = false;
bool m_pinned = false; bool m_pinned = false;
QStringList m_history;
Plasma::RunnerManager *m_manager = nullptr;
}; };
#endif // View_H #endif // View_H
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