feat: implement using the wanted search engine in the browser

This commit is contained in:
Jonathan Rainville 2021-01-04 16:13:41 -05:00 committed by Iuri Matias
parent 1c83ac98a0
commit ac4404c565
1 changed files with 10 additions and 0 deletions

View File

@ -106,6 +106,16 @@ Rectangle {
Keys.onPressed: {
// TODO: disable browsing local files? file://
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return){
if (appSettings.browserSearchEngine !== Constants.browserSearchEngineNone && !Utils.isURL(text)) {
switch (appSettings.browserSearchEngine) {
case Constants.browserSearchEngineGoogle: currentWebView.url = "https://www.google.com/search?q=" + text; break;
case Constants.browserSearchEngineYahoo: currentWebView.url = "https://search.yahoo.com/search?p=" + text; break;
case Constants.browserSearchEngineDuckDuckGo: currentWebView.url = "https://duckduckgo.com/?q=" + text; break;
}
return
}
currentWebView.url = determineRealURL(text);
}
}