summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/history/historymanager.cpp8
-rw-r--r--src/history/historymanager.h1
-rw-r--r--src/urlbar/urlresolver.cpp28
-rw-r--r--src/urlbar/urlresolver.h13
4 files changed, 28 insertions, 22 deletions
diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp
index a56045a7..99862205 100644
--- a/src/history/historymanager.cpp
+++ b/src/history/historymanager.cpp
@@ -316,14 +316,6 @@ QList<HistoryHashItem> HistoryManager::find(const QString &text)
}
-QList<HistoryHashItem> HistoryManager::findMostVisited(const QString &text)
-{
- QList<HistoryHashItem> list = find(text);
- qSort(list);
- return list;
-}
-
-
int HistoryManager::historyLimit() const
{
return m_historyLimit;
diff --git a/src/history/historymanager.h b/src/history/historymanager.h
index b91eec60..c1627530 100644
--- a/src/history/historymanager.h
+++ b/src/history/historymanager.h
@@ -166,7 +166,6 @@ public:
HistoryHashItem get(const QString &url);
QList<HistoryHashItem> find(const QString &text);
- QList<HistoryHashItem> findMostVisited(const QString &text);
int historyLimit() const;
void setHistoryLimit(int limit);
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index 50f1692f..115f0295 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -31,6 +31,7 @@
#include "application.h"
#include "historymanager.h"
#include "bookmarksmanager.h"
+#include "searchengine.h"
// KDE Includes
#include <KUriFilter>
@@ -59,7 +60,7 @@
QRegExp UrlResolver::_browseRegexp;
-
+QRegExp UrlResolver::_searchEnginesRegexp;
UrlResolver::UrlResolver(const QString &typedUrl)
: _typedString(typedUrl.trimmed())
@@ -90,6 +91,18 @@ UrlResolver::UrlResolver(const QString &typedUrl)
_browseRegexp = QRegExp('(' + protocol + ")|(" + localhost + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +')');
}
+ if ( _searchEnginesRegexp.isEmpty() )
+ {
+ QString reg;
+ QString engineUrl;
+ foreach(KService::Ptr s, SearchEngine::favorites())
+ {
+ engineUrl = QRegExp::escape(s->property("Query").toString()).replace("\\\\\\{@\\}","[\\d\\w-.]+");
+ if (reg.isEmpty()) reg = "(" + engineUrl + ")";
+ else reg = reg + "|(" + engineUrl + ")";
+ }
+ _searchEnginesRegexp = QRegExp(reg);
+ }
}
@@ -300,12 +313,17 @@ UrlSearchList UrlResolver::webSearchesResolution()
// STEP 3 = history completion
UrlSearchList UrlResolver::historyResolution()
{
- QList<HistoryHashItem> mostVisited = Application::historyManager()->findMostVisited(_typedString);
+ QList<HistoryHashItem> found = Application::historyManager()->find(_typedString);
+ qSort(found);
+
UrlSearchList list;
- foreach (HistoryHashItem i, mostVisited)
+ foreach (HistoryHashItem i, found)
{
- UrlSearchItem gItem(UrlSearchItem::History, i.url, i.title);
- list << gItem;
+ if (_searchEnginesRegexp.indexIn(i.url) == -1) //filter all urls that are search engine results
+ {
+ UrlSearchItem gItem(UrlSearchItem::History, i.url, i.title);
+ list << gItem;
+ }
}
return list;
}
diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h
index 0ba93921..190064eb 100644
--- a/src/urlbar/urlresolver.h
+++ b/src/urlbar/urlresolver.h
@@ -61,28 +61,24 @@ public:
UrlSearchItem(const UrlSearchItem &item) : type(item.type),
url(item.url),
title(item.title),
- description(item.description),
- bookmarkPath(item.bookmarkPath)
+ description(item.description)
{};
UrlSearchItem() : type(UrlSearchItem::Undefined),
url(QString()),
title(QString()),
- description(QString()),
- bookmarkPath(QString())
+ description(QString())
{};
UrlSearchItem(const int &_type,
const QString &_url,
const QString &_title = QString(),
- const QString &description = QString(),
- const QString &bookmarkPath = QString()
+ const QString &description = QString()
)
: type(_type),
url(_url),
title(_title),
- description(description),
- bookmarkPath(bookmarkPath)
+ description(description)
{};
inline bool operator==(const UrlSearchItem &i) const
@@ -114,6 +110,7 @@ private:
UrlSearchItem privilegedItem(UrlSearchList* list);
static QRegExp _browseRegexp;
+ static QRegExp _searchEnginesRegexp;
};
// ------------------------------------------------------------------------------