summaryrefslogtreecommitdiff
path: root/src/bookmarks/bookmarksmanager.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-06-06 18:25:33 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-06-06 18:25:33 +0200
commita92b7b14b51befb39b003a8f69091d922f874212 (patch)
treeb1f4740b73bbcf3ba165c891a34f994a5ccc6bb3 /src/bookmarks/bookmarksmanager.cpp
parentThis should fix bug 240432 (diff)
downloadrekonq-a92b7b14b51befb39b003a8f69091d922f874212.tar.xz
Performance improvement on startup
Load bookmark menu just on first click. This is needed cause of bad startup rekonq performance with more than 1000 bookmarks as pointed out by.. (thjis?) This trick needs a workaround on first bookmarks menu showing. Do you notice it?
Diffstat (limited to 'src/bookmarks/bookmarksmanager.cpp')
-rw-r--r--src/bookmarks/bookmarksmanager.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index 1341038c..fea23c7d 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -270,6 +270,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
, m_actionCollection(new KActionCollection(this))
, m_bookmarkMenu(0)
, m_completion(0)
+ , _bookmarkActionMenu(0)
{
kDebug() << "Loading Bookmarks Manager...";
// take care of the completion object
@@ -384,13 +385,26 @@ 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"));
- return bookmarkActionMenu;
+ _bookmarkActionMenu = new KActionMenu(parent);
+ _bookmarkActionMenu->setMenu(menu);
+ _bookmarkActionMenu->setText(i18n("&Bookmarks"));
+ connect(menu, SIGNAL(aboutToShow()), this, SLOT(triggerBookmarkMenu()));
+
+ return _bookmarkActionMenu;
+}
+
+
+void BookmarkProvider::triggerBookmarkMenu()
+{
+ kDebug() << "triggering Bookmarks Menu...";
+ if(!m_bookmarkMenu)
+ {
+ KMenu *menu = qobject_cast<KMenu *>(sender());
+ kDebug() << "new Bookmarks Menu...";
+ m_bookmarkMenu = new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection);
+ kDebug() << "new Bookmarks Menu...DONE";
+ menu->exec( QCursor::pos() );
+ }
}