mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +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:
parent
925e3496d9
commit
635cb1085c
@ -80,7 +80,7 @@ void LocationCompleter::complete(const QString &string)
|
|||||||
connect(job, SIGNAL(finished()), this, SLOT(refreshJobFinished()));
|
connect(job, SIGNAL(finished()), this, SLOT(refreshJobFinished()));
|
||||||
connect(this, SIGNAL(cancelRefreshJob()), job, SLOT(jobCancelled()));
|
connect(this, SIGNAL(cancelRefreshJob()), job, SLOT(jobCancelled()));
|
||||||
|
|
||||||
if (qzSettings->searchFromAddressBar && trimmedStr.length() > 2) {
|
if (qzSettings->searchFromAddressBar && qzSettings->showABSearchSuggestions && trimmedStr.length() > 2) {
|
||||||
if (!m_openSearchEngine) {
|
if (!m_openSearchEngine) {
|
||||||
m_openSearchEngine = new OpenSearchEngine(this);
|
m_openSearchEngine = new OpenSearchEngine(this);
|
||||||
m_openSearchEngine->setNetworkAccessManager(mApp->networkManager());
|
m_openSearchEngine->setNetworkAccessManager(mApp->networkManager());
|
||||||
|
@ -132,7 +132,7 @@ void WebSearchBar::aboutToShowMenu()
|
|||||||
|
|
||||||
void WebSearchBar::addSuggestions(const QStringList &list)
|
void WebSearchBar::addSuggestions(const QStringList &list)
|
||||||
{
|
{
|
||||||
if (qzSettings->showSearchSuggestions) {
|
if (qzSettings->showWSBSearchSuggestions) {
|
||||||
QStringList list_ = list.mid(0, 6);
|
QStringList list_ = list.mid(0, 6);
|
||||||
m_completerModel->setStringList(list_);
|
m_completerModel->setStringList(list_);
|
||||||
m_completer->complete();
|
m_completer->complete();
|
||||||
@ -156,7 +156,7 @@ void WebSearchBar::enableSearchSuggestions(bool enable)
|
|||||||
settings.setValue("showSuggestions", enable);
|
settings.setValue("showSuggestions", enable);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
qzSettings->showSearchSuggestions = enable;
|
qzSettings->showWSBSearchSuggestions = enable;
|
||||||
m_completerModel->setStringList(QStringList());
|
m_completerModel->setStringList(QStringList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
QAction* act = menu->addAction(tr("Show suggestions"));
|
QAction* act = menu->addAction(tr("Show suggestions"));
|
||||||
act->setCheckable(true);
|
act->setCheckable(true);
|
||||||
act->setChecked(qzSettings->showSearchSuggestions);
|
act->setChecked(qzSettings->showWSBSearchSuggestions);
|
||||||
connect(act, SIGNAL(triggered(bool)), this, SLOT(enableSearchSuggestions(bool)));
|
connect(act, SIGNAL(triggered(bool)), this, SLOT(enableSearchSuggestions(bool)));
|
||||||
|
|
||||||
QAction* instantSearch = menu->addAction(tr("Search when engine changed"));
|
QAction* instantSearch = menu->addAction(tr("Search when engine changed"));
|
||||||
|
@ -38,10 +38,11 @@ void QzSettings::loadSettings()
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("SearchEngines");
|
settings.beginGroup("SearchEngines");
|
||||||
showSearchSuggestions = settings.value("showSuggestions", true).toBool();
|
|
||||||
searchOnEngineChange = settings.value("SearchOnEngineChange", true).toBool();
|
searchOnEngineChange = settings.value("SearchOnEngineChange", true).toBool();
|
||||||
searchFromAddressBar = settings.value("SearchFromAddressBar", true).toBool();
|
searchFromAddressBar = settings.value("SearchFromAddressBar", true).toBool();
|
||||||
searchWithDefaultEngine = settings.value("SearchWithDefaultEngine", false).toBool();
|
searchWithDefaultEngine = settings.value("SearchWithDefaultEngine", false).toBool();
|
||||||
|
showABSearchSuggestions = settings.value("showSearchSuggestions", true).toBool();
|
||||||
|
showWSBSearchSuggestions = settings.value("showSuggestions", true).toBool();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("Web-Browser-Settings");
|
settings.beginGroup("Web-Browser-Settings");
|
||||||
|
@ -41,10 +41,11 @@ public:
|
|||||||
bool useInlineCompletion;
|
bool useInlineCompletion;
|
||||||
|
|
||||||
// SearchEngines
|
// SearchEngines
|
||||||
bool showSearchSuggestions;
|
|
||||||
bool searchOnEngineChange;
|
bool searchOnEngineChange;
|
||||||
bool searchFromAddressBar;
|
bool searchFromAddressBar;
|
||||||
bool searchWithDefaultEngine;
|
bool searchWithDefaultEngine;
|
||||||
|
bool showABSearchSuggestions;
|
||||||
|
bool showWSBSearchSuggestions;
|
||||||
|
|
||||||
// Web-Browser-Settings
|
// Web-Browser-Settings
|
||||||
int defaultZoomLevel;
|
int defaultZoomLevel;
|
||||||
|
@ -265,6 +265,8 @@ Preferences::Preferences(BrowserWindow* window)
|
|||||||
ui->searchFromAddressBar->setChecked(searchFromAB);
|
ui->searchFromAddressBar->setChecked(searchFromAB);
|
||||||
ui->searchWithDefaultEngine->setEnabled(searchFromAB);
|
ui->searchWithDefaultEngine->setEnabled(searchFromAB);
|
||||||
ui->searchWithDefaultEngine->setChecked(settings.value("SearchWithDefaultEngine", false).toBool());
|
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)));
|
connect(ui->searchFromAddressBar, SIGNAL(toggled(bool)), this, SLOT(searchFromAddressBarChanged(bool)));
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
@ -701,6 +703,7 @@ void Preferences::setManualProxyConfigurationEnabled(bool state)
|
|||||||
void Preferences::searchFromAddressBarChanged(bool stat)
|
void Preferences::searchFromAddressBarChanged(bool stat)
|
||||||
{
|
{
|
||||||
ui->searchWithDefaultEngine->setEnabled(stat);
|
ui->searchWithDefaultEngine->setEnabled(stat);
|
||||||
|
ui->showABSearchSuggestions->setEnabled(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::saveHistoryChanged(bool stat)
|
void Preferences::saveHistoryChanged(bool stat)
|
||||||
@ -1039,6 +1042,7 @@ void Preferences::saveSettings()
|
|||||||
settings.beginGroup("SearchEngines");
|
settings.beginGroup("SearchEngines");
|
||||||
settings.setValue("SearchFromAddressBar", ui->searchFromAddressBar->isChecked());
|
settings.setValue("SearchFromAddressBar", ui->searchFromAddressBar->isChecked());
|
||||||
settings.setValue("SearchWithDefaultEngine", ui->searchWithDefaultEngine->isChecked());
|
settings.setValue("SearchWithDefaultEngine", ui->searchWithDefaultEngine->isChecked());
|
||||||
|
settings.setValue("showSearchSuggestions", ui->showABSearchSuggestions->isChecked());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
//Languages
|
//Languages
|
||||||
|
@ -928,6 +928,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="showABSearchSuggestions">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show search suggestions</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_16">
|
<spacer name="verticalSpacer_16">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
Loading…
Reference in New Issue
Block a user