Warning, /network/neochat/src/qml/CollapsedRoomDelegate.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 import QtQuick.Layouts
0007 import QtQml.Models
0008 
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.kirigamiaddons.labs.components as KirigamiComponents
0011 import org.kde.kitemmodels
0012 
0013 import org.kde.neochat
0014 import org.kde.neochat.config
0015 
0016 QQC2.ItemDelegate {
0017     id: root
0018 
0019     required property NeoChatRoom currentRoom
0020     required property bool categoryVisible
0021     required property string filterText
0022     required property string avatar
0023     required property string displayName
0024 
0025     topPadding: Kirigami.Units.largeSpacing
0026     leftPadding: Kirigami.Units.largeSpacing
0027     rightPadding: Kirigami.Units.largeSpacing
0028     bottomPadding: Kirigami.Units.largeSpacing
0029 
0030     width: ListView.view.width
0031     height: visible ? ListView.view.width : 0
0032 
0033     visible: root.categoryVisible || filterText.length > 0
0034 
0035     contentItem: KirigamiComponents.Avatar {
0036         source: root.avatar ? `image://mxc/${root.avatar}` : ""
0037         name: root.displayName
0038 
0039         sourceSize {
0040             width: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
0041             height: Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2
0042         }
0043     }
0044 
0045     onClicked: RoomManager.resolveResource(currentRoom.id)
0046 
0047     Keys.onEnterPressed: RoomManager.resolveResource(currentRoom.id)
0048     Keys.onReturnPressed: RoomManager.resolveResource(currentRoom.id)
0049 
0050     QQC2.ToolTip.visible: text.length > 0 && hovered
0051     QQC2.ToolTip.text: root.displayName ?? ""
0052     QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0053 }