summaryrefslogtreecommitdiff
path: root/src/history/historymanager.h
diff options
context:
space:
mode:
authormegabigbug <megabigbug@arrakis.(none)>2010-07-20 22:07:04 +0200
committermegabigbug <megabigbug@arrakis.(none)>2010-07-20 22:07:04 +0200
commit68dfc20b8f8d8ff583c4e06ddb61a9986ccb7df7 (patch)
treef1d47659f5eb68593035219293c6a43e29c3a2f8 /src/history/historymanager.h
parentrekonq 0.5.50 (diff)
downloadrekonq-68dfc20b8f8d8ff583c4e06ddb61a9986ccb7df7.tar.xz
history review:
- remove AwesomeUrlCompletion class - add an QHash to the history manager: each url have a visit counter - sort history urls by visit count TODO: - reintroduce bookmark item in url resolver (broken when AwesomeUrlCompletion was removed)
Diffstat (limited to 'src/history/historymanager.h')
-rw-r--r--src/history/historymanager.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/history/historymanager.h b/src/history/historymanager.h
index 7b82579d..b91eec60 100644
--- a/src/history/historymanager.h
+++ b/src/history/historymanager.h
@@ -84,6 +84,31 @@ public:
// ---------------------------------------------------------------------------------------------------------------
+class HistoryHashItem : public HistoryItem
+{
+public:
+ HistoryHashItem() {}
+ explicit HistoryHashItem(const QString &u
+ ,const QDateTime &d = QDateTime()
+ ,const QString &t = QString()
+ )
+ : HistoryItem(u, d, t)
+ ,visitCount(1)
+ ,savedCount(0)
+ {}
+
+ inline bool operator <(const HistoryHashItem &other) const
+ {
+ return visitCount > other.visitCount;
+ }
+
+ int visitCount;
+ int savedCount;
+};
+
+// ---------------------------------------------------------------------------------------------------------------
+
+
class DownloadItem
{
public:
@@ -139,7 +164,9 @@ public:
void updateHistoryEntry(const KUrl &url, const QString &title);
void removeHistoryEntry(const KUrl &url, const QString &title = QString());
- QString titleForHistoryUrl(QString url);
+ HistoryHashItem get(const QString &url);
+ QList<HistoryHashItem> find(const QString &text);
+ QList<HistoryHashItem> findMostVisited(const QString &text);
int historyLimit() const;
void setHistoryLimit(int limit);
@@ -152,11 +179,6 @@ public:
HistoryFilterModel *historyFilterModel() const;
HistoryTreeModel *historyTreeModel() const;
- /**
- * @returns the AwesomeUrlCompletion object.
- */
- AwesomeUrlCompletion *completionObject() const;
-
void addDownload(const QString &srcUrl, const QString &destUrl);
DownloadList downloads();
bool clearDownloadsHistory();
@@ -172,6 +194,7 @@ private slots:
protected:
void addHistoryEntry(const HistoryItem &item);
void removeHistoryEntry(const HistoryItem &item);
+ void addHistoryHashEntry(const HistoryItem &item);
private:
void load();
@@ -180,14 +203,12 @@ private:
int m_historyLimit;
QTimer m_expiredTimer;
QList<HistoryItem> m_history;
+ QHash<QString, HistoryHashItem> m_hash;
QString m_lastSavedUrl;
HistoryModel *m_historyModel;
HistoryFilterModel *m_historyFilterModel;
HistoryTreeModel *m_historyTreeModel;
-
- // the completion object we sync with
- AwesomeUrlCompletion *m_completion;
};