diff options
author | megabigbug <megabigbug@arrakis.(none)> | 2010-05-16 12:55:36 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-05-24 17:21:48 +0200 |
commit | 96139ac06a22c8b341c4ef1ab2f8cdd8134ac4db (patch) | |
tree | 29131b2a0fcacaf8baf53648854701ae56951199 /src/urlbar/urlresolver.cpp | |
parent | Merge commit 'refs/merge-requests/2275' of git://gitorious.org/rekonq/mainlin... (diff) | |
download | rekonq-96139ac06a22c8b341c4ef1ab2f8cdd8134ac4db.tar.xz |
remove domainNameItem() method
search a privilged item in the bookmark and history list instead of in the result list
Diffstat (limited to 'src/urlbar/urlresolver.cpp')
-rw-r--r-- | src/urlbar/urlresolver.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 21e3fe9c..af176a98 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -140,11 +140,22 @@ UrlSearchList UrlResolver::orderedSearchItems() int firstResults = list.count(); int checkPoint = 9 - firstResults; + UrlSearchList bookmarksList = bookmarksResolution(); + UrlSearchItem privileged = privilegedItem(&bookmarksList); + int bookmarkResults = bookmarksList.count(); + UrlSearchList historyList = historyResolution(); - int historyResults = historyList.count(); + if (privileged.type == UrlSearchItem::Undefined) + { + privileged = privilegedItem(&historyList); + } + + if (privileged.type != UrlSearchItem::Undefined) + { + list.insert(0,privileged); + } - UrlSearchList bookmarksList = bookmarksResolution(); - int bookmarkResults = bookmarksList.count(); + int historyResults = historyList.count(); if (historyResults + bookmarkResults > checkPoint) { @@ -178,8 +189,6 @@ UrlSearchList UrlResolver::orderedSearchItems() list << i; } - list = placeTypedDomaineNameOnTop(list); - return list; } @@ -246,22 +255,19 @@ UrlSearchList UrlResolver::bookmarksResolution() } -UrlSearchList UrlResolver::placeTypedDomaineNameOnTop(UrlSearchList list) +UrlSearchItem UrlResolver::privilegedItem(UrlSearchList* list) { - int i = 0; - bool found = false; - - while(i<list.count() && !found) + int i=0; + while(i<list->count()) { - UrlSearchItem item = list.at(i); + UrlSearchItem item = list->at(i); if (item.url.url().contains("."+_typedString+".") || item.url.url().contains("/"+_typedString+".")) { - list.removeAt(i); - list.insert(0,item); - found = true; + list->removeAt(i); + return item; } i++; } - - return list; + return UrlSearchItem(); } + |