misc: avoid dirty qrc urls

e.g. <a href="test" id="fuzzelement1">test</a> is invalid
and should not open qrc://components/test

Also fix editId on message edition and format in the reply row.

Change-Id: I570ddf18f6ba716e448e9fbadd558a4d04cdef1c
This commit is contained in:
Sébastien Blin
2023-01-04 13:53:21 -05:00
parent e842a44567
commit a05632e3f4
8 changed files with 9 additions and 6 deletions

View File

@@ -202,7 +202,7 @@ Loader {
dataTransferItem.hoveredLink = canOpen ?
("file:///" + Body) : ""
if (dataTransferItem.hoveredLink)
Qt.openUrlExternally(dataTransferItem.hoveredLink)
Qt.openUrlExternally(new Url(dataTransferItem.hoveredLink))
}
}
}

View File

@@ -86,6 +86,7 @@ Item {
text: ReplyToBody
elide: Text.ElideRight
textFormat: Text.MarkdownText
color: UtilsAdapter.luma(bubble.color) ?
JamiTheme.chatviewTextColorLight :

View File

@@ -83,7 +83,7 @@ SBSMessageBase {
renderType: Text.NativeRendering
textFormat: Text.MarkdownText
onLinkHovered: root.hoveredLink = hoveredLink
onLinkActivated: Qt.openUrlExternally(hoveredLink)
onLinkActivated: Qt.openUrlExternally(new URL(hoveredLink))
readOnly: true
color: getBaseColor()

View File

@@ -155,7 +155,7 @@ BaseModalDialog {
textFormat: TextEdit.RichText
selectByMouse: true
readOnly: true
onLinkActivated: Qt.openUrlExternally(link)
onLinkActivated: Qt.openUrlExternally(new Url(link))
TextMetrics {
id: textMetricsjamiDeclarationHyperText
@@ -189,7 +189,7 @@ BaseModalDialog {
textFormat: TextEdit.RichText
selectByMouse: true
readOnly: true
onLinkActivated: Qt.openUrlExternally(link)
onLinkActivated: Qt.openUrlExternally(new Url(link))
TextMetrics {
id: textMetricsjamiNoneWarrantyHyperText

View File

@@ -70,6 +70,7 @@ Rectangle {
}
text: metrics.elidedText
textFormat: Text.MarkdownText
color: UtilsAdapter.luma(root.color) ?
JamiTheme.chatviewTextColorLight :
JamiTheme.chatviewTextColorDark

View File

@@ -92,7 +92,7 @@ Component {
ctxMenu.y = mouse.y
ctxMenu.openMenu()
} else {
Qt.openUrlExternally("file://" + Body)
Qt.openUrlExternally(new Url("file://" + Body))
}
}
}

View File

@@ -180,6 +180,7 @@ MessagesAdapter::editMessage(const QString& convId, const QString& newBody, cons
if (editId.isEmpty()) {
return;
}
set_editId("");
lrcInstance_->getCurrentConversationModel()->editMessage(convId, newBody, editId);
} catch (...) {
qDebug() << "Exception during message edition:" << messageId;

View File

@@ -220,7 +220,7 @@ Window {
autoAccelerator: true
onClicked: Qt.openUrlExternally(
"https://jami.net/bugs-and-improvements/")
new Url("https://jami.net/bugs-and-improvements/"))
}
}
}