fix(hotkeys): suppress single-key hotkeys while typing in LineEdit fields

The window-level hotkey handler only suppressed single-key shortcuts
(Space/q/?/1-5) when UiFocusState.text-input-focused was set. The ~24
std-widget LineEdit fields across 14 modals/settings never set it, so those
keys fired (and were swallowed) mid-typing. Each now mirrors its focus via
`changed has-focus`; import added where missing.

cc
This commit is contained in:
vicrodh committed 2026-06-30 14:08:01 -06:00
1 parent 1a9c132760
commit a7681945e9
14 files changed
+37 -13

No files matched your search

@@ -14,7 +14,7 @@ import { Theme } from "../foundation/semantic-colors.slint";
import { ThemeState } from "../foundation/theme-state.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { AppearanceState, SidebarState, ShellState, ToastState, MyQbzBrandingState } from "../state.slint";
import { AppearanceState, SidebarState, ShellState, ToastState, MyQbzBrandingState , UiFocusState } from "../state.slint";
import { QbzToggle } from "../primitives/QbzToggle.slint";
import { QbzSelect } from "../primitives/QbzSelect.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
@@ -365,6 +365,7 @@ export component AppearanceSettings inherits VerticalLayout {
name-edit := LineEdit {
text: MyQbzBrandingState.label;
placeholder-text: @tr("My QBZ");
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
edited(s) => {
MyQbzBrandingState.set-label(s);
}
@@ -490,6 +491,7 @@ export component AppearanceSettings inherits VerticalLayout {
LineEdit {
text: AppearanceState.window-title-template;
placeholder-text: "{artist} - {track}";
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
edited(s) => {
AppearanceState.window-title-template = s;
AppearanceState.appearance-text("window-title-template", s);
@@ -8,7 +8,7 @@
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { ScrobbleState, ScrobbleActions, DiscordState, SettingsState } from "../state.slint";
import { ScrobbleState, ScrobbleActions, DiscordState, SettingsState , UiFocusState } from "../state.slint";
import { SettingRow } from "SettingRow.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { QbzToggle } from "../primitives/QbzToggle.slint";
@@ -258,6 +258,7 @@ export component IntegrationsSettings inherits VerticalLayout {
LineEdit {
text: ScrobbleState.listenbrainz-token-input;
placeholder-text: @tr("ListenBrainz token");
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
input-type: password;
enabled: !ScrobbleState.listenbrainz-busy;
edited(s) => {
@@ -10,7 +10,7 @@
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { LibFolderEditState, LibraryManageActions } from "../state.slint";
import { LibFolderEditState, LibraryManageActions , UiFocusState } from "../state.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { QbzToggle } from "../primitives/QbzToggle.slint";
import { QbzSelect } from "../primitives/QbzSelect.slint";
@@ -192,6 +192,7 @@ export component LibFolderEditModal inherits Rectangle {
label: @tr("Display name");
LineEdit {
placeholder-text: @tr("Optional friendly name");
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
text <=> LibFolderEditState.alias;
}
Text {
@@ -9,7 +9,7 @@
import { Theme } from "../foundation/semantic-colors.slint";
import { Typography } from "../foundation/typography.slint";
import { Radius } from "../foundation/radius.slint";
import { LibraryFoldersState, LibraryManageActions, LibraryScanState, PlexSettingsState, PlexAuthActions } from "../state.slint";
import { LibraryFoldersState, LibraryManageActions, LibraryScanState, PlexSettingsState, PlexAuthActions , UiFocusState } from "../state.slint";
import { SettingRow } from "SettingRow.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { QbzCheckbox } from "../primitives/QbzCheckbox.slint";
@@ -537,6 +537,7 @@ export component LocalLibrarySettings inherits VerticalLayout {
LineEdit {
text: PlexSettingsState.server-url;
placeholder-text: @tr("http://127.0.0.1:32400");
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
edited(s) => {
PlexSettingsState.server-url = s;
}
@@ -639,6 +640,7 @@ export component LocalLibrarySettings inherits VerticalLayout {
LineEdit {
text: PlexSettingsState.token-input;
placeholder-text: @tr("X-Plex-Token");
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
input-type: password;
edited(s) => {
PlexSettingsState.token-input = s;