Improve the general room information form card

We can remove a lot of duplicative labeling here: "Room Information",
"Room Name", "RoomTopic", etc. The "Save" button now looks like a proper
form card element, like it does in the account editor.
This commit is contained in:
Joshua Goins
2025-05-24 15:19:16 -04:00
parent a0e8039d92
commit e2427c0683

View File

@@ -58,14 +58,12 @@ FormCard.FormCardPage {
}
}
FormCard.FormHeader {
title: i18n("Room Information")
}
FormCard.FormCard {
Layout.topMargin: Kirigami.Units.gridUnit
FormCard.FormTextFieldDelegate {
id: roomNameField
label: i18n("Room name:")
label: i18nc("@label:textbox Room name", "Name:")
text: room.name
readOnly: !room.canSendState("m.room.name")
}
@@ -74,7 +72,7 @@ FormCard.FormCardPage {
FormCard.FormTextAreaDelegate {
id: roomTopicField
label: i18n("Room topic:")
label: i18nc("@label:textobx Room topic", "Topic:")
text: room.topic
readOnly: !room.canSendState("m.room.topic")
onTextChanged: roomTopicField.text = text
@@ -84,27 +82,16 @@ FormCard.FormCardPage {
visible: !roomNameField.readOnly || !roomTopicField.readOnly
}
FormCard.AbstractFormDelegate {
FormCard.FormButtonDelegate {
visible: !roomNameField.readOnly || !roomTopicField.readOnly
background: null
contentItem: RowLayout {
Item {
Layout.fillWidth: true
text: i18n("Save")
icon.name: "document-save-symbolic"
onClicked: {
if (room.name != roomNameField.text) {
room.setName(roomNameField.text);
}
QQC2.Button {
Layout.bottomMargin: Kirigami.Units.smallSpacing
Layout.topMargin: Kirigami.Units.smallSpacing
enabled: room.name !== roomNameField.text || room.topic !== roomTopicField.text
text: i18n("Save")
icon.name: "document-save-symbolic"
onClicked: {
if (room.name != roomNameField.text) {
room.setName(roomNameField.text);
}
if (room.topic != roomTopicField.text) {
room.setTopic(roomTopicField.text);
}
}
if (room.topic != roomTopicField.text) {
room.setTopic(roomTopicField.text);
}
}
}