* Split QML part into distinct versions for Plasma 5 and 6 as there are too many differences and `#ifdef` is not possible * Change API usage according to https://develop.kde.org/docs/plasma/widget/porting_kf6 * Port "contextualActions" to API documented on https://invent.kde.org/frameworks/plasma-framework/-/blob/master/src/plasma/applet.h * Document testing * Add FIXMEs/notes for remaining problems; there are likely many more, though
128 lines
5.4 KiB
QML
128 lines
5.4 KiB
QML
import QtQuick 2.3
|
|
import QtQuick.Layouts 1.1
|
|
import QtQml.Models 2.2
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
|
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
|
|
|
|
Item {
|
|
property alias view: recentChangesView
|
|
objectName: "RecentChangesPage"
|
|
|
|
PlasmaComponents3.ScrollView {
|
|
anchors.fill: parent
|
|
|
|
// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890
|
|
PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff
|
|
|
|
contentItem: TopLevelView {
|
|
id: recentChangesView
|
|
model: plasmoid.recentChangesModel
|
|
delegate: TopLevelItem {
|
|
width: recentChangesView.effectiveWidth()
|
|
ColumnLayout {
|
|
width: parent.width
|
|
spacing: 0
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
PlasmaCore.IconItem {
|
|
Layout.preferredWidth: Kirigami.Units.iconSizes.small
|
|
Layout.preferredHeight: Kirigami.Units.iconSizes.small
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
source: actionIcon
|
|
}
|
|
PlasmaComponents3.Label {
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
Layout.fillWidth: true
|
|
elide: Text.ElideRight
|
|
text: extendedAction
|
|
}
|
|
Item {
|
|
width: Kirigami.Units.smallSpacing
|
|
}
|
|
Image {
|
|
Layout.preferredWidth: Kirigami.Units.iconSizes.small
|
|
Layout.preferredHeight: Kirigami.Units.iconSizes.small
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
height: parent.height
|
|
fillMode: Image.PreserveAspectFit
|
|
source: plasmoid.faUrl + "calendar"
|
|
}
|
|
PlasmaComponents3.Label {
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
elide: Text.ElideRight
|
|
text: eventTime
|
|
}
|
|
Item {
|
|
width: Kirigami.Units.smallSpacing
|
|
}
|
|
Image {
|
|
Layout.preferredWidth: Kirigami.Units.iconSizes.small
|
|
Layout.preferredHeight: Kirigami.Units.iconSizes.small
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
height: parent.height
|
|
fillMode: Image.PreserveAspectFit
|
|
source: plasmoid.faUrl + "qrcode"
|
|
}
|
|
PlasmaComponents3.Label {
|
|
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
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
|
height: parent.height
|
|
fillMode: Image.PreserveAspectFit
|
|
source: plasmoid.faUrl + (itemType === "file" ? "file-o" : "folder-o")
|
|
}
|
|
PlasmaComponents3.Label {
|
|
text: directoryId + ": "
|
|
font.weight: Font.DemiBold
|
|
}
|
|
PlasmaComponents3.Label {
|
|
Layout.fillWidth: true
|
|
text: path
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
}
|
|
|
|
function copyPath() {
|
|
plasmoid.copyToClipboard(path)
|
|
}
|
|
function copyDeviceId() {
|
|
plasmoid.copyToClipboard(modifiedBy)
|
|
}
|
|
function copyFolderId() {
|
|
plasmoid.copyToClipboard(folderId)
|
|
}
|
|
}
|
|
|
|
PlasmaExtras.Menu {
|
|
id: contextMenu
|
|
PlasmaExtras.MenuItem {
|
|
text: qsTr("Copy path")
|
|
icon: "edit-copy"
|
|
onClicked: recentChangesView.currentItem.copyPath()
|
|
}
|
|
PlasmaExtras.MenuItem {
|
|
text: qsTr("Copy device ID")
|
|
icon: "network-server-symbolic"
|
|
onClicked: recentChangesView.currentItem.copyDeviceId()
|
|
}
|
|
PlasmaExtras.MenuItem {
|
|
text: qsTr("Copy directory ID")
|
|
icon: "folder"
|
|
onClicked: recentChangesView.currentItem.copyFolderId()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|