Replace QML clipboard hack by proper new Clipboard
This commit is contained in:
parent
30823a9bf5
commit
6aac5a9edb
|
@ -185,9 +185,8 @@ Rectangle {
|
||||||
eventList.selectableLabelContainer.joinedSelection
|
eventList.selectableLabelContainer.joinedSelection
|
||||||
) {
|
) {
|
||||||
ev.accepted = true
|
ev.accepted = true
|
||||||
Utils.copyToClipboard(
|
Clipboard.text =
|
||||||
eventList.selectableLabelContainer.joinedSelection,
|
eventList.selectableLabelContainer.joinedSelection
|
||||||
)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ Column {
|
||||||
qsTr("Copy media address")
|
qsTr("Copy media address")
|
||||||
|
|
||||||
visible: Boolean(text)
|
visible: Boolean(text)
|
||||||
onTriggered: Utils.copyToClipboard(contextMenu.media[1])
|
onTriggered: Clipboard.text = contextMenu.media[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
HMenuItem {
|
HMenuItem {
|
||||||
|
@ -144,7 +144,7 @@ Column {
|
||||||
icon.name: "copy-link"
|
icon.name: "copy-link"
|
||||||
text: qsTr("Copy link address")
|
text: qsTr("Copy link address")
|
||||||
visible: Boolean(contextMenu.link)
|
visible: Boolean(contextMenu.link)
|
||||||
onTriggered: Utils.copyToClipboard(contextMenu.link)
|
onTriggered: Clipboard.text = contextMenu.link
|
||||||
}
|
}
|
||||||
|
|
||||||
HMenuItem {
|
HMenuItem {
|
||||||
|
@ -153,7 +153,7 @@ Column {
|
||||||
visible: enabled || (! copyLink.visible && ! copyMedia.visible)
|
visible: enabled || (! copyLink.visible && ! copyMedia.visible)
|
||||||
enabled: Boolean(selectableLabelContainer.joinedSelection)
|
enabled: Boolean(selectableLabelContainer.joinedSelection)
|
||||||
onTriggered:
|
onTriggered:
|
||||||
Utils.copyToClipboard(selectableLabelContainer.joinedSelection)
|
Clipboard.text = selectableLabelContainer.joinedSelection
|
||||||
}
|
}
|
||||||
|
|
||||||
HMenuItem {
|
HMenuItem {
|
||||||
|
|
|
@ -35,17 +35,9 @@ ApplicationWindow {
|
||||||
property var theme: null
|
property var theme: null
|
||||||
|
|
||||||
readonly property alias py: py
|
readonly property alias py: py
|
||||||
readonly property alias pseudoClipboard: pseudoClipboard
|
|
||||||
|
|
||||||
Python { id: py }
|
Python { id: py }
|
||||||
|
|
||||||
TextEdit {
|
|
||||||
id: pseudoClipboard
|
|
||||||
visible: false
|
|
||||||
readOnly: true
|
|
||||||
textFormat: Text.PlainText
|
|
||||||
}
|
|
||||||
|
|
||||||
HLoader {
|
HLoader {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: py.ready ? "" : "LoadingScreen.qml"
|
source: py.ready ? "" : "LoadingScreen.qml"
|
||||||
|
|
|
@ -280,14 +280,6 @@ function flickToBottom(flickable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function copyToClipboard(text) {
|
|
||||||
window.pseudoClipboard.clear()
|
|
||||||
window.pseudoClipboard.insert(0, text)
|
|
||||||
window.pseudoClipboard.selectAll()
|
|
||||||
window.pseudoClipboard.copy()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function urlExtension(url) {
|
function urlExtension(url) {
|
||||||
return url.toString().split("/").slice(-1)[0].split("?")[0].split(".")
|
return url.toString().split("/").slice(-1)[0].split("?")[0].split(".")
|
||||||
.slice(-1)[0].toLowerCase()
|
.slice(-1)[0].toLowerCase()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user