2020-06-15 12:51:04 +00:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
|
|
|
import "./"
|
|
|
|
|
|
|
|
Popup {
|
2020-06-15 16:24:21 +00:00
|
|
|
function doRename(){
|
|
|
|
chatsModel.renameGroup(groupName.text)
|
|
|
|
popup.close();
|
|
|
|
}
|
|
|
|
|
2020-06-15 12:51:04 +00:00
|
|
|
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: Theme.white
|
|
|
|
radius: 8
|
|
|
|
}
|
|
|
|
padding: 0
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
Text {
|
|
|
|
id: groupTitleLabel
|
|
|
|
text: qsTr("Group name")
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
font.pixelSize: 13
|
|
|
|
anchors.leftMargin: 16
|
|
|
|
anchors.topMargin: Theme.padding
|
|
|
|
anchors.bottomMargin: Theme.padding
|
|
|
|
}
|
|
|
|
|
2020-06-15 16:24:21 +00:00
|
|
|
Input {
|
|
|
|
id: groupName
|
2020-06-15 12:51:04 +00:00
|
|
|
anchors.top: groupTitleLabel.bottom
|
2020-06-15 16:24:21 +00:00
|
|
|
anchors.topMargin: 7
|
2020-06-15 12:51:04 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Theme.padding
|
2020-06-15 16:24:21 +00:00
|
|
|
anchors.right: parent.right
|
2020-06-15 12:51:04 +00:00
|
|
|
anchors.rightMargin: Theme.padding
|
2020-06-15 16:24:21 +00:00
|
|
|
placeholderText: qsTr("Group Name")
|
|
|
|
Keys.onEnterPressed: doRename()
|
|
|
|
Keys.onReturnPressed: doRename()
|
2020-06-15 12:51:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledButton {
|
|
|
|
id: saveBtn
|
2020-06-15 16:24:21 +00:00
|
|
|
anchors.top: groupName.bottom
|
2020-06-15 12:51:04 +00:00
|
|
|
anchors.topMargin: 22
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Theme.padding
|
|
|
|
label: qsTr("Save")
|
2020-06-15 16:24:21 +00:00
|
|
|
onClicked : doRename()
|
2020-06-15 12:51:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|