// NewSessionDialog.qml — Dialog for creating a new session import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Dialog { id: root title: "New Session" anchors.centerIn: parent width: 380 modal: true signal sessionCreated() contentItem: ColumnLayout { spacing: 16 Layout.margins: 16 Label { id: errorLabel Layout.fillWidth: true visible: text !== "" color: "red" wrapMode: Text.Wrap } RowLayout { Layout.fillWidth: true Label { text: "Name:"; Layout.preferredWidth: 80 } TextField { id: nameField Layout.fillWidth: true placeholderText: "(auto-generated)" } } RowLayout { Layout.fillWidth: true Label { text: "Remote:"; Layout.preferredWidth: 80 } TextField { id: remoteField Layout.fillWidth: true placeholderText: "user@host (optional)" } } } footer: RowLayout { Layout.fillWidth: true Item { Layout.fillWidth: true } Button { text: "OK" onClicked: { errorLabel.text = "" var name = nameField.text.trim() var remote = remoteField.text.trim() var err = ollie.createSession(name, remote) if (err === "") { ollie.refreshSessions() root.sessionCreated() root.close() } else { errorLabel.text = err } } } Button { text: "Cancel" onClicked: root.close() } } onOpened: { errorLabel.text = "" nameField.text = "" remoteField.text = "" } }