From 21bd5fa94e92081ff3eaf7d651075db5caf189b9 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Sun, 15 Aug 2021 01:00:34 +0200 Subject: [PATCH] Handle immutable settings --- imports/NeoChat/Settings/AppearanceSettingsPage.qml | 9 ++++++++- imports/NeoChat/Settings/GeneralSettingsPage.qml | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/imports/NeoChat/Settings/AppearanceSettingsPage.qml b/imports/NeoChat/Settings/AppearanceSettingsPage.qml index 396d3bf86..73454e7ae 100644 --- a/imports/NeoChat/Settings/AppearanceSettingsPage.qml +++ b/imports/NeoChat/Settings/AppearanceSettingsPage.qml @@ -98,6 +98,7 @@ Kirigami.ScrollablePage { text: i18n("Bubbles") checked: !Config.compactLayout QQC2.ButtonGroup.group: themeGroup + enabled: !Config.isCompactLayoutImmutable onToggled: { Config.compactLayout = !checked; @@ -164,6 +165,7 @@ Kirigami.ScrollablePage { text: i18n("Compact") checked: Config.compactLayout QQC2.ButtonGroup.group: themeGroup + enabled: !Config.isCompactLayoutImmutable onToggled: { Config.compactLayout = checked; @@ -180,10 +182,12 @@ Kirigami.ScrollablePage { Config.showAvatarInTimeline = checked Config.save() } + enabled: !Config.isShowAvatarInTimelineImmutable } QQC2.CheckBox { text: i18n("In Sidebar") checked: Config.showAvatarInRoomDrawer + enabled: !Config.isShowAvatarInRoomDrawerImmutable onToggled: { Config.showAvatarInRoomDrawer = checked Config.save() @@ -192,6 +196,7 @@ Kirigami.ScrollablePage { QQC2.CheckBox { text: i18n("Show Fancy Effects") checked: Config.showFancyEffects + enabled: !Config.isShowFancyEffectsImmutable onToggled: { Config.showFancyEffects = checked; Config.save(); @@ -205,7 +210,7 @@ Kirigami.ScrollablePage { QQC2.CheckBox { visible: Controller.hasWindowSystem text: i18n("Use transparent chat page") - enabled: !Config.compactLayout + enabled: !Config.compactLayout && !Config.isBlurImmutable checked: Config.blur onToggled: { Config.blur = checked; @@ -214,6 +219,7 @@ Kirigami.ScrollablePage { } RowLayout { visible: Controller.hasWindowSystem && Config.blur + enabled: !Config.isTransparancyImmutable Kirigami.FormData.label: i18n("Transparency:") QQC2.Slider { enabled: !Config.compactLayout && Config.blur @@ -237,6 +243,7 @@ Kirigami.ScrollablePage { QQC2.CheckBox { text: i18n("Show your messages on the right") checked: Config.showLocalMessagesOnRight + enabled: !Config.isShowLocalMessagesOnRightImmutable onToggled: { Config.showLocalMessagesOnRight = checked Config.save() diff --git a/imports/NeoChat/Settings/GeneralSettingsPage.qml b/imports/NeoChat/Settings/GeneralSettingsPage.qml index 1ba8c280d..7a1366b92 100644 --- a/imports/NeoChat/Settings/GeneralSettingsPage.qml +++ b/imports/NeoChat/Settings/GeneralSettingsPage.qml @@ -18,6 +18,7 @@ Kirigami.ScrollablePage { text: i18n("Close to system tray") checked: Config.systemTray visible: Controller.supportSystemTray + enabled: !Config.isSystemTrayImmutable onToggled: { Config.systemTray = checked Config.save() @@ -29,6 +30,7 @@ Kirigami.ScrollablePage { Kirigami.FormData.label: i18n("Notifications and events:") text: i18n("Show notifications") checked: Config.showNotifications + enabled: !Config.isShowNotificationsImmutable onToggled: { Config.showNotifications = checked Config.save() @@ -37,6 +39,7 @@ Kirigami.ScrollablePage { QQC2.CheckBox { text: i18n("Show leave and join events") checked: Config.showLeaveJoinEvent + enabled: !Config.isShowLeaveJoinEventImmutable onToggled: { Config.showLeaveJoinEvent = checked Config.save() @@ -46,6 +49,7 @@ Kirigami.ScrollablePage { Kirigami.FormData.label: i18n("Rooms and private chats:") text: i18n("Separated") checked: !Config.mergeRoomList + enabled: !Config.isMergeRoomListImmutable onToggled: { Config.mergeRoomList = false Config.save() @@ -54,6 +58,7 @@ Kirigami.ScrollablePage { QQC2.RadioButton { text: i18n("Intermixed") checked: Config.mergeRoomList + enabled: !Config.isMergeRoomListImmutable onToggled: { Config.mergeRoomList = true Config.save() @@ -62,6 +67,7 @@ Kirigami.ScrollablePage { QQC2.CheckBox { text: i18n("Use s/text/replacement syntax to edit your last message") checked: Config.allowQuickEdit + enabled: !Config.isAllowQuickEditImmutable onToggled: { Config.allowQuickEdit = checked Config.save()