[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [falkon] src/lib: Add an option to disable search suggestions from the address bar.
From:       David Rosca <null () kde ! org>
Date:       2017-12-31 15:45:08
Message-ID: E1eVfnQ-0000XC-N0 () code ! kde ! org
[Download RAW message or body]

Git commit 635cb1085cbad75db08a0d6108849141a9bcabe6 by David Rosca, on behalf of \
Laurent Cimon. Committed on 31/12/2017 at 15:44.
Pushed by drosca into branch 'master'.

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

Differential Revision: https://phabricator.kde.org/D9539

M  +1    -1    src/lib/navigation/completer/locationcompleter.cpp
M  +3    -3    src/lib/navigation/websearchbar.cpp
M  +2    -1    src/lib/other/qzsettings.cpp
M  +2    -1    src/lib/other/qzsettings.h
M  +4    -0    src/lib/preferences/preferences.cpp
M  +7    -0    src/lib/preferences/preferences.ui

https://commits.kde.org/falkon/635cb1085cbad75db08a0d6108849141a9bcabe6

diff --git a/src/lib/navigation/completer/locationcompleter.cpp \
b/src/lib/navigation/completer/locationcompleter.cpp index 89ae61f3..03462670 100644
--- a/src/lib/navigation/completer/locationcompleter.cpp
+++ b/src/lib/navigation/completer/locationcompleter.cpp
@@ -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());
diff --git a/src/lib/navigation/websearchbar.cpp \
b/src/lib/navigation/websearchbar.cpp index 0166b10a..55b9c1aa 100644
--- a/src/lib/navigation/websearchbar.cpp
+++ b/src/lib/navigation/websearchbar.cpp
@@ -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"));
diff --git a/src/lib/other/qzsettings.cpp b/src/lib/other/qzsettings.cpp
index f43f8f4a..e900e85a 100644
--- a/src/lib/other/qzsettings.cpp
+++ b/src/lib/other/qzsettings.cpp
@@ -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");
diff --git a/src/lib/other/qzsettings.h b/src/lib/other/qzsettings.h
index cce79b8b..b5bcaec2 100644
--- a/src/lib/other/qzsettings.h
+++ b/src/lib/other/qzsettings.h
@@ -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;
diff --git a/src/lib/preferences/preferences.cpp \
b/src/lib/preferences/preferences.cpp index 405e84ba..5328ae49 100644
--- a/src/lib/preferences/preferences.cpp
+++ b/src/lib/preferences/preferences.cpp
@@ -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
diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui
index 1e6d7f2d..e0d429c8 100644
--- a/src/lib/preferences/preferences.ui
+++ b/src/lib/preferences/preferences.ui
@@ -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">


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic