Rework NeoChatConnection to remove the dependency on NeoChatConfig

Title
This commit is contained in:
James Graham
2025-04-05 07:53:26 +00:00
parent 73623ec41a
commit d9b8b1c8ef
5 changed files with 40 additions and 32 deletions

View File

@@ -267,7 +267,7 @@ FormCard.FormCardPage {
}
}
FormCard.FormCheckDelegate {
enabled: root.connection.globalUrlPreviewEnabled
enabled: NeoChatConfig.showLinkPreview
text: i18n("Enable URL previews")
// Most users won't see the above setting so tell them the default.
description: room.defaultUrlPreviewState ? i18n("URL previews are enabled by default in this room") : i18n("URL previews are disabled by default in this room")
@@ -284,10 +284,13 @@ FormCard.FormCardPage {
Layout.alignment: Qt.AlignHCenter
text: i18nc("As in the user has switched off showing previews of hyperlinks in timeline messages", "URL previews are currently disabled for your account")
type: Kirigami.MessageType.Information
visible: !root.connection.globalUrlPreviewEnabled
visible: !NeoChatConfig.showLinkPreview
actions: Kirigami.Action {
text: i18n("Enable")
onTriggered: root.connection.globalUrlPreviewEnabled = true
onTriggered: {
NeoChatConfig.showLinkPreview = true;
NeoChatConfig.save();
}
}
}
FormCard.FormHeader {