summaryrefslogtreecommitdiff
path: root/src/urlbar/urlresolver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar/urlresolver.cpp')
-rw-r--r--src/urlbar/urlresolver.cpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index 21e3fe9c..7333e305 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -74,7 +74,7 @@ UrlResolver::UrlResolver(const QString &typedUrl)
{
kDebug() << "browse regexp empty. Setting value..";
- QString protocol = "^(http://|https://|file://|ftp://)";
+ QString protocol = "^(http://|https://|file://|ftp://|man:|info:)";
QString local = "^/";
@@ -91,7 +91,7 @@ UrlResolver::UrlResolver(const QString &typedUrl)
"y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|"\
"pro)";
- _browseRegexp = QRegExp("(" + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +")");
+ _browseRegexp = QRegExp('(' + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +')');
}
}
@@ -141,12 +141,23 @@ UrlSearchList UrlResolver::orderedSearchItems()
int checkPoint = 9 - firstResults;
UrlSearchList historyList = historyResolution();
+ UrlSearchItem privileged = privilegedItem(&historyList);
int historyResults = historyList.count();
+
+ UrlSearchList bookmarksList = bookmarksResolution();
+ if (privileged.type == UrlSearchItem::Undefined)
+ {
+ privileged = privilegedItem(&bookmarksList);
+ }
+
+ if (privileged.type != UrlSearchItem::Undefined)
+ {
+ list.insert(0,privileged);
+ }
- UrlSearchList bookmarksList = bookmarksResolution();
- int bookmarkResults = bookmarksList.count();
+ int bookmarksResults = bookmarksList.count();
- if (historyResults + bookmarkResults > checkPoint)
+ if (historyResults + bookmarksResults > checkPoint)
{
historyList = historyList.mid(0, 3);
bookmarksList = bookmarksList.mid(0, 3);
@@ -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);
- if (item.url.url().contains("."+_typedString+".") || item.url.url().contains("/"+_typedString+"."))
+ UrlSearchItem item = list->at(i);
+ kDebug() << item.url.host();
+ if (item.url.host().contains( _typedString + QL1C('.') ) )
{
- list.removeAt(i);
- list.insert(0,item);
- found = true;
+ list->removeAt(i);
+ return item;
}
i++;
}
-
- return list;
+ return UrlSearchItem();
}