[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdelibs/KDE/4.9] kio/bookmarks: Set toolbar attribute on root, do not create empty bookmarks.xml.tb
From:       Stefan_Brüns <stefan.bruens () rwth-aachen ! de>
Date:       2012-09-30 21:16:26
Message-ID: 20120930211626.7F5F3A605D () git ! kde ! org
[Download RAW message or body]

Git commit 270b13a1d588d91c9f9b05194baf36620fcf57c2 by Stefan Brüns.
Committed on 30/09/2012 at 22:55.
Pushed by bruns into branch 'KDE/4.9'.

Set toolbar attribute on root, do not create empty bookmarks.xml.tbcache

If no toolbar attribute is set on any folder (including root), an
empty document is saved for .tbcache. Setting toolbar=yes on root
element during first lookup avoids this problem, and has the nice
side effect of speeding up any future findToolbar() invocations.

M  +7    -2    kio/bookmarks/kbookmarkmanager.cc

http://commits.kde.org/kdelibs/270b13a1d588d91c9f9b05194baf36620fcf57c2

diff --git a/kio/bookmarks/kbookmarkmanager.cc b/kio/bookmarks/kbookmarkmanager.cc
index d8a9cb7..940cffd 100644
--- a/kio/bookmarks/kbookmarkmanager.cc
+++ b/kio/bookmarks/kbookmarkmanager.cc
@@ -502,9 +502,14 @@ KBookmarkGroup KBookmarkManager::toolbar()
     // is already loaded
     QDomElement elem = root().findToolbar();
     if (elem.isNull())
-        return root(); // Root is the bookmark toolbar if none has been set.
+    {
+        // Root is the bookmark toolbar if none has been set.
+        // Make it explicit to speed up invocations of findToolbar()
+        root().internalElement().setAttribute("toolbar", "yes");
+        return root();
+    }
     else
-        return KBookmarkGroup(root().findToolbar());
+        return KBookmarkGroup(elem);
 }
 
 KBookmark KBookmarkManager::findByAddress( const QString & address )
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic