summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLionel Chauvin <megabigbug@yahoo.fr>2011-01-23 23:55:24 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-01-23 23:55:24 +0100
commit8d383e07e61f05a3c506c0cec57061d717b014da (patch)
tree0d1fc6023dbb0a2b9d2452870cc1d720bf5fc83b /src
parentFix tab preview flickering on mouse hover. (diff)
downloadrekonq-8d383e07e61f05a3c506c0cec57061d717b014da.tar.xz
Order items in the completion list considering also visit count
Reviewed by benjamin, pierre and me.
Diffstat (limited to 'src')
-rw-r--r--src/history/historymanager.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/history/historymanager.h b/src/history/historymanager.h
index a4099de7..60598ce5 100644
--- a/src/history/historymanager.h
+++ b/src/history/historymanager.h
@@ -47,6 +47,7 @@
#include <QSortFilterProxyModel>
#include <QWebHistoryInterface>
+#include <math.h>
/**
* Elements in this class represent an history item
@@ -73,10 +74,15 @@ public:
&& other.dateTime == dateTime;
}
+ inline qreal relevance() const
+ {
+ return log(visitCount) - log(dateTime.daysTo(QDateTime::currentDateTime()) + 1);
+ }
+
// history is sorted in reverse
inline bool operator <(const HistoryItem &other) const
{
- return dateTime > other.dateTime;
+ return relevance() > other.relevance();
}
QString title;