Implement creating spaces

This commit is contained in:
Tobias Fella
2023-06-08 20:05:53 +00:00
parent 22694fe5e4
commit 72c85af407
6 changed files with 94 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.20 as Kirigami
import org.kde.neochat 1.0
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
Kirigami.OverlaySheet {
id: root
title: i18n("Create a Space")
Kirigami.Theme.colorSet: Kirigami.Theme.Window
MobileForm.FormCard {
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18nc("@title", "Create a Space")
}
MobileForm.FormTextFieldDelegate {
id: nameDelegate
label: i18n("Space name")
}
MobileForm.FormTextFieldDelegate {
id: topicDelegate
label: i18n("Space topic (optional)")
}
MobileForm.FormButtonDelegate {
text: i18n("Create space")
onClicked: {
Controller.createSpace(nameDelegate.text, topicDelegate.text)
root.close()
root.destroy()
}
enabled: nameDelegate.text.length > 0
}
}
}
}

View File

@@ -24,18 +24,26 @@ QQC2.ToolBar {
}
property Kirigami.Action chatAction: Kirigami.Action {
text: i18n("Start a Chat")
icon.name: "irc-join-channel"
icon.name: "list-add-user"
onTriggered: applicationWindow().pushReplaceLayer("qrc:/StartChatPage.qml", {connection: Controller.activeConnection})
}
property Kirigami.Action roomAction: Kirigami.Action {
text: i18n("Create a Room")
icon.name: "irc-join-channel"
icon.name: "system-users"
onTriggered: {
let dialog = createRoomDialog.createObject(root.overlay);
dialog.open();
}
shortcut: StandardKey.New
}
property Kirigami.Action spaceAction: Kirigami.Action {
text: i18n("Create a Space")
icon.name: "list-add"
onTriggered: {
let dialog = createSpaceDialog.createObject(root.overlay);
dialog.open()
}
}
padding: 0
@@ -86,6 +94,9 @@ QQC2.ToolBar {
QQC2.MenuItem {
action: roomAction
}
QQC2.MenuItem {
action: spaceAction
}
}
}
Component {
@@ -123,6 +134,11 @@ QQC2.ToolBar {
action: roomAction
onClicked: menuRoot.close()
}
Kirigami.BasicListItem {
implicitHeight: Kirigami.Units.gridUnit * 3
action: roomAction
onClicked: menuRoot.close()
}
}
}
}

View File

@@ -323,6 +323,11 @@ Kirigami.ApplicationWindow {
CreateRoomDialog {}
}
Component {
id: createSpaceDialog
CreateSpaceDialog {}
}
Component {
id: roomWindow
RoomWindow {}