summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Ander Peñalba <jonan88@gmail.com>2010-08-20 22:29:56 +0200
committerJon Ander Peñalba <jonan88@gmail.com>2010-08-20 22:29:56 +0200
commit89772b99957eff256f87d822b7741bb3e8f62276 (patch)
treeb61f673ce2e5f28e1fbce6c05ca51230b1b9997e /src
parentImproved the code to load the bookmarks file using KStandardDirs and other mi... (diff)
downloadrekonq-89772b99957eff256f87d822b7741bb3e8f62276.tar.xz
Minor changes in BookmarkProvider. Searching for bookmarks should be a bit faster
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarkprovider.cpp45
-rw-r--r--src/bookmarks/bookmarkprovider.h6
2 files changed, 17 insertions, 34 deletions
diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp
index 0cd0d3eb..ac08e76e 100644
--- a/src/bookmarks/bookmarkprovider.cpp
+++ b/src/bookmarks/bookmarkprovider.cpp
@@ -69,7 +69,8 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
// setup menu
m_owner = new BookmarkOwner(m_manager, this);
- connect(m_owner, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), this, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)));
+ connect(m_owner, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
+ this, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)));
KAction *a = KStandardAction::addBookmark(this, SLOT(slotAddBookmark()), this);
m_actionCollection->addAction(QL1S("rekonq_add_bookmark"), a);
@@ -93,7 +94,7 @@ void BookmarkProvider::registerBookmarkBar(BookmarkToolBar *toolbar)
m_bookmarkToolBars.append(toolbar);
toolbar->toolBar()->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(toolbar->toolBar(), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &)));
+ connect(toolbar->toolBar(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(contextMenu(const QPoint&)));
kDebug() << "new bookmark bar... DONE!";
}
@@ -105,7 +106,7 @@ void BookmarkProvider::removeToolBar(BookmarkToolBar *toolbar)
}
-void BookmarkProvider::slotBookmarksChanged(const QString& /*group*/, const QString& /*caller*/)
+void BookmarkProvider::slotBookmarksChanged(const QString& /*groupAddress*/, const QString& /*caller*/)
{
foreach(BookmarkToolBar *bookmarkToolBar, m_bookmarkToolBars)
{
@@ -123,7 +124,7 @@ QAction* BookmarkProvider::actionByName(const QString &name)
QAction *action = m_actionCollection->action(name);
if (action)
return action;
- return new QAction(this); // return empty object instead of NULL pointer
+ return new QAction(this);
}
@@ -205,41 +206,28 @@ KBookmarkGroup BookmarkProvider::rootGroup()
QList<KBookmark> BookmarkProvider::find(const QString &text)
{
QList<KBookmark> list;
- KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup();
- if (bookGroup.isNull())
- {
- return list;
- }
- KBookmark bookmark = bookGroup.first();
- while (!bookmark.isNull())
- {
- list = find(list, bookmark, text);
- bookmark = bookGroup.next(bookmark);
- }
+ KBookmarkGroup root = Application::bookmarkProvider()->rootGroup();
+ if (!root.isNull())
+ for (KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
+ find(&list, bookmark, text);
return list;
}
-QList<KBookmark> BookmarkProvider::find(QList<KBookmark> list, const KBookmark &bookmark, const QString &text)
+void BookmarkProvider::find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text)
{
if (bookmark.isGroup())
{
KBookmarkGroup group = bookmark.toGroup();
- KBookmark bm = group.first();
- while (!bm.isNull())
- {
- list = find(list, bm, text);
- bm = group.next(bm);
- }
+ for (KBookmark bm = group.first(); !bm.isNull(); bm = group.next(bm))
+ find(list, bm, text);
}
else if (bookmark.url().url().contains(text) || bookmark.fullText().contains(text))
{
- list << bookmark;
+ *list << bookmark;
}
-
- return list;
}
@@ -269,9 +257,7 @@ void BookmarkProvider::removeBookmarkPanel(BookmarksPanel *panel)
panel->disconnect(this);
if (m_bookmarkPanels.isEmpty())
- {
Application::bookmarkProvider()->bookmarkManager()->emitChanged();
- }
}
@@ -289,10 +275,7 @@ KBookmark BookmarkProvider::bookmarkForUrl(const KUrl &url)
{
KBookmarkGroup root = rootGroup();
if (root.isNull())
- {
- KBookmark found;
- return found;
- }
+ return KBookmark();
return bookmarkForUrl(root, url);
}
diff --git a/src/bookmarks/bookmarkprovider.h b/src/bookmarks/bookmarkprovider.h
index 61b5d12d..6036011e 100644
--- a/src/bookmarks/bookmarkprovider.h
+++ b/src/bookmarks/bookmarkprovider.h
@@ -132,11 +132,11 @@ public slots:
* @short Waits for signal that the group with the address has been modified by the caller.
* Waits for signal that the group (or any of its children) with the address
* @p groupAddress (e.g. "/4/5") has been modified by the caller @p caller.
- * @param group bookmark group address
+ * @param groupAddress bookmark group address
* @param caller caller that modified the bookmarks
* @see KBookmarkManager::changed
*/
- void slotBookmarksChanged(const QString &group, const QString &caller);
+ void slotBookmarksChanged(const QString &groupAddress, const QString &caller);
void fillBookmarkBar(BookmarkToolBar *toolBar);
private slots:
@@ -144,7 +144,7 @@ private slots:
void slotPanelChanged();
private:
- QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, const QString &text);
+ void find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text);
QString titleForBookmarkUrl(const KBookmark &bookmark, const QString &url);
KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url);