From f64608f87c6c26dca93829b475b3d4ddf82779ce Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Sun, 16 Oct 2022 14:21:54 +0200 Subject: [PATCH] Add config option to make link previews configurable This patch adds new config option "ShowLinkPreview" which can control if links' preview in the chat messages should be loaded and shown or not. --- imports/NeoChat/Component/Timeline/MessageDelegate.qml | 2 +- imports/NeoChat/Settings/AppearanceSettingsPage.qml | 8 ++++++++ src/neochatconfig.kcfg | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/imports/NeoChat/Component/Timeline/MessageDelegate.qml b/imports/NeoChat/Component/Timeline/MessageDelegate.qml index 1d8b58630..555eb9a99 100644 --- a/imports/NeoChat/Component/Timeline/MessageDelegate.qml +++ b/imports/NeoChat/Component/Timeline/MessageDelegate.qml @@ -31,7 +31,7 @@ TimelineContainer { Layout.fillWidth: true height: active ? item.implicitHeight : 0 active: !currentRoom.usesEncryption && model.display && model.display.includes("http") - visible: active + visible: Config.showLinkPreview && active sourceComponent: LinkPreviewDelegate { anchors.verticalCenter: parent.verticalCenter } diff --git a/imports/NeoChat/Settings/AppearanceSettingsPage.qml b/imports/NeoChat/Settings/AppearanceSettingsPage.qml index b689eaa3f..ef9a62abf 100644 --- a/imports/NeoChat/Settings/AppearanceSettingsPage.qml +++ b/imports/NeoChat/Settings/AppearanceSettingsPage.qml @@ -252,6 +252,14 @@ Kirigami.ScrollablePage { Config.save() } } + QQC2.CheckBox { + text: i18n("Show links preview in the chat messages") + checked: Config.showLinkPreview + onToggled: { + Config.showLinkPreview = checked + Config.save() + } + } } } } diff --git a/src/neochatconfig.kcfg b/src/neochatconfig.kcfg index 2a72dc85e..4c7e923eb 100644 --- a/src/neochatconfig.kcfg +++ b/src/neochatconfig.kcfg @@ -76,6 +76,9 @@ true + + + true