diff options
author | lionelc <lionelc@lionelc.(none)> | 2010-03-30 19:45:27 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-04-02 22:01:20 +0200 |
commit | a2aa033e21d1746b5479836e8d8363dcb4654d8a (patch) | |
tree | fcfd2c3016ecc3fffb38764a4f7737670e1830a0 /src | |
parent | add title for history items (diff) | |
download | rekonq-a2aa033e21d1746b5479836e8d8363dcb4654d8a.tar.xz |
manage common item of bookmarks and history
Diffstat (limited to 'src')
-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; |