summaryrefslogtreecommitdiff
path: root/src/urlbar/completionwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar/completionwidget.cpp')
-rw-r--r--src/urlbar/completionwidget.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index 2199dfdf..a2bf5dbc 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -55,7 +55,6 @@ CompletionWidget::CompletionWidget(QWidget *parent)
: QFrame(parent, Qt::ToolTip)
, _parent(parent)
, _currentIndex(0)
- , _searchEngine(SearchEngine::defaultEngine())
, _hasSuggestions(false)
{
setFrameStyle(QFrame::Panel);
@@ -71,7 +70,7 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString
{
if (!isVisible())
{
- _searchEngine = SearchEngine::defaultEngine();
+ UrlResolver::setSearchEngine(SearchEngine::defaultEngine());
}
_list = list;
@@ -278,14 +277,15 @@ bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
if( _currentIndex == -1)
_currentIndex = 0;
child = findChild<ListItem *>(QString::number(_currentIndex));
- if(child)
+ if(child && _currentIndex!=0) //the completionwidget is visible and the user had press down
{
+ //we can use the url of the listitem
emit chosenUrl(child->url(), Rekonq::CurrentTab);
}
- else
+ else //the user type too fast (completionwidget not visible or suggestion not downloaded)
{
- // this will be used just on fast typing..
- emit chosenUrl(KUrl(w->text()), Rekonq::CurrentTab);
+ UrlResolver res(w->text());
+ emit chosenUrl(res.orderedSearchItems().first().url, Rekonq::CurrentTab);
}
kev->accept();
hide();
@@ -320,10 +320,15 @@ void CompletionWidget::setVisible(bool visible)
void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button, Qt::KeyboardModifiers modifier)
{
- if (button == Qt::MidButton || modifier == Qt::ControlModifier)
+ if (button == Qt::MidButton
+ || modifier == Qt::ControlModifier)
+ {
emit chosenUrl(item->url(), Rekonq::NewFocusedTab);
+ }
else
+ {
emit chosenUrl(item->url(), Rekonq::CurrentTab);
+ }
hide();
}
@@ -344,6 +349,6 @@ void CompletionWidget::suggestUrls(const QString &text)
UrlResolver *res = new UrlResolver(text);
connect(res, SIGNAL(suggestionsReady(const UrlSearchList &, const QString &)), this, SLOT(updateSearchList(const UrlSearchList &, const QString &)));
+ res->computeSuggestions();
_resList = res->orderedSearchItems();
-
}