From 1519d6ab5b9898e1617989719fb31ec5a95c1200 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 10 Apr 2011 00:52:06 +0200 Subject: Fix History ordering (check about:history page before and after this patch) and remove the "provileged" item in the urlbar suggestions as it was NOT really working. Reduce min suggestion list from 3 to 2 to enable more history suggestions. . --- src/history/historymanager.h | 2 +- src/urlbar/urlresolver.cpp | 57 ++++++++++++++++---------------------------- src/urlbar/urlresolver.h | 2 +- 3 files changed, 22 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/history/historymanager.h b/src/history/historymanager.h index eb8d78d7..8650bd14 100644 --- a/src/history/historymanager.h +++ b/src/history/historymanager.h @@ -84,7 +84,7 @@ public: // history is sorted in reverse inline bool operator <(const HistoryItem &other) const { - return relevance() > other.relevance(); + return dateTime > other.dateTime; } QString title; diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index ee01599c..d89f27d0 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -47,7 +47,7 @@ // defines #define MAX_ELEMENTS 8 -#define MIN_SUGGESTIONS 3 +#define MIN_SUGGESTIONS 2 // NOTE // default kurifilter plugin list (at least in my box): @@ -173,26 +173,9 @@ UrlSearchList UrlResolver::orderLists() list << _qurlFromUserInput; } - //find the history items that match the typed string - UrlSearchItem privileged = privilegedItem(&_history); int historyCount = _history.count(); - - //find the bookmarks items that match the typed string - if (privileged.type == UrlSearchItem::Undefined) - { - privileged = privilegedItem(&_bookmarks); - } - else if (privileged.type == UrlSearchItem::History && _bookmarks.removeOne(privileged)) - { - privileged.type |= UrlSearchItem::Bookmark; - } int bookmarksCount = _bookmarks.count(); - if (privileged.type != UrlSearchItem::Undefined) - { - list.prepend(privileged); - } - int availableEntries = MAX_ELEMENTS - list.count() - MIN_SUGGESTIONS; UrlSearchList common; @@ -436,22 +419,22 @@ void UrlResolver::suggestionsReceived(const QString &text, const ResponseList &s } -UrlSearchItem UrlResolver::privilegedItem(UrlSearchList* list) -{ - UrlSearchItem item; - QString dot = QString(QL1C('.')); - QString test1 = QString(QL1C('/')) + _typedString + dot; - QString test2 = dot + _typedString + dot; - - for (int i = 0; i < list->count(); i++) - { - item = list->at(i); - //TODO: move this to AwesomeUrlCompletion::substringCompletion and add a priviledged flag to UrlSearchItem - if (item.url.contains(test1) || item.url.contains(test2)) - { - list->removeAt(i); - return item; - } - } - return UrlSearchItem(); -} +// UrlSearchItem UrlResolver::privilegedItem(UrlSearchList* list) +// { +// UrlSearchItem item; +// QString dot = QString(QL1C('.')); +// QString test1 = QString(QL1C('/')) + _typedString + dot; +// QString test2 = dot + _typedString + dot; +// +// for (int i = 0; i < list->count(); i++) +// { +// item = list->at(i); +// //TODO: move this to AwesomeUrlCompletion::substringCompletion and add a priviledged flag to UrlSearchItem +// if (item.url.contains(test1) || item.url.contains(test2)) +// { +// list->removeAt(i); +// return item; +// } +// } +// return UrlSearchItem(); +// } diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h index 70549094..030d1deb 100644 --- a/src/urlbar/urlresolver.h +++ b/src/urlbar/urlresolver.h @@ -150,7 +150,7 @@ private: void computeQurlFromUserInput(); void computeBookmarks(); - UrlSearchItem privilegedItem(UrlSearchList* list); +// UrlSearchItem privilegedItem(UrlSearchList* list); UrlSearchList orderLists(); QString _typedString; -- cgit v1.2.1