From ffd1b06a8237d5da18729826a3167b842eb8cbf8 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Sun, 10 Sep 2023 17:28:43 +0300 Subject: [PATCH] RoomSettings: Port disabled text fields to readOnly Improves visuals, and allows to select & copy text. Also hides Save button when there's no chance it would get enabled. Depends on very recently merged MR in kirigami-addons: https://invent.kde.org/libraries/kirigami-addons/-/merge_requests/153 --- src/qml/RoomSettings/General.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qml/RoomSettings/General.qml b/src/qml/RoomSettings/General.qml index b2a847b61..e90c0d304 100644 --- a/src/qml/RoomSettings/General.qml +++ b/src/qml/RoomSettings/General.qml @@ -70,11 +70,10 @@ FormCard.FormCardPage { id: roomNameField label: i18n("Room name:") text: room.name - enabled: room.canSendState("m.room.name") + readOnly: !room.canSendState("m.room.name") } FormCard.AbstractFormDelegate { id: roomTopicField - enabled: room.canSendState("m.room.topic") background: Item {} contentItem: ColumnLayout { QQC2.Label { @@ -83,14 +82,17 @@ FormCard.FormCardPage { Layout.fillWidth: true } QQC2.TextArea { + id: roomTopicTextArea Accessible.description: roomTopicLabel.text Layout.fillWidth: true text: room.topic + readOnly: !room.canSendState("m.room.topic") onTextChanged: roomTopicField.text = text } } } FormCard.AbstractFormDelegate { + visible: !roomNameField.readOnly || !roomTopicTextArea.readOnly background: Item {} contentItem: RowLayout { Item {