summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/urlbar/urlresolver.cpp8
-rw-r--r--src/urlbar/urlresolver.h3
2 files changed, 10 insertions, 1 deletions
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index e7f41c7b..073cc728 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -336,7 +336,7 @@ void UrlResolver::computeWebSearches()
void UrlResolver::computeHistory()
{
QList<HistoryItem> found = rApp->historyManager()->find(_typedString);
- qSort(found);
+ qSort(found.begin(), found.end(), isHistoryItemRelevant);
Q_FOREACH(const HistoryItem & i, found)
{
@@ -391,6 +391,12 @@ void UrlResolver::computeSuggestions()
}
+bool UrlResolver::isHistoryItemRelevant(const HistoryItem &a, const HistoryItem &b)
+{
+ return a.relevance() > b.relevance();
+}
+
+
void UrlResolver::suggestionsReceived(const QString &text, const ResponseList &suggestions)
{
if (text != _typedQuery)
diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h
index cc429fa0..d030c607 100644
--- a/src/urlbar/urlresolver.h
+++ b/src/urlbar/urlresolver.h
@@ -114,6 +114,7 @@ typedef QList <UrlSearchItem> UrlSearchList;
// ----------------------------------------------------------------------
+class HistoryItem;
class UrlResolver : public QObject
{
@@ -138,6 +139,8 @@ public:
void computeSuggestions();
+ static bool isHistoryItemRelevant(const HistoryItem &a, const HistoryItem &b);
+
private Q_SLOTS:
void suggestionsReceived(const QString &text, const ResponseList &suggestions);