Skip to content

Commit

Permalink
[sailfish-browser] Add an option to PrivacySettingsPage to clear user…
Browse files Browse the repository at this point in the history
… agent overrides. Contributes to JB#31240
  • Loading branch information
paveltkv committed Mar 16, 2022
1 parent 44261b4 commit 1e9b5ed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/browser/qml/pages/PrivacySettingsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -140,6 +148,7 @@ Page {
|| clearCache.checked
|| clearBookmarks.checked
|| clearSitePermissions.checked
|| clearUserAgentOverrides.checked

onClicked: {
var page = pageStack.push(Qt.resolvedUrl("components/PrivacySettingsConfirmDialog.qml"), {
Expand All @@ -149,6 +158,7 @@ Page {
cacheEnabled: clearCache.checked,
bookmarksEnabled: clearBookmarks.checked,
sitePermissionsEnabled: clearSitePermissions.checked,
userAgentOverridesEnabled: clearUserAgentOverrides.checked,
historyPeriod: historyErasingComboBox.currentItem.period,
acceptDestination: previousPage
})
Expand Down
11 changes: 11 additions & 0 deletions apps/browser/qml/pages/components/PrivacySettingsConfirmDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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");
}
}
}

Expand All @@ -140,6 +148,9 @@ Dialog {
if (sitePermissionsEnabled) {
Settings.clearSitePermissions()
}
if (userAgentOverridesEnabled) {
UserAgentManager.clearUserAgentOverrides()
}
}

Component.onCompleted: {
Expand Down

0 comments on commit 1e9b5ed

Please sign in to comment.