From deab0dd37edbc4007a3c2cf32d31811aff0e7e2d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 4 Jun 2010 23:21:46 +0200 Subject: Awesome bar speed up This commit introduces notable changes and needs a lot of tests Courtesy patch from Mathias Kraus. Thanks :) BUG: 237390 --- src/history/historymanager.cpp | 23 ++++++++++++++--------- src/history/historymanager.h | 10 ++++------ 2 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src/history') diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index c0f87935..d531c189 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -69,8 +69,9 @@ HistoryManager::HistoryManager(QObject *parent) , m_historyModel(0) , m_historyFilterModel(0) , m_historyTreeModel(0) - , m_completion(new KCompletion) + , m_completion(new AwesomeUrlCompletion) { + kDebug() << "Loading HistoryManager..."; // take care of the completion object m_completion->setOrder(KCompletion::Weighted); @@ -87,6 +88,7 @@ HistoryManager::HistoryManager(QObject *parent) // QWebHistoryInterface will delete the history manager QWebHistoryInterface::setDefaultInterface(this); + kDebug() << "Loading HistoryManager... DONE"; } @@ -131,7 +133,8 @@ void HistoryManager::addHistoryEntry(const QString &url) // Add item to completion object QString _url(url); _url.remove(QRegExp("^http://|/$")); - m_completion->addItem(_url); + UrlSearchItem urlSearchItem(UrlSearchItem::History, _url, QString(), item.dateTime, 1, QString(), QString()); + m_completion->addItem(urlSearchItem); } @@ -251,20 +254,21 @@ void HistoryManager::removeHistoryEntry(const HistoryItem &item) void HistoryManager::removeHistoryEntry(const KUrl &url, const QString &title) { + HistoryItem item; for (int i = 0; i < m_history.count(); ++i) { if (url == m_history.at(i).url && (title.isEmpty() || title == m_history.at(i).title)) { - removeHistoryEntry(m_history.at(i)); + item = m_history.at(i); + removeHistoryEntry(item); break; } } // Remove item from completion object - QString _url = url.path(); - _url.remove(QRegExp("^http://|/$")); - m_completion->removeItem(_url); + UrlSearchItem urlSearchItem(UrlSearchItem::History, item.url, item.title, item.dateTime, 0, QString(), QString()); + m_completion->removeItem(urlSearchItem); } @@ -367,9 +371,10 @@ void HistoryManager::load() lastInsertedItem = item; // Add item to completion object - QString _url = item.url; + //QString _url = item.url; //_url.remove(QRegExp("^http://|/$")); - m_completion->addItem(_url); + UrlSearchItem urlSearchItem(UrlSearchItem::History, item.url, item.title, item.dateTime, 1, QString(), QString()); + m_completion->addItem(urlSearchItem); } if (needToSort) qSort(list.begin(), list.end()); @@ -453,7 +458,7 @@ void HistoryManager::save() } -KCompletion * HistoryManager::completionObject() const +AwesomeUrlCompletion * HistoryManager::completionObject() const { return m_completion; } diff --git a/src/history/historymanager.h b/src/history/historymanager.h index 0f131782..7b82579d 100644 --- a/src/history/historymanager.h +++ b/src/history/historymanager.h @@ -32,6 +32,7 @@ // Rekonq Includes #include "rekonq_defines.h" +#include "urlresolver.h" // KDE Includes #include @@ -113,9 +114,6 @@ class HistoryModel; class HistoryFilterModel; class HistoryTreeModel; -class KCompletion; - - /** * THE History Manager: * It manages rekonq history @@ -155,9 +153,9 @@ public: HistoryTreeModel *historyTreeModel() const; /** - * @returns the KCompletion object. + * @returns the AwesomeUrlCompletion object. */ - KCompletion *completionObject() const; + AwesomeUrlCompletion *completionObject() const; void addDownload(const QString &srcUrl, const QString &destUrl); DownloadList downloads(); @@ -189,7 +187,7 @@ private: HistoryTreeModel *m_historyTreeModel; // the completion object we sync with - KCompletion *m_completion; + AwesomeUrlCompletion *m_completion; }; -- cgit v1.2.1