mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Added option to disable search suggestions in searchbar.
- accessible from context menu (right click in searchbar) closes #443
This commit is contained in:
parent
8264e42f33
commit
10185fd649
|
@ -22,6 +22,7 @@
|
|||
bool LocationBarSettings::selectAllOnDoubleClick = false;
|
||||
bool LocationBarSettings::selectAllOnClick = false;
|
||||
bool LocationBarSettings::addCountryWithAlt = false;
|
||||
bool LocationBarSettings::showSearchSuggestions = false;
|
||||
|
||||
LocationBarSettings::LocationBarSettings()
|
||||
{
|
||||
|
@ -36,4 +37,8 @@ void LocationBarSettings::loadSettings()
|
|||
selectAllOnClick = settings.value("SelectAllTextOnClick", false).toBool();
|
||||
addCountryWithAlt = settings.value("AddCountryDomainWithAltKey", true).toBool();
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("SearchEngines");
|
||||
showSearchSuggestions = settings.value("showSuggestions", true).toBool();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
static bool selectAllOnDoubleClick;
|
||||
static bool selectAllOnClick;
|
||||
static bool addCountryWithAlt;
|
||||
|
||||
static bool showSearchSuggestions;
|
||||
};
|
||||
|
||||
#endif // LOCATIONBARSETTINGS_H
|
||||
|
|
|
@ -20,12 +20,14 @@
|
|||
#include "mainapplication.h"
|
||||
#include "tabbedwebview.h"
|
||||
#include "webpage.h"
|
||||
#include "settings.h"
|
||||
#include "websettings.h"
|
||||
#include "tabwidget.h"
|
||||
#include "clickablelabel.h"
|
||||
#include "buttonwithmenu.h"
|
||||
#include "searchenginesmanager.h"
|
||||
#include "searchenginesdialog.h"
|
||||
#include "locationbarsettings.h"
|
||||
#include "networkmanager.h"
|
||||
|
||||
#include <QCompleter>
|
||||
|
@ -102,8 +104,10 @@ void WebSearchBar::aboutToShowMenu()
|
|||
|
||||
void WebSearchBar::addSuggestions(const QStringList &list)
|
||||
{
|
||||
QStringList list_ = list.mid(0, 6);
|
||||
m_completerModel->setStringList(list_);
|
||||
if (LocationBarSettings::showSearchSuggestions) {
|
||||
QStringList list_ = list.mid(0, 6);
|
||||
m_completerModel->setStringList(list_);
|
||||
}
|
||||
}
|
||||
|
||||
void WebSearchBar::openSearchEnginesDialog()
|
||||
|
@ -118,6 +122,17 @@ void WebSearchBar::openSearchEnginesDialog()
|
|||
m_searchDialog.data()->show();
|
||||
}
|
||||
|
||||
void WebSearchBar::enableSearchSuggestions(bool enable)
|
||||
{
|
||||
Settings settings;
|
||||
settings.beginGroup("SearchEngines");
|
||||
settings.setValue("showSuggestions", enable);
|
||||
settings.endGroup();
|
||||
|
||||
LocationBarSettings::showSearchSuggestions = enable;
|
||||
m_completerModel->setStringList(QStringList());
|
||||
}
|
||||
|
||||
void WebSearchBar::setupEngines()
|
||||
{
|
||||
disconnect(m_searchManager, SIGNAL(enginesChanged()), this, SLOT(setupEngines()));
|
||||
|
@ -275,6 +290,12 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
|
|||
|
||||
tempMenu->deleteLater();
|
||||
|
||||
m_menu->addSeparator();
|
||||
QAction* act = m_menu->addAction(tr("Show suggestions"));
|
||||
act->setCheckable(true);
|
||||
act->setChecked(LocationBarSettings::showSearchSuggestions);
|
||||
connect(act, SIGNAL(triggered(bool)), this, SLOT(enableSearchSuggestions(bool)));
|
||||
|
||||
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());
|
||||
|
||||
//Prevent choosing first option with double rightclick
|
||||
|
|
|
@ -64,6 +64,7 @@ private slots:
|
|||
void aboutToShowMenu();
|
||||
void openSearchEnginesDialog();
|
||||
|
||||
void enableSearchSuggestions(bool enable);
|
||||
void addSuggestions(const QStringList &list);
|
||||
|
||||
void addEngineFromAction();
|
||||
|
|
Loading…
Reference in New Issue
Block a user