syncthingtray/plasmoid/package6/contents/ui/RecentChangesPage.qml

128 lines
5.4 KiB
QML
Raw Normal View History

2020-01-18 16:37:20 +01:00
import QtQuick 2.3
import QtQuick.Layouts 1.1
import QtQml.Models 2.2
import org.kde.plasma.components 3.0 as PlasmaComponents3
2020-01-18 16:37:20 +01:00
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.20 as Kirigami
2020-01-18 16:37:20 +01:00
Item {
property alias view: recentChangesView
objectName: "RecentChangesPage"
PlasmaComponents3.ScrollView {
2020-01-18 16:37:20 +01:00
anchors.fill: parent
2022-05-09 23:14:22 +02:00
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
contentItem: TopLevelView {
2020-01-18 16:37:20 +01:00
id: recentChangesView
model: plasmoid.recentChangesModel
2020-01-18 16:37:20 +01:00
delegate: TopLevelItem {
width: recentChangesView.effectiveWidth()
2020-01-18 16:37:20 +01:00
ColumnLayout {
width: parent.width
spacing: 0
RowLayout {
Layout.fillWidth: true
Kirigami.Icon {
Layout.preferredWidth: Kirigami.Units.iconSizes.small
Layout.preferredHeight: Kirigami.Units.iconSizes.small
2020-01-18 16:37:20 +01:00
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
source: actionIcon
}
PlasmaComponents3.Label {
2020-01-18 16:37:20 +01:00
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillWidth: true
elide: Text.ElideRight
text: extendedAction
}
Item {
width: Kirigami.Units.smallSpacing
2020-01-18 16:37:20 +01:00
}
Image {
Layout.preferredWidth: Kirigami.Units.iconSizes.small
Layout.preferredHeight: Kirigami.Units.iconSizes.small
2020-01-18 16:37:20 +01:00
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
height: parent.height
fillMode: Image.PreserveAspectFit
source: plasmoid.faUrl + "calendar"
2020-01-18 16:37:20 +01:00
}
PlasmaComponents3.Label {
2020-01-18 16:37:20 +01:00
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
elide: Text.ElideRight
text: eventTime
}
Item {
width: Kirigami.Units.smallSpacing
2020-01-18 16:37:20 +01:00
}
Image {
Layout.preferredWidth: Kirigami.Units.iconSizes.small
Layout.preferredHeight: Kirigami.Units.iconSizes.small
2020-01-18 16:37:20 +01:00
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
height: parent.height
fillMode: Image.PreserveAspectFit
source: plasmoid.faUrl + "qrcode"
2020-01-18 16:37:20 +01:00
}
PlasmaComponents3.Label {
2020-01-18 16:37:20 +01:00
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
elide: Text.ElideRight
text: modifiedBy
}
}
RowLayout {
Layout.fillWidth: true
Image {
Layout.preferredWidth: Kirigami.Units.iconSizes.small
Layout.preferredHeight: Kirigami.Units.iconSizes.small
2020-01-18 16:37:20 +01:00
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
height: parent.height
fillMode: Image.PreserveAspectFit
source: plasmoid.faUrl + (itemType === "file" ? "file-o" : "folder-o")
2020-01-18 16:37:20 +01:00
}
PlasmaComponents3.Label {
2020-01-18 16:37:20 +01:00
text: directoryId + ": "
font.weight: Font.DemiBold
}
PlasmaComponents3.Label {
2020-01-18 16:37:20 +01:00
Layout.fillWidth: true
text: path
elide: Text.ElideRight
}
}
}
function copyPath() {
plasmoid.copyToClipboard(path)
2020-01-18 16:37:20 +01:00
}
function copyDeviceId() {
plasmoid.copyToClipboard(modifiedBy)
2020-01-18 16:37:20 +01:00
}
function copyFolderId() {
plasmoid.copyToClipboard(folderId)
}
2020-01-18 16:37:20 +01:00
}
PlasmaExtras.Menu {
2020-01-18 16:37:20 +01:00
id: contextMenu
PlasmaExtras.MenuItem {
2020-01-18 16:37:20 +01:00
text: qsTr("Copy path")
icon: "edit-copy"
onClicked: recentChangesView.currentItem.copyPath()
}
PlasmaExtras.MenuItem {
2020-01-18 16:37:20 +01:00
text: qsTr("Copy device ID")
icon: "network-server-symbolic"
onClicked: recentChangesView.currentItem.copyDeviceId()
}
PlasmaExtras.MenuItem {
text: qsTr("Copy folder ID")
icon: "folder"
onClicked: recentChangesView.currentItem.copyFolderId()
}
2020-01-18 16:37:20 +01:00
}
}
}
}