Verified Commit 2015ce46 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

UrlDelegate: Switch to SwipeListItem with DelegateRecycler

parent 86fb5316
......@@ -22,13 +22,22 @@
import QtQuick 2.3
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.4 as Kirigami
Kirigami.ScrollablePage {
// id: options
title: i18n("Bookmarks")
Component {
id: delegateComponent
UrlDelegate {
onClicked: pageStack.layers.pop()
onRemoved: browserManager.removeBookmark(url);
}
}
ListView {
anchors.fill: parent
......@@ -37,11 +46,10 @@ Kirigami.ScrollablePage {
model: browserManager.bookmarks
delegate: UrlDelegate {
onClicked: pageStack.layers.pop()
onRemoved: browserManager.removeBookmark(url);
delegate: Kirigami.DelegateRecycler {
width: parent.width
sourceComponent: delegateComponent
}
}
Component.onCompleted: print("Bookmarks.qml complete.");
}
......@@ -22,13 +22,22 @@
import QtQuick 2.3
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.2 as Kirigami
import org.kde.kirigami 2.4 as Kirigami
import org.kde.mobile.angelfish 1.0
Kirigami.ScrollablePage {
id: history
title: i18n("History")
Component {
id: delegateComponent
UrlDelegate {
onClicked: pageStack.layers.pop()
onRemoved: browserManager.removeFromHistory(url);
}
}
ListView {
anchors.fill: parent
......@@ -39,9 +48,9 @@ Kirigami.ScrollablePage {
sourceModel: browserManager.history
}
delegate: UrlDelegate {
onClicked: pageStack.layers.pop()
onRemoved: browserManager.removeFromHistory(url);
delegate: Kirigami.DelegateRecycler {
width: parent.width
sourceComponent: delegateComponent
}
}
Component.onCompleted: print("History.qml complete.");
......
......@@ -25,7 +25,7 @@ import QtQuick.Layouts 1.3
import org.kde.kirigami 2.5 as Kirigami
Kirigami.AbstractListItem {
Kirigami.SwipeListItem {
id: urlDelegate
property bool showRemove: true
......@@ -47,12 +47,6 @@ Kirigami.AbstractListItem {
signal removed
Rectangle {
Kirigami.Theme.inherit: true
anchors.fill: parent
color: Kirigami.Theme.backgroundColor
}
RowLayout {
Kirigami.Theme.inherit: true
......@@ -92,18 +86,13 @@ Kirigami.AbstractListItem {
Layout.fillWidth: true
}
}
}
// We can't use SwipeListItem for performance reasons
Kirigami.Icon {
height: Kirigami.Units.gridUnit * 2
width: height
source: "list-remove"
actions: [
Kirigami.Action {
icon.name: "list-remove"
visible: urlDelegate.showRemove
MouseArea {
anchors.fill: parent
onClicked: urlDelegate.removed();
}
onTriggered: urlDelegate.removed();
}
}
]
}
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