refactor(RenameGroupPopup): use StatusQ components

This commit is contained in:
Pascal Precht 2021-10-20 10:34:05 +02:00 committed by Iuri Matias
parent ce792a1300
commit a87568e7c2
1 changed files with 32 additions and 26 deletions

View File

@ -3,14 +3,13 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13 import QtQuick.Layouts 1.13
import utils 1.0 import utils 1.0
import "../../../../shared"
import "../../../../shared/controls"
import "../../../../shared/popups"
import "../../../../shared/status"
import "./"
// TODO: replace with StatusModal import StatusQ.Controls 0.1
ModalPopup { import StatusQ.Popups 0.1
import "../../../../shared/controls"
StatusModal {
function doRename(){ function doRename(){
chatsModel.groups.rename(groupName.text) chatsModel.groups.rename(groupName.text)
popup.close(); popup.close();
@ -18,33 +17,40 @@ ModalPopup {
id: popup id: popup
height: 210 height: 210
anchors.centerIn: parent
//% "Group name" //% "Group name"
title: qsTrId("group-name") header.title: qsTrId("group-name")
onOpened: { onOpened: {
groupName.forceActiveFocus(Qt.MouseFocusReason) groupName.forceActiveFocus(Qt.MouseFocusReason)
groupName.text = chatsModel.channelView.activeChannel.name groupName.text = chatsModel.channelView.activeChannel.name
} }
Input { contentItem: Item {
id: groupName width: popup.width
anchors.left: parent.left implicitHeight: childrenRect.height
anchors.leftMargin: Style.current.padding Input {
anchors.right: parent.right id: groupName
anchors.rightMargin: Style.current.padding anchors.left: parent.left
//% "Group name" anchors.leftMargin: Style.current.padding
placeholderText: qsTrId("group-name") anchors.right: parent.right
Keys.onEnterPressed: doRename() anchors.rightMargin: Style.current.padding
Keys.onReturnPressed: doRename() anchors.top: parent.top
anchors.topMargin: Style.current.padding
//% "Group name"
placeholderText: qsTrId("group-name")
Keys.onEnterPressed: doRename()
Keys.onReturnPressed: doRename()
}
} }
footer: StatusButton { rightButtons: [
id: saveBtn StatusButton {
anchors.bottom: parent.bottom id: saveBtn
anchors.right: parent.right //% "Save"
//% "Save" text: qsTrId("save")
text: qsTrId("save") onClicked : doRename()
onClicked : doRename() }
} ]
} }