TrayMenu: use NPanel instead of PopupWindow

Tray, TrayDropdownPanel: use new TrayMenu
NPanel: expose animation options
shell: add TrayMenu component
i18n: add TrayMenu sub menu translation
This commit is contained in:
Ly-sec
2025-11-06 11:49:47 +01:00
parent f9ebe1bb4e
commit afde67bcb9
13 changed files with 621 additions and 462 deletions
+10 -16
View File
@@ -144,15 +144,15 @@ NPanel {
onClicked: mouse => {
if (!modelData)
return
if (mouse.button === Qt.RightButton && modelData.hasMenu && modelData.menu && trayMenu.item) {
trayMenu.item.menu = modelData.menu
trayMenu.item.screen = root.screen
trayMenu.item.trayItem = modelData
trayMenu.item.widgetSection = root.widgetSection
trayMenu.item.widgetIndex = root.widgetIndex
const menuX = (root.columns > 1) ? (trayIcon.width / 2) : 0
const menuY = trayIcon.height
trayMenu.item.showAt(trayIcon, menuX, menuY)
if (mouse.button === Qt.RightButton && modelData.hasMenu && modelData.menu) {
const panel = PanelService.getPanel("trayMenu", root.screen)
if (panel) {
panel.menu = modelData.menu
panel.trayItem = modelData
panel.widgetSection = root.widgetSection
panel.widgetIndex = root.widgetIndex
panel.openAt(trayIcon)
}
} else if (mouse.button === Qt.LeftButton) {
modelData.activate()
// Close the dropdown after activation
@@ -178,12 +178,6 @@ NPanel {
}
}
// Tray menu host
Loader {
id: trayMenu
asynchronous: false
active: true
source: "TrayMenu.qml"
}
// (Tray menu now uses dedicated TrayMenu via PanelService)
}
}