Created
December 23, 2013 09:56
-
-
Save seiichiro0185/8094341 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.0 | |
import Sailfish.Silica 1.0 | |
import org.nemomobile.configuration 1.0 | |
import org.sailfishos.browser.settings 1.0 | |
Page { | |
function name2index(name) { | |
switch (name) { | |
case "Google": return 0 | |
case "Bing": return 1 | |
case "Yahoo": return 2 | |
case "DuckDuckGo": return 3 | |
default: return 0 | |
} | |
} | |
RemorsePopup { | |
id: clearDataRemorse | |
} | |
SilicaFlickable { | |
id: flickable | |
anchors.fill: parent | |
contentHeight: contentColumn.height | |
Column { | |
id: contentColumn | |
width: parent.width | |
spacing: Theme.paddingMedium | |
PageHeader { | |
//% "Browser" | |
title: qsTrId("settings_browser-ph-browser") | |
} | |
Button { | |
anchors.horizontalCenter: parent.horizontalCenter | |
//% "Clear private data" | |
text: qsTrId("settings_browser-bt-clear_private_data") | |
onClicked: { | |
//: Remorse item for clearing private date | |
//% "Clearing" | |
clearDataRemorse.execute(qsTrId("settings_browser-la-clearing_private_data"), function() { clearPrivateDataConfig.value = true}); | |
} | |
} | |
ComboBox { | |
id: searchEngine | |
width: parent.width | |
//: Label for combobox that sets search engine used in browser | |
//% "Search engine" | |
label: qsTrId("settings_browser-la-search_engine") | |
currentIndex: name2index(searchEngineConfig.value) | |
menu: ContextMenu { | |
MenuItem { | |
text: "Google" | |
} | |
MenuItem { | |
text: "Bing" | |
} | |
MenuItem { | |
text: "Yahoo" | |
} | |
MenuItem { | |
text: "DuckDuckGo" | |
} | |
} | |
onCurrentItemChanged: { | |
if (currentItem.text !== searchEngineConfig.value) { | |
searchEngineConfig.value = currentItem.text | |
} | |
} | |
} | |
} | |
} | |
// TODO: enable it when browser daemon is implemented | |
/* | |
BrowserSettings { | |
id: settings | |
} | |
*/ | |
ConfigurationValue { | |
id: clearPrivateDataConfig | |
key: "/apps/sailfish-browser/actions/clear_private_data" | |
defaultValue: false | |
} | |
ConfigurationValue { | |
id: searchEngineConfig | |
key: "/apps/sailfish-browser/settings/search_engine" | |
defaultValue: "Google" | |
onValueChanged: { | |
if (searchEngine.currentItem.text !== value) { | |
searchEngine.currentIndex = name2index(value) | |
} | |
} | |
} | |
} |
Would be nice to post this as a patch for PatchManager into OpenRepos together with the XML.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those not wanting to overwrite the file, here's the diff (I've set DDG as default in this though):