feat: add search engine settings in the profile

This commit is contained in:
Jonathan Rainville 2021-01-04 16:06:38 -05:00 committed by Iuri Matias
parent 6c2836ded1
commit 1c83ac98a0
5 changed files with 89 additions and 4 deletions

View File

@ -14,8 +14,8 @@ Item {
property Component dappListPopup: DappList {
onClosed: destroy()
}
property Component homePagePopup: HomepageModal {}
property Component searchEngineModal: SearchEngineModal {}
Column {
id: generalColumn
@ -48,10 +48,16 @@ Item {
StatusSettingsLineButton {
text: qsTr("Search engine used in the address bar")
currentValue: qsTr("None")
onClicked: function () {
console.log('Change search engine')
currentValue: {
switch (appSettings.browserSearchEngine) {
case Constants.browserSearchEngineGoogle: return "Google"
case Constants.browserSearchEngineYahoo: return "Yahoo!"
case Constants.browserSearchEngineDuckDuckGo: return "DuckDuckGo"
case Constants.browserSearchEngineNone:
default: return qsTr("None")
}
}
onClicked: searchEngineModal.createObject(root).open()
}
Item {

View File

@ -0,0 +1,71 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../../imports"
import "../../../../../shared"
import "../../../../../shared/status"
ModalPopup {
id: popup
title: qsTr("Search engine")
onClosed: {
destroy()
}
Column {
spacing: Style.current.bigPadding
width: parent.width
ButtonGroup {
id: searchEnginGroup
}
StatusRadioButton {
text: qsTr("None")
ButtonGroup.group: searchEnginGroup
checked: appSettings.browserSearchEngine === Constants.browserSearchEngineNone
onCheckedChanged: {
if (checked) {
appSettings.browserSearchEngine = Constants.browserSearchEngineNone
}
}
}
StatusRadioButton {
text: "Google"
ButtonGroup.group: searchEnginGroup
checked: appSettings.browserSearchEngine === Constants.browserSearchEngineGoogle
onCheckedChanged: {
if (checked) {
appSettings.browserSearchEngine = Constants.browserSearchEngineGoogle
}
}
}
StatusRadioButton {
text: "Yahoo!"
ButtonGroup.group: searchEnginGroup
checked: appSettings.browserSearchEngine === Constants.browserSearchEngineYahoo
onCheckedChanged: {
if (checked) {
appSettings.browserSearchEngine = Constants.browserSearchEngineYahoo
}
}
}
StatusRadioButton {
text: "DuckDuckGo"
ButtonGroup.group: searchEnginGroup
checked: appSettings.browserSearchEngine === Constants.browserSearchEngineDuckDuckGo
onCheckedChanged: {
if (checked) {
appSettings.browserSearchEngine = Constants.browserSearchEngineDuckDuckGo
}
}
}
}
}

View File

@ -100,4 +100,9 @@ QtObject {
readonly property string eth_prod: "eth.prod"
readonly property string eth_staging: "eth.staging"
readonly property string eth_test: "eth.test"
readonly property int browserSearchEngineNone: 0
readonly property int browserSearchEngineGoogle: 1
readonly property int browserSearchEngineYahoo: 2
readonly property int browserSearchEngineDuckDuckGo: 3
}

View File

@ -118,6 +118,7 @@ ApplicationWindow {
property bool openLinksInStatus: true
property bool showFavoritesBar: false
property string browserHomepage: ""
property int browserSearchEngine: Constants.browserSearchEngineNone
property bool autoLoadImages: true
property bool javaScriptEnabled: true
property bool errorPageEnabled: true
@ -160,6 +161,7 @@ ApplicationWindow {
property bool openLinksInStatus: defaultAppSettings.openLinksInStatus
property bool showFavoritesBar: defaultAppSettings.showFavoritesBar
property string browserHomepage: defaultAppSettings.browserHomepage
property int browserSearchEngine: defaultAppSettings.browserSearchEngine
property bool autoLoadImages: defaultAppSettings.autoLoadImages
property bool javaScriptEnabled: defaultAppSettings.javaScriptEnabled
property bool errorPageEnabled: defaultAppSettings.errorPageEnabled

View File

@ -186,6 +186,7 @@ DISTFILES += \
app/AppLayouts/Profile/Sections/BackupSeedModal.qml \
app/AppLayouts/Profile/Sections/BrowserContainer.qml \
app/AppLayouts/Profile/Sections/BrowserModals/HomepageModal.qml \
app/AppLayouts/Profile/Sections/BrowserModals/SearchEngineModal.qml \
app/AppLayouts/Profile/Sections/ChangeProfilePicModal.qml \
app/AppLayouts/Profile/Sections/MyProfileContainer.qml \
app/AppLayouts/Profile/Sections/OpenLinksWithModal.qml \