Make message display names selectable
This commit is contained in:
parent
b610a404af
commit
32fde57ba7
1
TODO.md
1
TODO.md
|
@ -1,5 +1,4 @@
|
|||
- Message selection
|
||||
- Copy names
|
||||
- Copy text with triple click, copy text + name + date with quadruple click
|
||||
- Copy to X11 selection
|
||||
- Make scroll wheel usable
|
||||
|
|
|
@ -26,8 +26,10 @@ TextEdit {
|
|||
}
|
||||
|
||||
|
||||
// If index is a whole number, the label will get two \n before itself
|
||||
// in container.joinedSelection. If it's a decimal number, if gets one \n.
|
||||
property real index
|
||||
property HSelectableLabelContainer container
|
||||
property int index
|
||||
|
||||
|
||||
function updateSelection() {
|
||||
|
|
|
@ -11,10 +11,9 @@ FocusScope {
|
|||
property bool reversed: false
|
||||
|
||||
readonly property bool dragging: pointHandler.active || dragHandler.active
|
||||
// onDraggingChanged: print(dragging)
|
||||
property bool selecting: false
|
||||
property int selectionStart: -1
|
||||
property int selectionEnd: -1
|
||||
property real selectionStart: -1
|
||||
property real selectionEnd: -1
|
||||
property point selectionStartPosition: Qt.point(-1, -1)
|
||||
property point selectionEndPosition: Qt.point(-1, -1)
|
||||
property var selectedTexts: ({})
|
||||
|
@ -28,12 +27,16 @@ FocusScope {
|
|||
let toCopy = []
|
||||
|
||||
for (let key of Object.keys(selectedTexts).sort()) {
|
||||
if (selectedTexts[key]) toCopy.push(selectedTexts[key])
|
||||
if (! selectedTexts[key]) continue
|
||||
|
||||
// For some dumb reason, Object.keys convert the floats to strings
|
||||
toCopy.push(Number.isInteger(parseFloat(key)) ? "\n\n" : "\n")
|
||||
toCopy.push(selectedTexts[key])
|
||||
}
|
||||
|
||||
if (reversed) toCopy.reverse()
|
||||
|
||||
return toCopy.join("\n\n")
|
||||
return toCopy.join("").trim()
|
||||
}
|
||||
|
||||
readonly property alias dragPoint: dragHandler.centroid
|
||||
|
|
|
@ -46,19 +46,24 @@ Row {
|
|||
Column {
|
||||
anchors.fill: parent
|
||||
|
||||
HLabel {
|
||||
HSelectableLabel {
|
||||
id: nameLabel
|
||||
width: parent.width
|
||||
visible: ! hideNameLine
|
||||
container: selectableLabelContainer
|
||||
|
||||
// This is +0.1 and content is +0 instead of the opposite,
|
||||
// because the eventList is reversed
|
||||
index: model.index + 0.1
|
||||
|
||||
text: Utils.coloredNameHtml(model.sender_name, model.sender_id)
|
||||
textFormat: Text.StyledText
|
||||
elide: Text.ElideRight
|
||||
textFormat: Text.RichText
|
||||
// elide: Text.ElideRight
|
||||
horizontalAlignment: onRight ? Text.AlignRight : Text.AlignLeft
|
||||
|
||||
leftPadding: theme.spacing
|
||||
rightPadding: leftPadding
|
||||
topPadding: theme.spacing / 2 * lineHeight
|
||||
topPadding: theme.spacing / 2
|
||||
}
|
||||
|
||||
HSelectableLabel {
|
||||
|
|
Loading…
Reference in New Issue
Block a user