diff options
-rw-r--r-- | src/urlbar/urlresolver.cpp | 27 | ||||
-rw-r--r-- | src/urlbar/urlresolver.h | 2 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 3877a6c2..ef071c30 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -53,6 +53,10 @@ // 4 ."kuriikwsfilter" // 5. "fixhosturifilter" +bool UrlSearchItem::operator==(UrlSearchItem i) +{ + return url==i.url; +} UrlResolver::UrlResolver(const QString &typedUrl) : _urlString(typedUrl) @@ -97,8 +101,27 @@ UrlSearchList UrlResolver::orderedSearchItems() historyList = historyList.mid(0,3); bookmarksList = bookmarksList.mid(0,3); } - list << historyList; - list << bookmarksList; + + QList<UrlSearchItem> common; + + foreach (UrlSearchItem i, historyList) + { + if (!bookmarksList.contains(i)) + list << i; + else + common << i; + } + + foreach (UrlSearchItem i, common) + { + list << i; + } + + foreach (UrlSearchItem i, bookmarksList) + { + if (!common.contains(i)) + list << i; + } } return list; diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h index 3033fc38..54b96d63 100644 --- a/src/urlbar/urlresolver.h +++ b/src/urlbar/urlresolver.h @@ -43,6 +43,8 @@ public: UrlSearchItem(const QString &_url, const QString &_title = QString(), const QString &_icon = QString()) : url(_url), title(_title), icon(_icon) {}; + + bool operator==(UrlSearchItem i); }; typedef QList <UrlSearchItem> UrlSearchList; |