Commit 6d544e5c authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

applets/appmenu: do not update menu when panel gets focus

This makes the keyboard navigation work in the appmenu applet.

BUG: 455520
FIXED-IN: 5.25.4 5.26
parent 7b684645
Pipeline #213846 passed with stage
in 6 minutes and 6 seconds
......@@ -18,6 +18,7 @@ class AppMenuApplet : public Plasma::Applet
{
Q_OBJECT
Q_PROPERTY(QObject *containment READ containment CONSTANT)
Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(int view READ view WRITE setView NOTIFY viewChanged)
......
......@@ -141,6 +141,7 @@ Item {
AppMenuPrivate.AppMenuModel {
id: appMenuModel
containmentStatus: Plasmoid.nativeInterface.containment.status
screenGeometry: Plasmoid.screenGeometry
onRequestActivateIndex: Plasmoid.nativeInterface.requestActivateIndex(index)
Component.onCompleted: {
......
......@@ -193,6 +193,12 @@ void AppMenuModel::update()
void AppMenuModel::onActiveWindowChanged()
{
// Do not change active window when panel gets focus
// See ShellCorona::init() in shell/shellcorona.cpp
if (m_containmentStatus == Plasma::Types::AcceptingInputStatus) {
return;
}
const QModelIndex activeTaskIndex = m_tasksModel->activeTask();
const QString objectPath = m_tasksModel->data(activeTaskIndex, TaskManager::AbstractTasksModel::ApplicationMenuObjectPath).toString();
const QString serviceName = m_tasksModel->data(activeTaskIndex, TaskManager::AbstractTasksModel::ApplicationMenuServiceName).toString();
......
......@@ -14,6 +14,8 @@
#include <QStringList>
#include <tasksmodel.h>
#include <Plasma/Containment>
class QMenu;
class QModelIndex;
class QDBusServiceWatcher;
......@@ -26,6 +28,7 @@ class AppMenuModel : public QAbstractListModel
Q_PROPERTY(bool menuAvailable READ menuAvailable WRITE setMenuAvailable NOTIFY menuAvailableChanged)
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
Q_PROPERTY(Plasma::Types::ItemStatus containmentStatus MEMBER m_containmentStatus NOTIFY containmentStatusChanged)
Q_PROPERTY(QRect screenGeometry READ screenGeometry WRITE setScreenGeometry NOTIFY screenGeometryChanged)
public:
......@@ -64,6 +67,7 @@ private Q_SLOTS:
Q_SIGNALS:
void menuAvailableChanged();
void modelNeedsUpdate();
void containmentStatusChanged();
void screenGeometryChanged();
void visibleChanged();
......@@ -72,6 +76,7 @@ private:
bool m_updatePending = false;
bool m_visible = true;
Plasma::Types::ItemStatus m_containmentStatus = Plasma::Types::PassiveStatus;
TaskManager::TasksModel *m_tasksModel;
//! current active window used
......
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