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:
14 files changed
+37
-13
No files matched your search
@@ -12,7 +12,7 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { MyQbzCreateState, MyQbzCreateActions } from "../state.slint";
|
||||
import { MyQbzCreateState, MyQbzCreateActions , UiFocusState } from "../state.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { QbzPrimaryButton } from "../primitives/QbzPrimaryButton.slint";
|
||||
import { SecondaryButton } from "../primitives/SecondaryButton.slint";
|
||||
@@ -125,6 +125,7 @@ export component CreateMyQbzModal inherits Rectangle {
|
||||
}
|
||||
name-input := LineEdit {
|
||||
text <=> MyQbzCreateState.name;
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
accepted => {
|
||||
MyQbzCreateActions.submit();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { MyQbzEditState, MyQbzEditActions } from "../state.slint";
|
||||
import { MyQbzEditState, MyQbzEditActions , UiFocusState } from "../state.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { QbzPrimaryButton } from "../primitives/QbzPrimaryButton.slint";
|
||||
import { SecondaryButton } from "../primitives/SecondaryButton.slint";
|
||||
@@ -74,6 +74,7 @@ export component MyQbzEditModal inherits Rectangle {
|
||||
// --- Body: rename (name input) ---------------------------
|
||||
if root.is-rename: rename-input := LineEdit {
|
||||
text <=> MyQbzEditState.draft-name;
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
accepted => {
|
||||
if (root.can-submit) {
|
||||
MyQbzEditActions.submit-rename();
|
||||
|
||||
@@ -823,6 +823,7 @@ component PmListRow inherits Rectangle {
|
||||
height: 28px;
|
||||
width: parent.width;
|
||||
placeholder-text: @tr("Search folders");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> root.folder-query;
|
||||
edited => {
|
||||
PlaylistManagerActions.search-folders(self.text);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { CreateFolderState, CreateFolderActions } from "../state.slint";
|
||||
import { CreateFolderState, CreateFolderActions , UiFocusState } from "../state.slint";
|
||||
import { QbzIcon } from "QbzIcon.slint";
|
||||
import { LineEdit } from "std-widgets.slint";
|
||||
|
||||
@@ -65,6 +65,7 @@ export component CreateFolderModal inherits Rectangle {
|
||||
|
||||
name-input := LineEdit {
|
||||
placeholder-text: @tr("Folder name");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> CreateFolderState.name;
|
||||
accepted => {
|
||||
CreateFolderActions.submit();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { CreatePlaylistState, CreatePlaylistActions } from "../state.slint";
|
||||
import { CreatePlaylistState, CreatePlaylistActions , UiFocusState } from "../state.slint";
|
||||
import { QbzIcon } from "QbzIcon.slint";
|
||||
import { QbzSelect } from "QbzSelect.slint";
|
||||
import { LineEdit, TextEdit } from "std-widgets.slint";
|
||||
@@ -79,6 +79,7 @@ export component CreatePlaylistModal inherits Rectangle {
|
||||
}
|
||||
name-input := LineEdit {
|
||||
placeholder-text: @tr("My Playlist");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> CreatePlaylistState.name;
|
||||
accepted => {
|
||||
CreatePlaylistActions.submit();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { EditPlaylistState, EditPlaylistActions } from "../state.slint";
|
||||
import { EditPlaylistState, EditPlaylistActions , UiFocusState } from "../state.slint";
|
||||
import { QbzIcon } from "QbzIcon.slint";
|
||||
import { LineEdit, TextEdit } from "std-widgets.slint";
|
||||
|
||||
@@ -65,6 +65,7 @@ export component EditPlaylistModal inherits Rectangle {
|
||||
|
||||
name-input := LineEdit {
|
||||
placeholder-text: @tr("Playlist name");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> EditPlaylistState.name;
|
||||
accepted => {
|
||||
EditPlaylistActions.save();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { FolderEditState, FolderEditActions, PmIconPreset, PmColorSwatch } from "../state.slint";
|
||||
import { FolderEditState, FolderEditActions, PmIconPreset, PmColorSwatch , UiFocusState } from "../state.slint";
|
||||
import { QbzIcon } from "QbzIcon.slint";
|
||||
import { QbzToggle } from "QbzToggle.slint";
|
||||
import { LineEdit } from "std-widgets.slint";
|
||||
@@ -76,6 +76,7 @@ export component FolderEditModal inherits Rectangle {
|
||||
}
|
||||
name-input := LineEdit {
|
||||
placeholder-text: @tr("Enter folder name");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> FolderEditState.name;
|
||||
accepted => { FolderEditActions.save(); }
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import { Theme } from "../foundation/semantic-colors.slint";
|
||||
import { Typography } from "../foundation/typography.slint";
|
||||
import { Radius } from "../foundation/radius.slint";
|
||||
import { TagEditorState, TagEditorActions } from "../state.slint";
|
||||
import { TagEditorState, TagEditorActions , UiFocusState } from "../state.slint";
|
||||
import { QbzIcon } from "QbzIcon.slint";
|
||||
import { QbzSelect } from "QbzSelect.slint";
|
||||
import { LoadingSpinner } from "LoadingSpinner.slint";
|
||||
@@ -96,6 +96,7 @@ export component TagEditorModal inherits Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
LineEdit {
|
||||
placeholder-text: @tr("Album title");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> TagEditorState.album_title;
|
||||
}
|
||||
}
|
||||
@@ -104,6 +105,7 @@ export component TagEditorModal inherits Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
LineEdit {
|
||||
placeholder-text: @tr("Album artist");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> TagEditorState.album_artist;
|
||||
}
|
||||
}
|
||||
@@ -117,6 +119,7 @@ export component TagEditorModal inherits Rectangle {
|
||||
width: 120px;
|
||||
LineEdit {
|
||||
placeholder-text: "—";
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> TagEditorState.year_input;
|
||||
}
|
||||
}
|
||||
@@ -125,6 +128,7 @@ export component TagEditorModal inherits Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
LineEdit {
|
||||
placeholder-text: @tr("Genre");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> TagEditorState.genre;
|
||||
}
|
||||
}
|
||||
@@ -133,6 +137,7 @@ export component TagEditorModal inherits Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
LineEdit {
|
||||
placeholder-text: "—";
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> TagEditorState.catalog_number;
|
||||
}
|
||||
}
|
||||
@@ -362,6 +367,7 @@ export component TagEditorModal inherits Rectangle {
|
||||
LineEdit {
|
||||
width: 52px;
|
||||
placeholder-text: "#";
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text: row.track_number;
|
||||
edited(t) => {
|
||||
TagEditorState.tracks[i].track_number = t;
|
||||
@@ -371,6 +377,7 @@ export component TagEditorModal inherits Rectangle {
|
||||
LineEdit {
|
||||
horizontal-stretch: 1;
|
||||
placeholder-text: @tr("Title");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text: row.title;
|
||||
edited(t) => {
|
||||
TagEditorState.tracks[i].title = t;
|
||||
@@ -380,6 +387,7 @@ export component TagEditorModal inherits Rectangle {
|
||||
LineEdit {
|
||||
width: 52px;
|
||||
placeholder-text: @tr("Disc");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text: row.disc_number;
|
||||
edited(t) => {
|
||||
TagEditorState.tracks[i].disc_number = t;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -16,7 +16,7 @@ import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { SidebarPlaylistCollage } from "../primitives/SidebarPlaylistCollage.slint";
|
||||
import { ContextMenu } from "../primitives/ContextMenu.slint";
|
||||
import { ContextMenuItem } from "../primitives/ContextMenuItem.slint";
|
||||
import { ShellState, SidebarState, SidebarActions, SidebarEntry, DragState, HeaderMenuState, NavMenuEntry, SidebarFolderPopupState, SidebarTooltipState, MyQbzBrandingState, OfflineState, NavState, ContentView, AppearanceState, SettingsState } from "../state.slint";
|
||||
import { ShellState, SidebarState, SidebarActions, SidebarEntry, DragState, HeaderMenuState, NavMenuEntry, SidebarFolderPopupState, SidebarTooltipState, MyQbzBrandingState, OfflineState, NavState, ContentView, AppearanceState, SettingsState , UiFocusState } from "../state.slint";
|
||||
import { ScrollView, LineEdit } from "std-widgets.slint";
|
||||
|
||||
// A single context-menu item row.
|
||||
@@ -485,6 +485,7 @@ component SidebarRow inherits Rectangle {
|
||||
LineEdit {
|
||||
height: 26px;
|
||||
placeholder-text: @tr("Search folders");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> root.folder-query;
|
||||
edited => {
|
||||
SidebarActions.search-folders(self.text);
|
||||
@@ -828,6 +829,7 @@ export component Sidebar inherits Rectangle {
|
||||
width: 100%;
|
||||
height: 22px;
|
||||
placeholder-text: @tr("Search playlists");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> SidebarState.search-query;
|
||||
edited => {
|
||||
SidebarActions.search-changed(self.text);
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Radius } from "../foundation/radius.slint";
|
||||
import { QbzIcon } from "../primitives/QbzIcon.slint";
|
||||
import { ListScrollbar } from "../primitives/ListScrollbar.slint";
|
||||
import { LineEdit } from "std-widgets.slint";
|
||||
import { SidebarPlaylistsPopupState, SidebarState, SidebarActions, SidebarEntry, OfflineState } from "../state.slint";
|
||||
import { SidebarPlaylistsPopupState, SidebarState, SidebarActions, SidebarEntry, OfflineState , UiFocusState } from "../state.slint";
|
||||
|
||||
// One entry row — a folder (bold, toggles expand) or a playlist (opens it).
|
||||
component PpRow inherits Rectangle {
|
||||
@@ -130,6 +130,7 @@ export component SidebarPlaylistsPopup inherits Rectangle {
|
||||
width: parent.width - 16px;
|
||||
height: 26px;
|
||||
placeholder-text: @tr("Search playlists");
|
||||
changed has-focus => { UiFocusState.text-input-focused = self.has-focus; }
|
||||
text <=> SidebarState.search-query;
|
||||
edited => {
|
||||
SidebarActions.search-changed(self.text);
|
||||
|
||||
Reference in new issue
Block a user