summaryrefslogtreecommitdiff
path: root/src/urlbar/urlresolver.h
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-06-04 23:21:46 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-06-05 00:49:37 +0200
commitdeab0dd37edbc4007a3c2cf32d31811aff0e7e2d (patch)
treeb2a2884a69dd03428cdb9bcf15150a17ebbff867 /src/urlbar/urlresolver.h
parentThis should fix the Ctrl+w bug. Anyway, it really doesn't solve it: there is ... (diff)
downloadrekonq-deab0dd37edbc4007a3c2cf32d31811aff0e7e2d.tar.xz
Awesome bar speed up
This commit introduces notable changes and needs a lot of tests Courtesy patch from Mathias Kraus. Thanks :) BUG: 237390
Diffstat (limited to 'src/urlbar/urlresolver.h')
-rw-r--r--src/urlbar/urlresolver.h84
1 files changed, 76 insertions, 8 deletions
diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h
index 2249ea32..83228140 100644
--- a/src/urlbar/urlresolver.h
+++ b/src/urlbar/urlresolver.h
@@ -33,11 +33,14 @@
// KDE Includes
#include <KUrl>
+#include <KCompletion>
// Qt Includes
#include <QString>
#include <QList>
+#include <QDateTime>
+class AwesomeUrlCompletion;
class UrlSearchItem
{
@@ -53,22 +56,62 @@ public:
};
int type;
- KUrl url;
+ QString url;
QString title;
+ QDateTime visitDateTime;
+ int visitCount;
+ QString description;
+ QString bookmarkPath;
- UrlSearchItem(const UrlSearchItem &item)
- : type(item.type), url(item.url), title(item.title)
+ UrlSearchItem(const UrlSearchItem &item) : type(item.type),
+ url(item.url),
+ title(item.title),
+ visitDateTime(item.visitDateTime),
+ visitCount(item.visitCount),
+ description(item.description),
+ bookmarkPath(item.bookmarkPath)
{};
- UrlSearchItem()
- : type(UrlSearchItem::Undefined), url(KUrl()), title("")
+ UrlSearchItem() : type(UrlSearchItem::Undefined),
+ url(QString()),
+ title(QString()),
+ visitDateTime(QDateTime()),
+ visitCount(0),
+ description(QString()),
+ bookmarkPath(QString())
{};
- UrlSearchItem(const int &_type, const KUrl &_url, const QString &_title = QString())
- : type(_type), url(_url), title(_title)
+ UrlSearchItem(const int &_type,
+ const QString &_url,
+ const QString &_title = QString(),
+ const QDateTime &visitDateTime = QDateTime(),
+ const int &visitCount = 0,
+ const QString &description = QString(),
+ const QString &bookmarkPath = QString()
+ )
+ : type(_type),
+ url(_url),
+ title(_title),
+ visitDateTime(visitDateTime),
+ visitCount(visitCount),
+ description(description),
+ bookmarkPath(bookmarkPath)
{};
- bool operator==(const UrlSearchItem &i) const;
+ inline bool operator==(const UrlSearchItem &i) const
+ {
+ return i.url == url;//TODO && i.title == title;
+ }
+
+ inline bool operator <(const UrlSearchItem &i) const
+ {
+ return visitDateTime < i.visitDateTime;
+ }
+
+ inline bool operator >(const UrlSearchItem &i) const
+ {
+ return visitDateTime > i.visitDateTime;
+ }
};
typedef QList <UrlSearchItem> UrlSearchList;
@@ -96,4 +139,29 @@ private:
static QRegExp _browseRegexp;
};
+// ------------------------------------------------------------------------------
+
+
+/**
+ * This class represents all searchable item for the awesomebar.
+ */
+class AwesomeUrlCompletion// : public KCompletion
+{
+public:
+ AwesomeUrlCompletion();
+ ~AwesomeUrlCompletion();
+ void addItem(const UrlSearchItem& item);
+ void removeItem(const UrlSearchItem& item);
+ void setOrder(KCompletion::CompOrder);
+ void updateTitle(const UrlSearchItem& item, const QString& newTitle);
+ void clear();
+ UrlSearchList substringCompletion(const QString& completionString);
+
+private:
+ UrlSearchList m_items;
+ UrlSearchList m_filteredItems;
+ bool m_resetCompletion;
+ QString m_lastCompletionString;
+};
+
#endif // URL_RESOLVER_H