From bbb00dd8a05fe6894cc4c760bbe9c4383306bbdc Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 14 May 2020 02:24:28 -0400 Subject: [PATCH] Let escape presses work properly inside HDrawer Also add escape to clear member filter when focusing the field, and clearMemberFilterOnEscape setting. --- src/backend/user_files.py | 1 + src/gui/Base/HDrawer.qml | 2 +- src/gui/DebugConsole.qml | 3 +++ src/gui/Pages/Chat/RoomPane/MemberView.qml | 5 +++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/backend/user_files.py b/src/backend/user_files.py index 2d53f603..fb89dee6 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -224,6 +224,7 @@ class UISettings(JSONDataFile): "compactMode": False, "clearRoomFilterOnEnter": True, "clearRoomFilterOnEscape": True, + "clearMemberFilterOnEscape": True, "collapseSidePanesUnderWindowWidth": 400, "hideProfileChangeEvents": True, "hideMembershipEvents": False, diff --git a/src/gui/Base/HDrawer.qml b/src/gui/Base/HDrawer.qml index 1e48121f..b9ee0a8e 100644 --- a/src/gui/Base/HDrawer.qml +++ b/src/gui/Base/HDrawer.qml @@ -24,7 +24,7 @@ Drawer { position: 1 visible: ! collapse modal: false - closePolicy: Popup.CloseOnEscape + closePolicy: Popup.NoAutoClose background: Rectangle { id: bg; color: theme.colors.strongBackground } diff --git a/src/gui/DebugConsole.qml b/src/gui/DebugConsole.qml index f55e94c5..9d3420c9 100644 --- a/src/gui/DebugConsole.qml +++ b/src/gui/DebugConsole.qml @@ -207,9 +207,12 @@ HDrawer { Keys.onUpPressed: if (historyEntry + 1 < history.length ) historyEntry += 1 + Keys.onDownPressed: if (historyEntry - 1 >= -1) historyEntry -= 1 + Keys.onEscapePressed: debugConsole.close() + Layout.fillWidth: true } diff --git a/src/gui/Pages/Chat/RoomPane/MemberView.qml b/src/gui/Pages/Chat/RoomPane/MemberView.qml index 48814145..14e85411 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView.qml @@ -61,6 +61,11 @@ HColumnLayout { onTextChanged: py.callCoro("set_substring_filter", [modelSyncId, text]) + Keys.onEscapePressed: { + roomPane.toggleFocus() + if (window.settings.clearMemberFilterOnEscape) text = "" + } + Behavior on opacity { HNumberAnimation {} } }