Commit 71f1ff8e authored by Nate Graham's avatar Nate Graham 🔩

[wallpapers/image] Port to BasicListItem+subtitle

Summary:
This allows us to use the new consistent appearance introduced with D29074.

Depends on D29074

Test Plan: {F8273822}

Reviewers: #plasma, #kirigami

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D29075
parent 9289f85d
......@@ -28,7 +28,7 @@ import org.kde.kquickcontrolsaddons 2.0
import org.kde.newstuff 1.62 as NewStuff
import org.kde.draganddrop 2.0 as DragDrop
import org.kde.kcm 1.1 as KCM
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kirigami 2.12 as Kirigami
ColumnLayout {
id: root
......@@ -274,6 +274,32 @@ ColumnLayout {
model: imageWallpaper.slidePaths
delegate: Kirigami.SwipeListItem {
id: folderDelegate
width: slidePathsView.width
contentItem: Kirigami.BasicListItem {
// The parent item already has a highlight
activeBackgroundColor: "transparent"
// Otherwise there are unnecessary margins
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
// No right anchor so text can be elided by actions
// Header: the folder
label: {
var strippedPath = modelData.replace(/\/+$/, "");
return strippedPath.split('/').pop()
}
// Subtitle: the path to the folder
subtitle: {
var strippedPath = modelData.replace(/\/+$/, "");
return strippedPath.replace(/\/[^\/]*$/, '');;
}
QtControls2.ToolTip.text: modelData
QtControls2.ToolTip.visible: hovered
QtControls2.ToolTip.delay: 1000
QtControls2.ToolTip.timeout: 5000
}
actions: [
Kirigami.Action {
iconName: "list-remove"
......@@ -286,37 +312,6 @@ ColumnLayout {
onTriggered: imageWallpaper.openFolder(modelData)
}
]
ColumnLayout {
width: slidePathsView.width
QtControls2.ToolTip.text: modelData
QtControls2.ToolTip.visible: folderDelegate.hovered && subtitle.truncated
QtControls2.ToolTip.delay: 1000
QtControls2.ToolTip.timeout: 5000
// Header: the folder
QtControls2.Label {
Layout.fillWidth: true
elide: Text.ElideRight
text: {
var strippedPath = modelData.replace(/\/+$/, "");
return strippedPath.split('/').pop()
}
}
// Subtitle: the path to the folder
QtControls2.Label {
id: subtitle
Layout.fillWidth: true
elide: Text.ElideRight
text: {
var strippedPath = modelData.replace(/\/+$/, "");
return strippedPath.replace(/\/[^\/]*$/, '');;
}
font.pointSize: theme.smallestFont.pointSize
opacity: 0.6
}
}
}
Kirigami.Heading {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment