Files
Huỳnh Thiện Lộc 4f0cbf5b03 fix(powermenu): close on escape key, dedup action shortcuts (#3262)
* fix(powermenu): close on escape key and deduplicate action shortcuts

- Centralize Escape key handling in PowerMenuContent via closeRequested signal,
  cancelling any active hold and enabling Esc to close both modal and popout variants.
- Remove redundant Keys.onEscapePressed wrapper in PowerMenuPopout.
- Extract handleActionShortcut and handleKeyRelease helpers to eliminate ~50 lines
  of duplicated action shortcut dispatch between list and grid navigation.

* fix(powermenu): drop duplicate Keys.onEscapePressed handler

- Remove redundant Keys.onEscapePressed in PowerMenuContent, keeping Escape
  handling unified under Keys.onPressed to preserve isAutoRepeat and
  committedAction guards.
2026-09-02 09:24:58 -04:00

43 lines
1.1 KiB
QML

import QtQuick
import qs.Common
import qs.Modules.PowerMenu
import qs.Widgets
DankPopout {
id: root
signal powerActionRequested(string action)
signal lockRequested
signal switchUserRequested
layerNamespace: "dms:power-menu"
popupWidth: contentLoader.item?.desiredWidth ?? 400
popupHeight: contentLoader.item ? contentLoader.item.implicitHeight : 300
triggerWidth: 40
positioning: ""
shouldBeVisible: false
onBackgroundClicked: {
contentLoader.item?.cancelHold();
close();
}
onOpened: Qt.callLater(() => {
contentLoader.item?.resetState();
contentLoader.item?.forceActiveFocus();
})
onPopoutClosed: contentLoader.item?.cancelHold()
content: Component {
PowerMenuContent {
anchors.fill: parent
focus: true
onPowerActionRequested: action => root.powerActionRequested(action)
onLockRequested: root.lockRequested()
onSwitchUserRequested: root.switchUserRequested()
onCloseRequested: root.close()
}
}
}