The problem lies in how media URLs work, in this case it the old
NeoChatRoom::avatarMediaId could pass a mxc url *or* a path that can
be put into root.connection.makeMediaUrl. So normal rooms with avatars
loaded, but never friends because room members gave the mxc URL.
Instead, change everything to use avatarMediaUrl which corrects this
issue by always passing a mxc URL to QML. This also removes the need to
call makeMediaUrl.
Fixes #675
(cherry picked from commit 6b79795229)
53 lines
1.5 KiB
QML
53 lines
1.5 KiB
QML
// SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls as QQC2
|
|
import QtQuick.Layouts
|
|
import QtQml.Models
|
|
|
|
import org.kde.kirigami as Kirigami
|
|
import org.kde.kirigamiaddons.labs.components as KirigamiComponents
|
|
import org.kde.kitemmodels
|
|
|
|
import org.kde.neochat
|
|
|
|
QQC2.ItemDelegate {
|
|
id: root
|
|
|
|
required property NeoChatRoom currentRoom
|
|
required property bool categoryVisible
|
|
required property string filterText
|
|
required property url avatar
|
|
required property string displayName
|
|
|
|
topPadding: Kirigami.Units.largeSpacing
|
|
leftPadding: Kirigami.Units.largeSpacing
|
|
rightPadding: Kirigami.Units.largeSpacing
|
|
bottomPadding: Kirigami.Units.largeSpacing
|
|
|
|
width: ListView.view.width
|
|
height: visible ? ListView.view.width : 0
|
|
|
|
visible: root.categoryVisible || filterText.length > 0
|
|
|
|
contentItem: KirigamiComponents.Avatar {
|
|
source: root.avatar
|
|
name: root.displayName
|
|
|
|
sourceSize {
|
|
width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
|
|
height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
|
|
}
|
|
}
|
|
|
|
onClicked: RoomManager.resolveResource(currentRoom.id)
|
|
|
|
Keys.onEnterPressed: RoomManager.resolveResource(currentRoom.id)
|
|
Keys.onReturnPressed: RoomManager.resolveResource(currentRoom.id)
|
|
|
|
QQC2.ToolTip.visible: text.length > 0 && hovered
|
|
QQC2.ToolTip.text: root.displayName ?? ""
|
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
|
}
|