mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
spotlight: fix file search keyboard navi woes
This commit is contained in:
@@ -21,8 +21,13 @@ Rectangle {
|
|||||||
|
|
||||||
property int itemHeight: 60
|
property int itemHeight: 60
|
||||||
property int itemSpacing: Theme.spacingS
|
property int itemSpacing: Theme.spacingS
|
||||||
|
property bool hoverUpdatesSelection: false
|
||||||
property bool keyboardNavigationActive: fileSearchController ? fileSearchController.keyboardNavigationActive : false
|
property bool keyboardNavigationActive: fileSearchController ? fileSearchController.keyboardNavigationActive : false
|
||||||
|
|
||||||
|
signal keyboardNavigationReset
|
||||||
|
signal itemClicked(int index)
|
||||||
|
signal itemRightClicked(int index)
|
||||||
|
|
||||||
function ensureVisible(index) {
|
function ensureVisible(index) {
|
||||||
if (index < 0 || index >= count)
|
if (index < 0 || index >= count)
|
||||||
return
|
return
|
||||||
@@ -51,6 +56,25 @@ Rectangle {
|
|||||||
ensureVisible(currentIndex)
|
ensureVisible(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onItemClicked: function (index) {
|
||||||
|
if (fileSearchController) {
|
||||||
|
const item = fileSearchController.model.get(index)
|
||||||
|
fileSearchController.openFile(item.filePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onItemRightClicked: function (index) {
|
||||||
|
if (fileSearchController) {
|
||||||
|
const item = fileSearchController.model.get(index)
|
||||||
|
fileSearchController.openFolder(item.filePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onKeyboardNavigationReset: {
|
||||||
|
if (fileSearchController)
|
||||||
|
fileSearchController.keyboardNavigationActive = false
|
||||||
|
}
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
required property int index
|
required property int index
|
||||||
required property string filePath
|
required property string filePath
|
||||||
@@ -161,19 +185,18 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
z: 10
|
z: 10
|
||||||
onEntered: () => {
|
onEntered: {
|
||||||
if (fileSearchController && filesList.keyboardNavigationActive) {
|
if (filesList.hoverUpdatesSelection && !filesList.keyboardNavigationActive)
|
||||||
fileSearchController.keyboardNavigationActive = false
|
filesList.currentIndex = index
|
||||||
}
|
}
|
||||||
filesList.currentIndex = index
|
onPositionChanged: {
|
||||||
}
|
filesList.keyboardNavigationReset()
|
||||||
|
}
|
||||||
onClicked: mouse => {
|
onClicked: mouse => {
|
||||||
if (mouse.button === Qt.LeftButton) {
|
if (mouse.button === Qt.LeftButton) {
|
||||||
if (fileSearchController)
|
filesList.itemClicked(index)
|
||||||
fileSearchController.openFile(filePath)
|
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
if (fileSearchController)
|
filesList.itemRightClicked(index)
|
||||||
fileSearchController.openFolder(filePath)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ Item {
|
|||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
enabled: parentModal ? parentModal.spotlightOpen : true
|
enabled: parentModal ? parentModal.spotlightOpen : true
|
||||||
placeholderText: searchMode === "files" ? "Search files..." : "Search apps..."
|
placeholderText: searchMode === "files" ? "Search files..." : "Search apps..."
|
||||||
ignoreLeftRightKeys: searchMode === "files" || appLauncher.viewMode !== "list"
|
ignoreLeftRightKeys: appLauncher.viewMode !== "list"
|
||||||
ignoreTabKeys: true
|
ignoreTabKeys: true
|
||||||
keyForwardTargets: [spotlightKeyHandler]
|
keyForwardTargets: [spotlightKeyHandler]
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
|
|||||||
Reference in New Issue
Block a user