From c9d7641d86861d5f233cc73a264b9151e6ad580c Mon Sep 17 00:00:00 2001 From: purian23 Date: Fri, 5 Sep 2025 23:40:09 -0400 Subject: [PATCH] Update initial focus on IPC Notifications & Notepad --- Modals/NotificationModal.qml | 11 +++++++++++ Modules/NotepadSlideout.qml | 4 +--- .../Center/NotificationKeyboardController.qml | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Modals/NotificationModal.qml b/Modals/NotificationModal.qml index cf381fb4..3867992f 100644 --- a/Modals/NotificationModal.qml +++ b/Modals/NotificationModal.qml @@ -20,6 +20,17 @@ DankModal { if (modalKeyboardController && notificationListRef) { modalKeyboardController.listView = notificationListRef modalKeyboardController.rebuildFlatNavigation() + + Qt.callLater(() => { + modalKeyboardController.keyboardNavigationActive = true + modalKeyboardController.selectedFlatIndex = 0 + modalKeyboardController.updateSelectedIdFromIndex() + if (notificationListRef) { + notificationListRef.keyboardActive = true + } + modalKeyboardController.selectionVersion++ + modalKeyboardController.ensureVisible() + }) } } diff --git a/Modules/NotepadSlideout.qml b/Modules/NotepadSlideout.qml index b92d3b45..975dbcef 100644 --- a/Modules/NotepadSlideout.qml +++ b/Modules/NotepadSlideout.qml @@ -36,6 +36,7 @@ PanelWindow { function show() { notepadVisible = true + Qt.callLater(() => textArea.forceActiveFocus()) } function hide() { @@ -381,9 +382,6 @@ PanelWindow { repeat: false onTriggered: { animatingOut = false - currentFileName = "" - currentFileUrl = "" - hasUnsavedChanges = false } } diff --git a/Modules/Notifications/Center/NotificationKeyboardController.qml b/Modules/Notifications/Center/NotificationKeyboardController.qml index 6b04924a..928ffd7a 100644 --- a/Modules/Notifications/Center/NotificationKeyboardController.qml +++ b/Modules/Notifications/Center/NotificationKeyboardController.qml @@ -138,6 +138,22 @@ QtObject { ensureVisible() } + function selectNextWrapping() { + keyboardNavigationActive = true + if (flatNavigation.length === 0) + return + + // Re-enable auto-scrolling when arrow keys are used + if (listView && listView.enableAutoScroll) { + listView.enableAutoScroll() + } + + selectedFlatIndex = (selectedFlatIndex + 1) % flatNavigation.length + updateSelectedIdFromIndex() + selectionVersion++ + ensureVisible() + } + function selectPrevious() { keyboardNavigationActive = true if (flatNavigation.length === 0) @@ -408,6 +424,9 @@ QtObject { } else if (event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace) { clearSelected() event.accepted = true + } else if (event.key === Qt.Key_Tab) { + selectNextWrapping() + event.accepted = true } else if (event.key >= Qt.Key_1 && event.key <= Qt.Key_9) { const actionIndex = event.key - Qt.Key_1 executeAction(actionIndex)