diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-09-02 11:10:28 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-09-02 11:10:28 +0200 |
commit | 3d51652105662cc4ebf0707aa1e52d790f01c480 (patch) | |
tree | 74a89f8a50727060456048dfe40dcd7bd82ce6a1 /src | |
parent | trivials: (diff) | |
download | rekonq-3d51652105662cc4ebf0707aa1e52d790f01c480.tar.xz |
don't calculate suggestions on fast typing resolution or when user
types a local url (something starting with /)
Diffstat (limited to 'src')
-rw-r--r-- | src/urlbar/completionwidget.cpp | 9 | ||||
-rw-r--r-- | src/urlbar/urlresolver.cpp | 10 | ||||
-rw-r--r-- | src/urlbar/urlresolver.h | 18 |
3 files changed, 24 insertions, 13 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index 1b931535..a2bf5dbc 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -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(); - } diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 6743727b..21d804ef 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -64,6 +64,7 @@ KService::Ptr UrlResolver::_searchEngine; QRegExp UrlResolver::_browseRegexp; QRegExp UrlResolver::_searchEnginesRegexp; + UrlResolver::UrlResolver(const QString &typedUrl) : QObject() , _typedString(typedUrl.trimmed()) @@ -110,8 +111,6 @@ UrlResolver::UrlResolver(const QString &typedUrl) } _searchEnginesRegexp = QRegExp(reg); } - - computeSuggestions(); } @@ -378,6 +377,13 @@ void UrlResolver::computeBookmarks() //opensearch suggestion void UrlResolver::computeSuggestions() { + if(_typedString.startsWith('/')) + { + UrlSearchList list; + emit suggestionsReady(list, _typedString); + return; + } + if (Application::opensearchManager()->isSuggestionAvailable()) { connect(Application::opensearchManager(), diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h index dc579e0e..700fd460 100644 --- a/src/urlbar/urlresolver.h +++ b/src/urlbar/urlresolver.h @@ -114,6 +114,14 @@ public: _searchEngine = engine; }; + void computeSuggestions(); + +private Q_SLOTS: + void suggestionsReceived(const QString &text, const QStringList &suggestions); + +Q_SIGNALS: + void suggestionsReady(const UrlSearchList &, const QString &); + private: QString _typedString; @@ -127,7 +135,6 @@ private: void computeHistory(); void computeQurlFromUserInput(); void computeBookmarks(); - void computeSuggestions(); UrlSearchItem privilegedItem(UrlSearchList* list); UrlSearchList orderLists(); @@ -135,14 +142,7 @@ private: static QRegExp _browseRegexp; static QRegExp _searchEnginesRegexp; - static KService::Ptr _searchEngine; - -private slots: - void suggestionsReceived(const QString &text, const QStringList &suggestions); - -Q_SIGNALS: - void suggestionsReady(const UrlSearchList &, const QString &); - + static KService::Ptr _searchEngine; }; // ------------------------------------------------------------------------------ |