From 6b4f4d69a3c599bc958ccddc5f7ac1c8648a7042 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 14 May 2010 20:24:06 +0200 Subject: This commit should fix a lot of troubles on fast urlbar typing so now situation is: - first list is shown immediately - timer decreases from 200 to 150 ms (less is pretty unuseful, I fear) - people who fast type & returnPress have KUriFilter help Hope this helps :) As promised, CCBUG:237390 --- src/urlbar/completionwidget.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/urlbar/completionwidget.cpp') diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index 1bb01785..b19b163e 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -35,6 +35,7 @@ #include "application.h" #include "urlresolver.h" #include "searchengine.h" +#include "urlbar.h" // KDE Includes #include @@ -180,7 +181,8 @@ bool CompletionWidget::eventFilter(QObject *o, QEvent *e) if (wid && wid->isAncestorOf(_parent) && isVisible()) { ListItem *child; - + UrlBar *w; + if (type == QEvent::KeyPress) { QKeyEvent *ev = static_cast(e); @@ -214,12 +216,21 @@ bool CompletionWidget::eventFilter(QObject *o, QEvent *e) case Qt::Key_Enter: case Qt::Key_Return: - child = findChild(QString::number(_currentIndex)); - emit chosenUrl(child->url(), Rekonq::CurrentTab); + w = qobject_cast(parent()); + if(w->text() == _typedString) + { + child = findChild(QString::number(_currentIndex)); + emit chosenUrl(child->url(), Rekonq::CurrentTab); + } + else + { + // this will be used just on fast typing.. + emit chosenUrl(KUrl(w->text()), Rekonq::CurrentTab); + } ev->accept(); hide(); return true; - + case Qt::Key_Escape: hide(); return true; @@ -259,6 +270,8 @@ void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button) void CompletionWidget::suggestUrls(const QString &text) { + _typedString = text; + QWidget *w = qobject_cast(parent()); if (!w->hasFocus()) return; -- cgit v1.2.1