mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-08 06:25:37 -05:00
fix auto focusing text fields
This commit is contained in:
@@ -149,9 +149,6 @@ PanelWindow {
|
||||
searchField.enabled = true;
|
||||
searchDebounceTimer.stop(); // Stop any pending search
|
||||
updateFilteredModel();
|
||||
Qt.callLater(function() {
|
||||
searchField.forceActiveFocus();
|
||||
});
|
||||
}
|
||||
|
||||
function hide() {
|
||||
@@ -461,6 +458,17 @@ PanelWindow {
|
||||
onTextEdited: {
|
||||
searchDebounceTimer.restart();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: launcher
|
||||
function onVisibleChanged() {
|
||||
if (launcher.visible) {
|
||||
searchField.forceActiveFocus();
|
||||
} else {
|
||||
searchField.clearFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
Keys.onPressed: function(event) {
|
||||
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && filteredModel.count && text.length > 0) {
|
||||
// Launch first app when typing in search field
|
||||
|
||||
@@ -15,7 +15,6 @@ DankModal {
|
||||
property var clipboardEntries: []
|
||||
|
||||
property string searchText: ""
|
||||
property bool shouldFocusSearch: false
|
||||
|
||||
function updateFilteredModel() {
|
||||
filteredClipboardModel.clear();
|
||||
@@ -118,13 +117,6 @@ DankModal {
|
||||
height: 550
|
||||
keyboardFocus: "ondemand"
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
refreshClipboard();
|
||||
shouldFocusSearch = true;
|
||||
}
|
||||
}
|
||||
|
||||
onBackgroundClicked: {
|
||||
hide();
|
||||
}
|
||||
@@ -198,14 +190,14 @@ DankModal {
|
||||
clipboardHistory.searchText = text;
|
||||
updateFilteredModel();
|
||||
}
|
||||
|
||||
|
||||
Connections {
|
||||
target: clipboardHistory
|
||||
function onOpened() {
|
||||
if (shouldFocusSearch) {
|
||||
searchField.forceActiveFocus()
|
||||
shouldFocusSearch = false
|
||||
}
|
||||
searchField.forceActiveFocus();
|
||||
}
|
||||
function onDialogClosed() {
|
||||
searchField.clearFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,6 @@ DankModal {
|
||||
}
|
||||
|
||||
property string searchQuery: ""
|
||||
property bool shouldFocusSearch: false
|
||||
|
||||
function updateFilteredApps() {
|
||||
filteredApps = [];
|
||||
selectedIndex = 0;
|
||||
@@ -216,10 +214,6 @@ DankModal {
|
||||
}
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
shouldFocusSearch = true;
|
||||
}
|
||||
|
||||
onBackgroundClicked: {
|
||||
spotlightOpen = false;
|
||||
}
|
||||
@@ -420,7 +414,6 @@ DankModal {
|
||||
showClearButton: true
|
||||
textColor: Theme.surfaceText
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
focus: false
|
||||
enabled: spotlightOpen
|
||||
placeholderText: "Search applications..."
|
||||
text: searchQuery
|
||||
@@ -428,15 +421,14 @@ DankModal {
|
||||
searchQuery = text;
|
||||
searchDebounceTimer.restart();
|
||||
}
|
||||
|
||||
|
||||
Connections {
|
||||
target: spotlightLauncher
|
||||
function onOpened() {
|
||||
if (shouldFocusSearch) {
|
||||
searchField.forceActiveFocus()
|
||||
searchField.selectAll()
|
||||
shouldFocusSearch = false
|
||||
}
|
||||
searchField.forceActiveFocus();
|
||||
}
|
||||
function onDialogClosed() {
|
||||
searchField.clearFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,6 @@ DankModal {
|
||||
height: 230
|
||||
keyboardFocus: "ondemand"
|
||||
|
||||
onOpened: {
|
||||
passwordInput.forceActiveFocus()
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible) {
|
||||
wifiPasswordInput = "";
|
||||
@@ -100,6 +96,16 @@ DankModal {
|
||||
onTextEdited: {
|
||||
wifiPasswordInput = text;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
function onOpened() {
|
||||
passwordInput.forceActiveFocus();
|
||||
}
|
||||
function onDialogClosed() {
|
||||
passwordInput.clearFocus();
|
||||
}
|
||||
}
|
||||
onAccepted: {
|
||||
WifiService.connectToWifiWithPassword(wifiPasswordSSID, passwordInput.text);
|
||||
wifiPasswordDialogVisible = false;
|
||||
|
||||
@@ -199,11 +199,14 @@ PanelWindow {
|
||||
|
||||
// Keyboard handling
|
||||
FocusScope {
|
||||
id: focusScope
|
||||
anchors.fill: parent
|
||||
focus: visible && root.closeOnEscapeKey
|
||||
Keys.onEscapePressed: {
|
||||
visible: root.visible // Only active when the modal is visible
|
||||
|
||||
Keys.onEscapePressed: (event) => {
|
||||
if (root.closeOnEscapeKey) {
|
||||
visible = false
|
||||
root.visible = false;
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,10 @@ Rectangle {
|
||||
textInput.cut();
|
||||
}
|
||||
|
||||
function clearFocus() {
|
||||
textInput.focus = false;
|
||||
}
|
||||
|
||||
// Default styling
|
||||
width: 200
|
||||
height: 48
|
||||
|
||||
Reference in New Issue
Block a user