* 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
30 lines
695 B
QML
30 lines
695 B
QML
import QtQuick 2.7
|
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
|
|
|
ListView {
|
|
id: detailView
|
|
property DetailItem contextMenuItem: null
|
|
currentIndex: -1
|
|
interactive: false
|
|
height: contentHeight
|
|
|
|
PlasmaExtras.Menu {
|
|
id: contextMenu
|
|
PlasmaExtras.MenuItem {
|
|
text: qsTr('Copy value')
|
|
icon: "edit-copy"
|
|
onClicked: {
|
|
var item = detailView.contextMenuItem
|
|
if (item) {
|
|
plasmoid.copyToClipboard(item.detailValue)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function showContextMenu(item, x, y) {
|
|
contextMenuItem = item
|
|
contextMenu.open(x, y)
|
|
}
|
|
}
|