summaryrefslogtreecommitdiff
path: root/src/urlbar/completionwidget.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-05-14 20:24:06 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-05-14 20:24:06 +0200
commit6b4f4d69a3c599bc958ccddc5f7ac1c8648a7042 (patch)
treec38c780a33c8c14f471e85725633bde545586426 /src/urlbar/completionwidget.cpp
parentThis commit reintroduces the QStackedWidget class for urlbars and let (diff)
downloadrekonq-6b4f4d69a3c599bc958ccddc5f7ac1c8648a7042.tar.xz
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
Diffstat (limited to 'src/urlbar/completionwidget.cpp')
-rw-r--r--src/urlbar/completionwidget.cpp21
1 files changed, 17 insertions, 4 deletions
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 <KGlobalSettings>
@@ -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<QKeyEvent *>(e);
@@ -214,12 +216,21 @@ bool CompletionWidget::eventFilter(QObject *o, QEvent *e)
case Qt::Key_Enter:
case Qt::Key_Return:
- child = findChild<ListItem *>(QString::number(_currentIndex));
- emit chosenUrl(child->url(), Rekonq::CurrentTab);
+ w = qobject_cast<UrlBar *>(parent());
+ if(w->text() == _typedString)
+ {
+ child = findChild<ListItem *>(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<QWidget *>(parent());
if (!w->hasFocus())
return;