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/bookmarks/bookmarksmanager.cpp | 14 ++++++++++---- src/bookmarks/bookmarksmanager.h | 19 +++++++------------ 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/bookmarks') diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index c430078b..93bb5386 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -203,7 +203,8 @@ QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark) } else { - Application::bookmarkProvider()->completionObject()->addItem(bookmark.url().url()); + UrlSearchItem urlSearchItem(UrlSearchItem::Bookmark, bookmark.url().prettyUrl() , bookmark.fullText(), QDateTime(), 1, bookmark.description(), QString()); + Application::bookmarkProvider()->completionObject()->addItem(urlSearchItem); return new KBookmarkAction(bookmark, owner(), this); } } @@ -222,7 +223,6 @@ void BookmarkMenu::refill() addAddBookmarksList(); addNewFolder(); addEditBookmarks(); - } else { @@ -270,8 +270,9 @@ BookmarkProvider::BookmarkProvider(QObject *parent) , m_bookmarkMenu(0) , m_completion(0) { + kDebug() << "Loading Bookmarks Manager..."; // take care of the completion object - m_completion = new KCompletion; + m_completion = new AwesomeUrlCompletion; m_completion->setOrder(KCompletion::Weighted); KUrl bookfile = KUrl("~/.kde/share/apps/konqueror/bookmarks.xml"); // share konqueror bookmarks @@ -299,6 +300,8 @@ BookmarkProvider::BookmarkProvider(QObject *parent) // setup menu m_owner = new BookmarkOwner(this); connect(m_owner, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), this, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &))); + + kDebug() << "Loading Bookmarks Manager... DONE!"; } @@ -346,6 +349,7 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString fillBookmarkBar(bookmarkToolBar); } } + //TODO: also change completion object } @@ -379,7 +383,9 @@ void BookmarkProvider::contextMenu(const QPoint &point) KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent) { KMenu *menu = new KMenu(parent); + kDebug() << "new Bookmarks Menu..."; m_bookmarkMenu = new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection); + kDebug() << "new Bookmarks Menu...DONE"; KActionMenu *bookmarkActionMenu = new KActionMenu(parent); bookmarkActionMenu->setMenu(menu); bookmarkActionMenu->setText(i18n("&Bookmarks")); @@ -425,7 +431,7 @@ KBookmarkGroup BookmarkProvider::rootGroup() } -KCompletion *BookmarkProvider::completionObject() const +AwesomeUrlCompletion *BookmarkProvider::completionObject() const { return m_completion; } diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h index ae12280b..dfebebd2 100644 --- a/src/bookmarks/bookmarksmanager.h +++ b/src/bookmarks/bookmarksmanager.h @@ -36,13 +36,13 @@ // Local Includes #include "application.h" +#include "urlresolver.h" // Qt Includes #include // KDE Includes #include -#include // Forward Declarations class BookmarkProvider; @@ -226,19 +226,14 @@ public: */ KBookmarkGroup rootGroup(); - KBookmarkManager *bookmarkManager() - { - return m_manager; - } - BookmarkOwner *bookmarkOwner() - { - return m_owner; - } + inline KBookmarkManager *bookmarkManager() { return m_manager; } + + inline BookmarkOwner *bookmarkOwner() { return m_owner; } /** - * @returns the KCompletion object. + * @returns the AwesomeUrlCompletion object. */ - KCompletion *completionObject() const; + AwesomeUrlCompletion *completionObject() const; QString titleForBookmarkUrl(QString url); @@ -278,7 +273,7 @@ private: KActionCollection *m_actionCollection; BookmarkMenu *m_bookmarkMenu; QList m_bookmarkToolBars; - KCompletion *m_completion; + AwesomeUrlCompletion *m_completion; }; -- cgit v1.2.1