Port CreateRoomDialog to FormCard
This commit is contained in:
@@ -1,41 +1,42 @@
|
|||||||
// SPDX-FileCopyrightText: 2019 Black Hat <bhat@encom.eu.org>
|
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-or-later OR LicenseRef-KDE-Accepted-GPL
|
||||||
|
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15 as QQC2
|
|
||||||
import QtQuick.Layouts 1.15
|
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
||||||
import org.kde.kirigami 2.15 as Kirigami
|
|
||||||
|
|
||||||
import org.kde.neochat 1.0
|
import org.kde.neochat 1.0
|
||||||
|
|
||||||
Kirigami.ScrollablePage {
|
FormCard.FormCardPage {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
parent: applicationWindow().overlay
|
title: i18nc("@title", "Create a Room")
|
||||||
|
|
||||||
title: i18n("Create a Room")
|
Component.onCompleted: roomNameField.forceActiveFocus()
|
||||||
|
|
||||||
Kirigami.FormLayout {
|
FormCard.FormHeader {
|
||||||
QQC2.TextField {
|
title: i18nc("@title", "Room Information")
|
||||||
|
}
|
||||||
|
FormCard.FormCard {
|
||||||
|
FormCard.FormTextFieldDelegate {
|
||||||
id: roomNameField
|
id: roomNameField
|
||||||
Kirigami.FormData.label: i18n("Room name:")
|
label: i18n("Room name:")
|
||||||
onAccepted: roomTopicField.forceActiveFocus();
|
onAccepted: if (roomNameField.text.length > 0) roomTopicField.forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.TextField {
|
FormCard.FormTextFieldDelegate {
|
||||||
id: roomTopicField
|
id: roomTopicField
|
||||||
Kirigami.FormData.label: i18n("Room topic:")
|
label: i18n("Room topic:")
|
||||||
onAccepted: okButton.forceActiveFocus();
|
onAccepted: ok.clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.Button {
|
FormCard.FormButtonDelegate {
|
||||||
id: okButton
|
id: ok
|
||||||
|
|
||||||
text: i18nc("@action:button", "Ok")
|
text: i18nc("@action:button", "Ok")
|
||||||
|
enabled: roomNameField.text.length > 0
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Controller.createRoom(roomNameField.text, roomTopicField.text);
|
Controller.createRoom(roomNameField.text, roomTopicField.text);
|
||||||
root.close();
|
root.closeDialog()
|
||||||
root.destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user