From 02d50868bcb0d96bcb6b309fddd261bf611e0785 Mon Sep 17 00:00:00 2001
From: Pavel Tumakaev
Date: Mon, 21 Feb 2022 16:35:31 +0300
Subject: [PATCH] [sailfish-browser] Add an option to PrivacySettingsPage to
clear user agent overrides. Contributes to JB#31240
---
apps/browser/qml/pages/PrivacySettingsPage.qml | 10 ++++++++++
.../pages/components/PrivacySettingsConfirmDialog.qml | 11 +++++++++++
2 files changed, 21 insertions(+)
diff --git a/apps/browser/qml/pages/PrivacySettingsPage.qml b/apps/browser/qml/pages/PrivacySettingsPage.qml
index dabaafb59c0e..595b181870ca 100644
--- a/apps/browser/qml/pages/PrivacySettingsPage.qml
+++ b/apps/browser/qml/pages/PrivacySettingsPage.qml
@@ -123,6 +123,14 @@ Page {
checked: true
}
+ TextSwitch {
+ id: clearUserAgentOverrides
+
+ //% "User аgent overrides"
+ text: qsTrId("settings_browser-la-user_аgent_overrides")
+ checked: true
+ }
+
// Spacer between Button and switches
Item {
width: parent.width
@@ -140,6 +148,7 @@ Page {
|| clearCache.checked
|| clearBookmarks.checked
|| clearSitePermissions.checked
+ || clearUserAgentOverrides.checked
onClicked: {
var page = pageStack.push(Qt.resolvedUrl("components/PrivacySettingsConfirmDialog.qml"), {
@@ -149,6 +158,7 @@ Page {
cacheEnabled: clearCache.checked,
bookmarksEnabled: clearBookmarks.checked,
sitePermissionsEnabled: clearSitePermissions.checked,
+ userAgentOverridesEnabled: clearUserAgentOverrides.checked,
historyPeriod: historyErasingComboBox.currentItem.period,
acceptDestination: previousPage
})
diff --git a/apps/browser/qml/pages/components/PrivacySettingsConfirmDialog.qml b/apps/browser/qml/pages/components/PrivacySettingsConfirmDialog.qml
index 2cfe431cfd0c..00f6cf0ef1a5 100644
--- a/apps/browser/qml/pages/components/PrivacySettingsConfirmDialog.qml
+++ b/apps/browser/qml/pages/components/PrivacySettingsConfirmDialog.qml
@@ -20,6 +20,7 @@ Dialog {
property alias cacheEnabled: cacheItem.visible
property alias bookmarksEnabled: bookmarksItem.visible
property alias sitePermissionsEnabled: sitePermissionsItem.visible
+ property alias userAgentOverridesEnabled: userAgentOverridesItem.visible
property int historyPeriod
@@ -118,6 +119,13 @@ Dialog {
//% "Site permissions"
text: qsTrId("sailfish_browser-la-site_permissions");
}
+
+ BrowserDataItem {
+ id: userAgentOverridesItem
+
+ //% "User agent overrides"
+ text: qsTrId("sailfish_browser-la-user_agent_overrides");
+ }
}
}
@@ -140,6 +148,9 @@ Dialog {
if (sitePermissionsEnabled) {
Settings.clearSitePermissions()
}
+ if (userAgentOverridesEnabled) {
+ UserAgentManager.clearUserAgentOverrides()
+ }
}
Component.onCompleted: {