Don't load empty images from imageprovider

Previously, when there was no avatar set, the source property of Avatar was still set to 'image://mxc/',
which caused Avatar to load that from the imageprovider. The imageprovider can't provide an empty image and aborts with error


(cherry picked from commit 724f10a895)
This commit is contained in:
Tobias Fella
2020-12-28 00:25:38 +00:00
committed by Carl Schwan
parent e87ae48f17
commit 893bc79f1e
11 changed files with 13 additions and 13 deletions

View File

@@ -89,7 +89,7 @@ ToolBar {
Layout.preferredWidth: Kirigami.Units.gridUnit
Layout.preferredHeight: Kirigami.Units.gridUnit
source: replyUser ? "image://mxc/" + replyUser.avatarMediaId: ""
source: replyUser ? ("image://mxc/" + replyUser.avatarMediaId) : ""
name: replyUser ? replyUser.displayName : i18n("No name")
}
@@ -156,7 +156,7 @@ ToolBar {
Kirigami.Avatar {
Layout.preferredWidth: Kirigami.Units.gridUnit
Layout.preferredHeight: Kirigami.Units.gridUnit
source: modelData.avatarMediaId ? "image://mxc/" + modelData.avatarMediaId : ""
source: modelData.avatarMediaId ? ("image://mxc/" + modelData.avatarMediaId) : ""
color: modelData.color ? Qt.darker(modelData.color, 1.1) : null
visible: !isEmoji
}

View File

@@ -52,7 +52,7 @@ RowLayout {
visible: showAuthor && Config.showAvatarInTimeline
name: author.displayName
source: author.avatarMediaId ? "image://mxc/" + author.avatarMediaId : ""
source: author.avatarMediaId ? ("image://mxc/" + author.avatarMediaId) : ""
color: author.color
Component {

View File

@@ -30,7 +30,7 @@ QQC2.AbstractButton {
Layout.preferredHeight: Kirigami.Units.gridUnit
Layout.alignment: Qt.AlignTop
visible: Config.showAvatarInTimeline
source: replyVisible && reply.author.avatarMediaId ? "image://mxc/" + reply.author.avatarMediaId : ""
source: replyVisible && reply.author.avatarMediaId ? ("image://mxc/" + reply.author.avatarMediaId) : ""
name: replyVisible ? reply.author.displayName : "H"
color: replyVisible ? reply.author.color : Kirigami.Theme.highlightColor
}

View File

@@ -26,7 +26,7 @@ RowLayout {
Layout.preferredHeight: Kirigami.Units.iconSizes.small
name: author.displayName
source: author.avatarMediaId ? "image://mxc/" + author.avatarMediaId : ""
source: author.avatarMediaId ? ("image://mxc/" + author.avatarMediaId) : ""
color: author.color
Component {