From 8d383e07e61f05a3c506c0cec57061d717b014da Mon Sep 17 00:00:00 2001 From: Lionel Chauvin Date: Sun, 23 Jan 2011 23:55:24 +0100 Subject: Order items in the completion list considering also visit count Reviewed by benjamin, pierre and me. --- src/history/historymanager.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/history/historymanager.h') 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 #include +#include /** * 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; -- cgit v1.2.1