diff --git a/src/login/WelcomePage.qml b/src/login/WelcomePage.qml index 06b918061..bf9cdeb16 100644 --- a/src/login/WelcomePage.qml +++ b/src/login/WelcomePage.qml @@ -109,7 +109,8 @@ Kirigami.Page { Layout.alignment: Qt.AlignHCenter Layout.topMargin: Kirigami.Units.gridUnit name: delegate.text - source: delegate.connection.localUser.avatarMediaId ? delegate.connection.makeMediaUrl("mxc://" + delegate.connection.localUser.avatarMediaId) : "" + // Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl. + source: delegate.connection.localUser.avatarUrl.toString().length > 0 ? delegate.connection.makeMediaUrl(delegate.connection.localUser.avatarUrl) : "" implicitWidth: Kirigami.Units.iconSizes.medium implicitHeight: Kirigami.Units.iconSizes.medium } diff --git a/src/qml/AccountMenu.qml b/src/qml/AccountMenu.qml index 32658dbbb..a6146c3d5 100644 --- a/src/qml/AccountMenu.qml +++ b/src/qml/AccountMenu.qml @@ -27,7 +27,8 @@ QQC2.Menu { text: "https://matrix.to/#/" + root.connection.localUser.id, title: root.connection.localUser.displayName, subtitle: root.connection.localUser.id, - avatarSource: root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) + // Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl. + avatarSource: root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : "" }); if (typeof root.closeDialog === "function") { root.closeDialog(); diff --git a/src/qml/AccountSwitchDialog.qml b/src/qml/AccountSwitchDialog.qml index fc99e6d76..ae7cd2c69 100644 --- a/src/qml/AccountSwitchDialog.qml +++ b/src/qml/AccountSwitchDialog.qml @@ -125,7 +125,7 @@ Kirigami.Dialog { width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing } - source: userDelegate.connection.localUser.avatarMediaId ? userDelegate.connection.makeMediaUrl("mxc://" + userDelegate.connection.localUser.avatarMediaId) : "" + source: userDelegate.connection.localUser.avatarUrl.toString().length > 0 ? userDelegate.connection.makeMediaUrl(userDelegate.connection.localUser.avatarUrl) : "" name: userDelegate.connection.localUser.displayName ?? userDelegate.connection.localUser.id } diff --git a/src/qml/QrCodeMaximizeComponent.qml b/src/qml/QrCodeMaximizeComponent.qml index d84e7df32..9b1997759 100644 --- a/src/qml/QrCodeMaximizeComponent.qml +++ b/src/qml/QrCodeMaximizeComponent.qml @@ -12,7 +12,7 @@ Components.AbstractMaximizeComponent { required property string text property color avatarColor - required property string avatarSource + required property url avatarSource onOpened: forceActiveFocus() diff --git a/src/qml/UserInfo.qml b/src/qml/UserInfo.qml index e7a5dfb1b..2c36ff25b 100644 --- a/src/qml/UserInfo.qml +++ b/src/qml/UserInfo.qml @@ -37,14 +37,15 @@ RowLayout { } KirigamiComponents.AvatarButton { id: accountButton - readonly property string mediaId: root.connection.localUser.avatarMediaId + readonly property url avatarUrl: root.connection.localUser.avatarUrl Layout.preferredWidth: Kirigami.Units.iconSizes.medium Layout.preferredHeight: Kirigami.Units.iconSizes.medium Layout.leftMargin: Kirigami.Units.largeSpacing text: i18n("Edit this account") - source: mediaId ? root.connection.makeMediaUrl("mxc://" + mediaId) : "" + // Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl. + source: avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(avatarUrl) : "" name: root.connection.localUser.displayName activeFocusOnTab: true diff --git a/src/settings/AccountEditorPage.qml b/src/settings/AccountEditorPage.qml index 9a4151f99..7eae1c46c 100644 --- a/src/settings/AccountEditorPage.qml +++ b/src/settings/AccountEditorPage.qml @@ -34,7 +34,8 @@ FormCard.FormCardPage { padding: 0 - source: root.connection && root.connection.localUser.avatarMediaId ? root.connection.makeMediaUrl("mxc://" + root.connection.localUser.avatarMediaId) : "" + // Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl. + source: root.connection && (root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : "") name: root.connection.localUser.displayName onClicked: { @@ -122,7 +123,8 @@ FormCard.FormCardPage { text: "https://matrix.to/#/" + root.connection.localUser.id, title: root.connection.localUser.displayName, subtitle: root.connection.localUser.id, - avatarSource: root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) + // Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl. + avatarSource: root.connection && (root.connection.localUser.avatarUrl.toString().length > 0 ? root.connection.makeMediaUrl(root.connection.localUser.avatarUrl) : "") }); if (typeof root.closeDialog === "function") { root.closeDialog(); diff --git a/src/settings/AccountsPage.qml b/src/settings/AccountsPage.qml index dc26dc109..13a5a2113 100644 --- a/src/settings/AccountsPage.qml +++ b/src/settings/AccountsPage.qml @@ -53,7 +53,8 @@ FormCard.FormCardPage { contentItem: RowLayout { KirigamiComponents.Avatar { name: accountDelegate.connection.localUser.displayName - source: accountDelegate.connection.localUser.avatarMediaId ? accountDelegate.connection.makeMediaUrl("mxc://" + accountDelegate.connection.localUser.avatarMediaId) : "" + // Note: User::avatarUrl does not set user_id, and thus cannot be used directly here. Hence the makeMediaUrl. + source: accountDelegate.connection.localUser.avatarUrl.toString().length > 0 ? accountDelegate.connection.makeMediaUrl(accountDelegate.connection.localUser.avatarUrl) : "" Layout.rightMargin: Kirigami.Units.largeSpacing implicitWidth: Kirigami.Units.iconSizes.medium diff --git a/src/settings/Permissions.qml b/src/settings/Permissions.qml index 2dbcff655..c6efac65e 100644 --- a/src/settings/Permissions.qml +++ b/src/settings/Permissions.qml @@ -169,7 +169,7 @@ FormCard.FormCardPage { id: userListItem required property string userId - required property string avatar + required property url avatar required property string name required property int powerLevel required property string powerLevelString @@ -180,7 +180,7 @@ FormCard.FormCardPage { KirigamiComponents.Avatar { Layout.preferredWidth: Kirigami.Units.iconSizes.medium Layout.preferredHeight: Kirigami.Units.iconSizes.medium - source: userListItem.avatar ? root.room.connection.makeMediaUrl(userListItem.avatar) : "" + source: userListItem.avatar name: userListItem.name } diff --git a/src/timeline/TimelineEndDelegate.qml b/src/timeline/TimelineEndDelegate.qml index ad2841765..8c74e6f77 100644 --- a/src/timeline/TimelineEndDelegate.qml +++ b/src/timeline/TimelineEndDelegate.qml @@ -35,7 +35,7 @@ TimelineDelegate { Layout.preferredHeight: Kirigami.Units.iconSizes.large name: root.room ? root.room.displayName : "" - source: root.room && root.room.avatarMediaId ? root.room.connection.makeMediaUrl("mxc://" + root.room.avatarMediaId) : "" + source: root.room ? root.room.avatarMediaUrl : "" Rectangle { visible: room.usesEncryption