From 14cbcb6f931a03edb9a2a6a70cb0cb0c9bd77c90 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 14 May 2010 12:06:22 +0200 Subject: No wait for first results --- src/urlbar/urlbar.cpp | 8 ++++-- src/urlbar/urlresolver.cpp | 61 ++++++++++++++++++++++------------------------ 2 files changed, 35 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index e1e542b7..b1bfb1c0 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -398,7 +398,11 @@ void UrlBar::resizeEvent(QResizeEvent *event) void UrlBar::detectTypedString(const QString &typed) { - Q_UNUSED(typed); + if(typed.count() == 1) + { + QTimer::singleShot(0, this, SLOT(suggest())); + return; + } if(_suggestionTimer->isActive()) _suggestionTimer->stop(); @@ -410,4 +414,4 @@ void UrlBar::suggest() { if(!_box.isNull()) _box.data()->suggestUrls( text() ); -} \ No newline at end of file +} diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index e86adc62..12e2f762 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -88,50 +88,47 @@ UrlSearchList UrlResolver::orderedSearchItems() } - if (_typedString.length() >= 2) - { - int firstResults = list.count(); - int checkPoint = 9 - firstResults; + int firstResults = list.count(); + int checkPoint = 9 - firstResults; - UrlSearchList historyList = historyResolution(); - int historyResults = historyList.count(); + UrlSearchList historyList = historyResolution(); + int historyResults = historyList.count(); - UrlSearchList bookmarksList = bookmarksResolution(); - int bookmarkResults = bookmarksList.count(); + UrlSearchList bookmarksList = bookmarksResolution(); + int bookmarkResults = bookmarksList.count(); - if (historyResults + bookmarkResults > checkPoint) - { - historyList = historyList.mid(0, 3); - bookmarksList = bookmarksList.mid(0, 3); - } - - QList common; + if (historyResults + bookmarkResults > checkPoint) + { + historyList = historyList.mid(0, 3); + bookmarksList = bookmarksList.mid(0, 3); + } - foreach(UrlSearchItem i, historyList) - { - if (!bookmarksList.contains(i)) - { - list << i; - } - else - { - i.type |= UrlSearchItem::Bookmark; - common << i; - } - } + QList common; - foreach(const UrlSearchItem &i, common) + foreach(UrlSearchItem i, historyList) + { + if (!bookmarksList.contains(i)) { list << i; } - - foreach(const UrlSearchItem &i, bookmarksList) + else { - if (!common.contains(i)) - list << i; + i.type |= UrlSearchItem::Bookmark; + common << i; } } + foreach(const UrlSearchItem &i, common) + { + list << i; + } + + foreach(const UrlSearchItem &i, bookmarksList) + { + if (!common.contains(i)) + list << i; + } + list = placeTypedDomaineNameOnTop(list); return list; -- cgit v1.2.1