// SPDX-FileCopyrightText: 2026 Matvey Shcherbinin // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL import QtQuick import QtQuick.Layouts import QtQuick.Controls as QQC2 import org.kde.kirigami as Kirigami import koutnet.app // NeoChat's Create Room dialog: name, private or public, address when public. Kirigami.Dialog { id: root title: i18nc("@title:window", "Create Room") implicitWidth: Kirigami.Units.gridUnit * 22 showCloseButton: false standardButtons: QQC2.Dialog.Cancel property alias roomName: nameField.text signal createRequested(string name, string alias, bool isPrivate) // blank form on every open, a dismissed attempt is not the next room's name. function openWithFocus() { nameField.text = "" addressField.text = "" privateButton.checked = true root.open() nameField.forceActiveFocus() } onAccepted: root.createRequested(nameField.text.trim(), publicButton.checked ? addressField.text.trim() : "", privateButton.checked) footer: QQC2.DialogButtonBox { QQC2.Button { text: i18nc("@action:button create a room with the name typed above", "Create") icon.name: "list-add" enabled: nameField.text.trim().length > 0 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole } } ColumnLayout { spacing: Kirigami.Units.largeSpacing QQC2.ButtonGroup { id: typeGroup } QQC2.RadioButton { id: privateButton text: i18nc("@option:radio a room only invited people can join", "Private") checked: true QQC2.ButtonGroup.group: typeGroup } QQC2.Label { Layout.fillWidth: true Layout.leftMargin: privateButton.leftPadding text: i18nc("@info:description what a private room means", "This room can only be joined with an invite.") font: Kirigami.Theme.smallFont color: AppPalette.disabledText wrapMode: Text.WordWrap } QQC2.RadioButton { id: publicButton text: i18nc("@option:radio a room listed in the public directory", "Public") QQC2.ButtonGroup.group: typeGroup } QQC2.Label { Layout.fillWidth: true Layout.leftMargin: publicButton.leftPadding text: i18nc("@info:description what a public room means", "This room can be found and joined by anyone.") font: Kirigami.Theme.smallFont color: AppPalette.disabledText wrapMode: Text.WordWrap } Kirigami.Separator { Layout.fillWidth: true } QQC2.Label { text: i18nc("@label:textbox name of the room being created", "Name:") } QQC2.TextField { id: nameField Layout.fillWidth: true placeholderText: i18nc("@info:placeholder", "New Room") onAccepted: if (text.trim().length > 0) root.accept() } QQC2.Label { visible: publicButton.checked text: i18nc("@label:textbox the address a public room is listed under", "Address:") } QQC2.TextField { id: addressField Layout.fillWidth: true visible: publicButton.checked placeholderText: i18nc("@info:placeholder the local part of a room alias, the server fills in the rest", "new-room") } } }