matrixion/qml/dialogs/JoinRoomDialog.qml

66 lines
1.6 KiB
QML
Raw Normal View History

2021-09-25 04:32:06 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
2021-09-25 04:32:06 +03:00
// SPDX-License-Identifier: GPL-3.0-or-later
2022-04-16 03:13:01 +03:00
import "../"
2021-09-25 04:32:06 +03:00
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import im.nheko
2021-09-25 04:32:06 +03:00
ApplicationWindow {
id: joinRoomRoot
2022-04-16 03:13:01 +03:00
color: timelineRoot.palette.window
2021-09-25 04:32:06 +03:00
flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
2022-04-16 03:13:01 +03:00
height: fontMetrics.lineSpacing * 7
modality: Qt.WindowModal
2022-04-11 05:18:16 +03:00
palette: timelineRoot.palette
2022-04-16 03:13:01 +03:00
title: qsTr("Join room")
2021-09-25 04:32:06 +03:00
width: 350
2022-04-16 03:13:01 +03:00
footer: DialogButtonBox {
id: dbb
standardButtons: DialogButtonBox.Cancel
onAccepted: {
Nheko.joinRoom(input.text);
joinRoomRoot.close();
}
onRejected: {
joinRoomRoot.close();
}
Button {
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
enabled: input.text.match("#.+?:.{3,}")
text: "Join"
}
}
2021-09-25 04:32:06 +03:00
2021-10-06 02:53:39 +03:00
Shortcut {
sequence: StandardKey.Cancel
2022-04-16 03:13:01 +03:00
2021-10-06 02:53:39 +03:00
onActivated: dbb.rejected()
}
2021-09-25 04:32:06 +03:00
ColumnLayout {
anchors.fill: parent
2022-04-16 03:13:01 +03:00
anchors.margins: Nheko.paddingMedium
spacing: Nheko.paddingMedium
2021-09-25 04:32:06 +03:00
Label {
id: promptLabel
2022-04-11 05:18:16 +03:00
color: timelineRoot.palette.text
2022-04-16 03:13:01 +03:00
text: qsTr("Room ID or alias")
2021-09-25 04:32:06 +03:00
}
MatrixTextField {
id: input
Layout.fillWidth: true
2022-04-16 03:13:01 +03:00
focus: true
2021-10-10 00:29:05 +03:00
onAccepted: {
if (input.text.match("#.+?:.{3,}"))
dbb.accepted();
}
2021-09-25 04:32:06 +03:00
}
}
}