status-desktop/ui/app/AppLayouts/Chat/components/RenameGroupPopup.qml

77 lines
2.0 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../../../../imports"
import "../../../../shared"
import "./"
Popup {
function doRename(){
chatsModel.renameGroup(groupName.text)
popup.close();
}
id: popup
modal: true
Overlay.modal: Rectangle {
color: "#60000000"
}
onOpened: {
groupName.forceActiveFocus(Qt.MouseFocusReason)
groupName.text = chatsModel.activeChannel.name
}
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 480
height: 159
background: Rectangle {
color: Style.current.white
radius: 8
}
padding: 0
contentItem: Item {
StyledText {
id: groupTitleLabel
//% "Group name"
text: qsTrId("group-name")
anchors.top: parent.top
anchors.left: parent.left
font.pixelSize: 13
anchors.leftMargin: 16
anchors.topMargin: Style.current.padding
anchors.bottomMargin: Style.current.padding
}
Input {
id: groupName
anchors.top: groupTitleLabel.bottom
anchors.topMargin: 7
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
//% "Group name"
placeholderText: qsTrId("group-name")
Keys.onEnterPressed: doRename()
Keys.onReturnPressed: doRename()
}
StyledButton {
id: saveBtn
anchors.top: groupName.bottom
anchors.topMargin: 22
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
//% "Save"
label: qsTrId("save")
onClicked : doRename()
}
}
}