diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml --- a/containments/desktop/package/contents/ui/FolderView.qml +++ b/containments/desktop/package/contents/ui/FolderView.qml @@ -63,6 +63,10 @@ property var dialog: null property Item editor: null + function positionViewAtBeginning() { + gridView.positionViewAtBeginning(); + } + function rename() { if (gridView.currentIndex != -1) { var renameAction = folderView.model.action("rename"); @@ -279,6 +283,7 @@ if (!hoveredItem || hoveredItem.blank) { if (!gridView.ctrlPressed) { + gridView.currentIndex = -1; dir.clearSelection(); } @@ -1106,6 +1111,7 @@ onListingCompleted: { if (!gridView.model && plasmoid.expanded) { gridView.model = positioner; + gridView.currentIndex = isPopup ? 0 : -1; } } diff --git a/containments/desktop/package/contents/ui/FolderViewLayer.qml b/containments/desktop/package/contents/ui/FolderViewLayer.qml --- a/containments/desktop/package/contents/ui/FolderViewLayer.qml +++ b/containments/desktop/package/contents/ui/FolderViewLayer.qml @@ -42,6 +42,8 @@ readonly property bool lockedByKiosk: !KAuthorized.authorize("editable_desktop_icons") + focus: true + function updateContextualActions() { folderView.model.updateActions(); @@ -170,6 +172,7 @@ if (plasmoid.expanded) { folderView.currentIndex = -1; folderView.forceActiveFocus(); + folderView.positionViewAtBeginning(); } else { goHome(); diff --git a/containments/desktop/package/contents/ui/main.qml b/containments/desktop/package/contents/ui/main.qml --- a/containments/desktop/package/contents/ui/main.qml +++ b/containments/desktop/package/contents/ui/main.qml @@ -259,6 +259,12 @@ return length >= Qt.styleHints.startDragDistance; } + onFocusChanged: { + if (focus && isFolder) { + folderViewLayer.item.forceActiveFocus(); + } + } + onDragEnter: { if (isContainment && plasmoid.immutable && !(isFolder && FolderTools.isFileDrag(event))) { event.ignore(); @@ -415,8 +421,9 @@ MouseArea { // unfocus any plasmoid when clicking empty desktop area anchors.fill: parent onPressed: { - root.forceActiveFocus() + root.forceActiveFocus(); mouse.accepted = false // Bug 351277 + if (toolBox && toolBox.open) { toolBox.open = false; } @@ -448,8 +455,9 @@ Connections { target: folderViewLayer.view + // `FolderViewDropArea` is not a FocusScope. We need to forward manually. onPressed: { - folderViewLayer.focus = true; + folderViewLayer.forceActiveFocus(); } } }