Add create room dialog
This commit is contained in:
@@ -6,40 +6,43 @@
|
|||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
import QtQuick.Layouts 1.12
|
import QtQuick.Layouts 1.12
|
||||||
|
import org.kde.kirigami 2.13 as Kirigami
|
||||||
|
|
||||||
import NeoChat.Component 1.0
|
import NeoChat.Component 1.0
|
||||||
|
|
||||||
import org.kde.neochat 1.0
|
import org.kde.neochat 1.0
|
||||||
|
|
||||||
Dialog {
|
Kirigami.OverlaySheet {
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 360
|
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
title: i18n("Create a Room")
|
parent: applicationWindow().overlay
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
header: Kirigami.Heading {
|
||||||
AutoTextField {
|
text: i18n("Create a Room")
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
id: roomNameField
|
|
||||||
|
|
||||||
placeholderText: i18n("Room Name")
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoTextField {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
id: roomTopicField
|
|
||||||
|
|
||||||
placeholderText: i18n("Room Topic")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
contentItem: Kirigami.FormLayout {
|
||||||
|
TextField {
|
||||||
|
id: roomNameField
|
||||||
|
Kirigami.FormData.label: i18n("Room Name")
|
||||||
|
onAccepted: roomTopixField.forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
onAccepted: Controller.createRoom(Controller.activeConnection, roomNameField.text, roomTopicField.text)
|
TextField {
|
||||||
|
id: roomTopicField
|
||||||
|
Kirigami.FormData.label: i18n("Room Topic")
|
||||||
|
onAccepted: okButton.forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
onClosed: destroy()
|
Button {
|
||||||
|
id: okButton
|
||||||
|
text: i18nc("@action:button", "Ok")
|
||||||
|
onClicked: {
|
||||||
|
Controller.createRoom(Controller.activeConnection, roomNameField.text, roomTopicField.text)
|
||||||
|
root.close();
|
||||||
|
// TODO investigate how to join the new room automatically
|
||||||
|
root.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
qml/main.qml
16
qml/main.qml
@@ -111,6 +111,16 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat")
|
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat")
|
||||||
},
|
},
|
||||||
|
Kirigami.Action {
|
||||||
|
text: i18n("Create a Room")
|
||||||
|
icon.name: "irc-join-channel"
|
||||||
|
onTriggered: {
|
||||||
|
let dialog = createRoomDialog.createObject(root.overlay);
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat")
|
||||||
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Accounts")
|
text: i18n("Accounts")
|
||||||
icon.name: "im-user"
|
icon.name: "im-user"
|
||||||
@@ -191,4 +201,10 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
RoomPage {}
|
RoomPage {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: createRoomDialog
|
||||||
|
|
||||||
|
CreateRoomDialog {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user