feat: add browserHomepage setting that can be changed

This commit is contained in:
Jonathan Rainville 2021-01-04 15:34:46 -05:00 committed by Iuri Matias
parent f1ea517dd6
commit 36b6e76a2e
5 changed files with 68 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
import "Privileges/"
import "BrowserModals"
Item {
id: root
@ -14,6 +15,8 @@ Item {
onClosed: destroy()
}
property Component homePagePopup: HomepageModal {}
Column {
id: generalColumn
spacing: Style.current.bigPadding
@ -30,10 +33,8 @@ Item {
StatusSettingsLineButton {
text: qsTr("Homepage")
currentValue: qsTr("Default")
onClicked: function () {
console.log('Change Homepage')
}
currentValue: appSettings.browserHomepage === "" ? qsTr("Default") : appSettings.browserHomepage
onClicked: homePagePopup.createObject(root).open()
}
StatusSettingsLineButton {

View File

@ -0,0 +1,56 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../../imports"
import "../../../../../shared"
import "../../../../../shared/status"
ModalPopup {
id: popup
title: qsTr("Homepage")
onClosed: {
destroy()
}
Column {
spacing: Style.current.bigPadding
width: parent.width
ButtonGroup {
id: homepageGroup
}
StatusRadioButton {
text: qsTr("Default")
ButtonGroup.group: homepageGroup
checked: appSettings.browserHomepage === ""
onCheckedChanged: {
if (checked) {
appSettings.browserHomepage = ""
customUrl.visible = false
}
}
}
StatusRadioButton {
text: qsTr("Custom...")
ButtonGroup.group: homepageGroup
checked: appSettings.browserHomepage !== "" || customUrl.visible
onClicked: {
customUrl.visible = true
}
}
Input {
id: customUrl
visible: appSettings.browserHomepage !== ""
placeholderText: qsTr("Paste URL")
pasteFromClipboard: true
textField.onTextChanged: {
appSettings.browserHomepage = customUrl.text
}
}
}
}

View File

@ -117,6 +117,7 @@ ApplicationWindow {
property bool showBrowserSelector: true
property bool openLinksInStatus: true
property bool showFavoritesBar: false
property string browserHomepage: ""
property bool autoLoadImages: true
property bool javaScriptEnabled: true
property bool errorPageEnabled: true
@ -158,6 +159,7 @@ ApplicationWindow {
property bool showBrowserSelector: defaultAppSettings.showBrowserSelector
property bool openLinksInStatus: defaultAppSettings.openLinksInStatus
property bool showFavoritesBar: defaultAppSettings.showFavoritesBar
property string browserHomepage: defaultAppSettings.browserHomepage
property bool autoLoadImages: defaultAppSettings.autoLoadImages
property bool javaScriptEnabled: defaultAppSettings.javaScriptEnabled
property bool errorPageEnabled: defaultAppSettings.errorPageEnabled

View File

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

View File

@ -24,8 +24,12 @@ Item {
id: valueText
visible: !!root.currentValue
text: root.currentValue
elide: Text.ElideRight
font.pixelSize: 15
horizontalAlignment: Text.AlignRight
color: Style.current.secondaryText
anchors.left: textItem.right
anchors.leftMargin: Style.current.padding
anchors.right: root.isSwitch ? switchItem.left : caret.left
anchors.rightMargin: Style.current.padding
anchors.verticalCenter: textItem.verticalCenter