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