2021-05-28 18:25:46 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2021-05-28 18:25:46 +03:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2022-04-16 03:13:01 +03:00
|
|
|
import "../"
|
2021-06-13 02:48:11 +03:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.5
|
2021-05-28 18:25:46 +03:00
|
|
|
import QtQuick.Layouts 1.3
|
2022-04-15 03:58:44 +03:00
|
|
|
import im.nheko
|
2021-05-28 18:25:46 +03:00
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
id: inputDialog
|
|
|
|
|
2021-09-18 01:21:14 +03:00
|
|
|
property alias echoMode: statusInput.echoMode
|
2021-05-28 18:25:46 +03:00
|
|
|
property var onAccepted: undefined
|
2022-04-16 03:13:01 +03:00
|
|
|
property alias prompt: promptLabel.text
|
|
|
|
|
|
|
|
function forceActiveFocus() {
|
|
|
|
statusInput.forceActiveFocus();
|
|
|
|
}
|
2021-05-28 18:25:46 +03:00
|
|
|
|
|
|
|
flags: Qt.Dialog
|
|
|
|
height: fontMetrics.lineSpacing * 7
|
2022-04-16 03:13:01 +03:00
|
|
|
modality: Qt.NonModal
|
|
|
|
width: 350
|
2021-05-28 18:25:46 +03:00
|
|
|
|
2022-04-16 03:13:01 +03:00
|
|
|
footer: DialogButtonBox {
|
|
|
|
id: dbb
|
|
|
|
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
|
|
|
|
|
|
|
|
onAccepted: {
|
|
|
|
if (inputDialog.onAccepted)
|
|
|
|
inputDialog.onAccepted(statusInput.text);
|
|
|
|
inputDialog.close();
|
|
|
|
}
|
|
|
|
onRejected: {
|
|
|
|
inputDialog.close();
|
|
|
|
}
|
2022-03-06 16:48:31 +03:00
|
|
|
}
|
|
|
|
|
2021-11-17 05:06:51 +03:00
|
|
|
Shortcut {
|
|
|
|
sequence: StandardKey.Cancel
|
2022-04-16 03:13:01 +03:00
|
|
|
|
2021-11-17 05:06:51 +03:00
|
|
|
onActivated: dbb.rejected()
|
|
|
|
}
|
2021-05-28 18:25:46 +03:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
2022-04-16 03:13:01 +03:00
|
|
|
anchors.margins: Nheko.paddingMedium
|
|
|
|
spacing: Nheko.paddingMedium
|
2021-05-28 18:25:46 +03:00
|
|
|
|
|
|
|
Label {
|
|
|
|
id: promptLabel
|
2022-04-11 05:18:16 +03:00
|
|
|
color: timelineRoot.palette.text
|
2021-05-28 18:25:46 +03:00
|
|
|
}
|
|
|
|
MatrixTextField {
|
|
|
|
id: statusInput
|
|
|
|
Layout.fillWidth: true
|
2021-11-17 05:06:51 +03:00
|
|
|
focus: true
|
2021-05-28 18:25:46 +03:00
|
|
|
|
2022-04-16 03:13:01 +03:00
|
|
|
onAccepted: dbb.accepted()
|
2021-05-28 18:25:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|