1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Add an option to disable search suggestions from the address bar.

Differential Revision: https://phabricator.kde.org/D9539
This commit is contained in:
Laurent Cimon 2017-12-31 16:43:27 +01:00 committed by David Rosca
parent 925e3496d9
commit 635cb1085c
6 changed files with 19 additions and 6 deletions

View File

@ -80,7 +80,7 @@ void LocationCompleter::complete(const QString &string)
connect(job, SIGNAL(finished()), this, SLOT(refreshJobFinished()));
connect(this, SIGNAL(cancelRefreshJob()), job, SLOT(jobCancelled()));
if (qzSettings->searchFromAddressBar && trimmedStr.length() > 2) {
if (qzSettings->searchFromAddressBar && qzSettings->showABSearchSuggestions && trimmedStr.length() > 2) {
if (!m_openSearchEngine) {
m_openSearchEngine = new OpenSearchEngine(this);
m_openSearchEngine->setNetworkAccessManager(mApp->networkManager());

View File

@ -132,7 +132,7 @@ void WebSearchBar::aboutToShowMenu()
void WebSearchBar::addSuggestions(const QStringList &list)
{
if (qzSettings->showSearchSuggestions) {
if (qzSettings->showWSBSearchSuggestions) {
QStringList list_ = list.mid(0, 6);
m_completerModel->setStringList(list_);
m_completer->complete();
@ -156,7 +156,7 @@ void WebSearchBar::enableSearchSuggestions(bool enable)
settings.setValue("showSuggestions", enable);
settings.endGroup();
qzSettings->showSearchSuggestions = enable;
qzSettings->showWSBSearchSuggestions = enable;
m_completerModel->setStringList(QStringList());
}
@ -257,7 +257,7 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
menu->addSeparator();
QAction* act = menu->addAction(tr("Show suggestions"));
act->setCheckable(true);
act->setChecked(qzSettings->showSearchSuggestions);
act->setChecked(qzSettings->showWSBSearchSuggestions);
connect(act, SIGNAL(triggered(bool)), this, SLOT(enableSearchSuggestions(bool)));
QAction* instantSearch = menu->addAction(tr("Search when engine changed"));

View File

@ -38,10 +38,11 @@ void QzSettings::loadSettings()
settings.endGroup();
settings.beginGroup("SearchEngines");
showSearchSuggestions = settings.value("showSuggestions", true).toBool();
searchOnEngineChange = settings.value("SearchOnEngineChange", true).toBool();
searchFromAddressBar = settings.value("SearchFromAddressBar", true).toBool();
searchWithDefaultEngine = settings.value("SearchWithDefaultEngine", false).toBool();
showABSearchSuggestions = settings.value("showSearchSuggestions", true).toBool();
showWSBSearchSuggestions = settings.value("showSuggestions", true).toBool();
settings.endGroup();
settings.beginGroup("Web-Browser-Settings");

View File

@ -41,10 +41,11 @@ public:
bool useInlineCompletion;
// SearchEngines
bool showSearchSuggestions;
bool searchOnEngineChange;
bool searchFromAddressBar;
bool searchWithDefaultEngine;
bool showABSearchSuggestions;
bool showWSBSearchSuggestions;
// Web-Browser-Settings
int defaultZoomLevel;

View File

@ -265,6 +265,8 @@ Preferences::Preferences(BrowserWindow* window)
ui->searchFromAddressBar->setChecked(searchFromAB);
ui->searchWithDefaultEngine->setEnabled(searchFromAB);
ui->searchWithDefaultEngine->setChecked(settings.value("SearchWithDefaultEngine", false).toBool());
ui->showABSearchSuggestions->setEnabled(searchFromAB);
ui->showABSearchSuggestions->setChecked(settings.value("showSearchSuggestions", true).toBool());
connect(ui->searchFromAddressBar, SIGNAL(toggled(bool)), this, SLOT(searchFromAddressBarChanged(bool)));
settings.endGroup();
@ -701,6 +703,7 @@ void Preferences::setManualProxyConfigurationEnabled(bool state)
void Preferences::searchFromAddressBarChanged(bool stat)
{
ui->searchWithDefaultEngine->setEnabled(stat);
ui->showABSearchSuggestions->setEnabled(stat);
}
void Preferences::saveHistoryChanged(bool stat)
@ -1039,6 +1042,7 @@ void Preferences::saveSettings()
settings.beginGroup("SearchEngines");
settings.setValue("SearchFromAddressBar", ui->searchFromAddressBar->isChecked());
settings.setValue("SearchWithDefaultEngine", ui->searchWithDefaultEngine->isChecked());
settings.setValue("showSearchSuggestions", ui->showABSearchSuggestions->isChecked());
settings.endGroup();
//Languages

View File

@ -928,6 +928,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showABSearchSuggestions">
<property name="text">
<string>Show search suggestions</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_16">
<property name="orientation">