Make composer/eventList ctrl-c work again
This commit is contained in:
@@ -162,8 +162,13 @@ HRowLayout {
|
||||
Layout.maximumWidth: eventContent.maxMessageWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
onSelectedTextChanged:
|
||||
if (selectedText) eventList.delegateWithSelectedText = model.id
|
||||
onSelectedTextChanged: if (selectedText) {
|
||||
eventList.delegateWithSelectedText = model.id
|
||||
eventList.selectedText = selectedText
|
||||
} else if (eventList.delegateWithSelectedText === model.id) {
|
||||
eventList.delegateWithSelectedText = ""
|
||||
eventList.selectedText = ""
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: eventList
|
||||
|
@@ -196,18 +196,7 @@ HColumnLayout {
|
||||
return
|
||||
}
|
||||
|
||||
if (eventContent.selectedText) {
|
||||
Clipboard.text = eventContent.selectedText
|
||||
return
|
||||
}
|
||||
|
||||
const contents = []
|
||||
|
||||
for (const model of eventList.getSortedCheckedDelegates()) {
|
||||
contents.push(JSON.parse(model.source).body)
|
||||
}
|
||||
|
||||
Clipboard.text = contents.join("\n\n")
|
||||
eventList.copySelectedDelegates()
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Window 2.12
|
||||
import Clipboard 0.1
|
||||
import "../../.."
|
||||
import "../../../Base"
|
||||
|
||||
@@ -77,8 +78,24 @@ Rectangle {
|
||||
width < theme.chat.eventList.ownEventsOnRightUnderWidth
|
||||
|
||||
property string delegateWithSelectedText: ""
|
||||
property string selectedText: ""
|
||||
|
||||
|
||||
function copySelectedDelegates() {
|
||||
if (eventList.selectedText) {
|
||||
Clipboard.text = eventList.selectedText
|
||||
return
|
||||
}
|
||||
|
||||
const contents = []
|
||||
|
||||
for (const model of eventList.getSortedCheckedDelegates()) {
|
||||
contents.push(JSON.parse(model.source).body)
|
||||
}
|
||||
|
||||
Clipboard.text = contents.join("\n\n")
|
||||
}
|
||||
|
||||
function canCombine(item, itemAfter) {
|
||||
if (! item || ! itemAfter) return false
|
||||
|
||||
|
Reference in New Issue
Block a user