summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/urlbar/completionwidget.cpp21
-rw-r--r--src/urlbar/completionwidget.h2
-rw-r--r--src/urlbar/listitem.cpp1
-rw-r--r--src/urlbar/urlbar.cpp2
-rw-r--r--src/urlbar/urlresolver.cpp3
5 files changed, 22 insertions, 7 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;
diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h
index 4ce8248d..2d33b59f 100644
--- a/src/urlbar/completionwidget.h
+++ b/src/urlbar/completionwidget.h
@@ -85,6 +85,8 @@ private:
int _currentIndex;
KService::Ptr _searchEngine;
+
+ QString _typedString;
};
#endif // COMPLETION_WIDGET_H
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index c6f75348..f91840d2 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -296,6 +296,7 @@ QString SearchListItem::searchItemTitle(QString engine, QString text)
return QString(i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for <b>%2</b>", engine, text));
}
+
void SearchListItem::changeSearchEngine(KService::Ptr engine)
{
m_titleLabel->setText(searchItemTitle(engine->name(), m_text));
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index fb98076a..d2992c4d 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -402,7 +402,7 @@ void UrlBar::detectTypedString(const QString &typed)
if(_suggestionTimer->isActive())
_suggestionTimer->stop();
- _suggestionTimer->start(200);
+ _suggestionTimer->start(150);
}
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index 12e2f762..840fd78f 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -222,7 +222,7 @@ UrlSearchList UrlResolver::bookmarksResolution()
UrlSearchList UrlResolver::placeTypedDomaineNameOnTop(UrlSearchList list)
{
- int i=0;
+ int i = 0;
bool found = false;
while(i<list.count() && !found)
@@ -239,4 +239,3 @@ UrlSearchList UrlResolver::placeTypedDomaineNameOnTop(UrlSearchList list)
return list;
}
-