Replace QML clipboard hack by proper new Clipboard

This commit is contained in:
miruka 2019-10-25 08:42:04 -04:00
parent 30823a9bf5
commit 6aac5a9edb
4 changed files with 5 additions and 22 deletions

View File

@ -185,9 +185,8 @@ Rectangle {
eventList.selectableLabelContainer.joinedSelection
) {
ev.accepted = true
Utils.copyToClipboard(
eventList.selectableLabelContainer.joinedSelection,
)
Clipboard.text =
eventList.selectableLabelContainer.joinedSelection
return
}

View File

@ -136,7 +136,7 @@ Column {
qsTr("Copy media address")
visible: Boolean(text)
onTriggered: Utils.copyToClipboard(contextMenu.media[1])
onTriggered: Clipboard.text = contextMenu.media[1]
}
HMenuItem {
@ -144,7 +144,7 @@ Column {
icon.name: "copy-link"
text: qsTr("Copy link address")
visible: Boolean(contextMenu.link)
onTriggered: Utils.copyToClipboard(contextMenu.link)
onTriggered: Clipboard.text = contextMenu.link
}
HMenuItem {
@ -153,7 +153,7 @@ Column {
visible: enabled || (! copyLink.visible && ! copyMedia.visible)
enabled: Boolean(selectableLabelContainer.joinedSelection)
onTriggered:
Utils.copyToClipboard(selectableLabelContainer.joinedSelection)
Clipboard.text = selectableLabelContainer.joinedSelection
}
HMenuItem {

View File

@ -35,17 +35,9 @@ ApplicationWindow {
property var theme: null
readonly property alias py: py
readonly property alias pseudoClipboard: pseudoClipboard
Python { id: py }
TextEdit {
id: pseudoClipboard
visible: false
readOnly: true
textFormat: Text.PlainText
}
HLoader {
anchors.fill: parent
source: py.ready ? "" : "LoadingScreen.qml"

View File

@ -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) {
return url.toString().split("/").slice(-1)[0].split("?")[0].split(".")
.slice(-1)[0].toLowerCase()