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 @@ -61,6 +61,14 @@ folderView.cancelRename(); } + function goHome() { + if (folderView.url != plasmoid.configuration.url) { + folderView.url = plasmoid.configuration.url; + folderView.history = []; + folderView.updateHistory(); + } + } + PlasmaCore.Svg { id: actionOverlays @@ -134,11 +142,7 @@ onExpandedChanged: { if (root.isPopup && !plasmoid.expanded) { - if (folderView.url != plasmoid.configuration.url) { - folderView.url = plasmoid.configuration.url; - folderView.history = []; - folderView.updateHistory(); - } + goHome(); folderView.currentIndex = -1; folderView.model.clearSelection(); @@ -247,6 +251,7 @@ visible: active property Item windowPin: null + property Item homeButton: null onVisibleChanged: { if (root.isPopup && !visible) { @@ -266,10 +271,26 @@ } } + Connections { + target: folderView + + onUrlChanged: { + if (!label.homeButton && folderView.url != plasmoid.configuration.url) { + label.homeButton = homeButtonComponent.createObject(label); + } else if (label.homeButton) { + label.homeButton.destroy(); + } + } + } + PlasmaComponents.Label { id: text - width: parent.width - (windowPin != null ? windowPin.width - units.smallSpacing : 0) + anchors { + left: label.homeButton ? label.homeButton.right : parent.left + right: label.windowPin ? label.windowPin.left : parent.right + margins: units.smallSpacing + } height: parent.height horizontalAlignment: Text.AlignHCenter @@ -332,6 +353,24 @@ } } + Component { + id: homeButtonComponent + + PlasmaComponents.ToolButton { + id: homeButton + + anchors.left: parent.left + + visible: root.isPopup && folderView.url != plasmoid.configuration.url + + width: root.isPopup ? Math.round(units.gridUnit * 1.25) : 0 + height: width + iconSource: "go-home" + + onClicked: goHome() + } + } + Component.onCompleted: { if (root.isPopup) { windowPin = windowPinComponent.createObject(label);