This super helpful and nice dialog went mostly unused, especially if you only joined links to rooms through matrix.to or within NeoChat itself. The reason why this never showed up for said links is because we were greedily overwriting the "action". I don't think the code made solid sense anyway, so I redone it a bit so there's a clearer "join_confirmed" our UI uses. I added a test case to showcase this working.
75 lines
2.1 KiB
QML
75 lines
2.1 KiB
QML
// SPDX-FileCopyrightText: 2024 Tobias Fella <tobias.fella@kde.org>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls as QQC2
|
|
import QtQuick.Layouts
|
|
|
|
import org.kde.kirigami as Kirigami
|
|
import org.kde.kirigamiaddons.components as KirigamiComponents
|
|
import org.kde.kirigamiaddons.formcard as FormCard
|
|
|
|
import org.kde.neochat
|
|
|
|
Kirigami.Dialog {
|
|
id: root
|
|
|
|
required property string room
|
|
required property NeoChatConnection connection
|
|
|
|
leftPadding: 0
|
|
rightPadding: 0
|
|
topPadding: 0
|
|
bottomPadding: 0
|
|
|
|
standardButtons: Kirigami.Dialog.NoButton
|
|
|
|
width: Math.min(QQC2.ApplicationWindow.window.width, Kirigami.Units.gridUnit * 24)
|
|
title: i18nc("@title:dialog", "Join Room")
|
|
|
|
contentItem: ColumnLayout {
|
|
spacing: 0
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: Kirigami.Units.largeSpacing
|
|
Layout.rightMargin: Kirigami.Units.largeSpacing
|
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
|
Layout.bottomMargin: Kirigami.Units.largeSpacing
|
|
spacing: Kirigami.Units.largeSpacing
|
|
|
|
KirigamiComponents.Avatar {
|
|
id: avatar
|
|
Layout.preferredWidth: Kirigami.Units.iconSizes.huge
|
|
Layout.preferredHeight: Kirigami.Units.iconSizes.huge
|
|
|
|
name: root.room.slice(1, -1)
|
|
initialsMode: KirigamiComponents.Avatar.UseInitials
|
|
}
|
|
|
|
Kirigami.Heading {
|
|
level: 1
|
|
Layout.fillWidth: true
|
|
font.bold: true
|
|
|
|
elide: Text.ElideRight
|
|
wrapMode: Text.NoWrap
|
|
text: root.room
|
|
textFormat: Text.PlainText
|
|
}
|
|
}
|
|
|
|
Kirigami.Separator {
|
|
Layout.fillWidth: true
|
|
}
|
|
|
|
FormCard.FormButtonDelegate {
|
|
text: i18nc("@action:button", "Join room")
|
|
icon.name: "irc-join-channel"
|
|
onClicked: {
|
|
RoomManager.resolveResource(root.room, "join_confirmed");
|
|
root.close();
|
|
}
|
|
}
|
|
}
|
|
}
|