From kde-commits Sun Sep 30 21:10:48 2012 From: =?utf-8?q?Stefan_Br=C3=BCns?= Date: Sun, 30 Sep 2012 21:10:48 +0000 To: kde-commits Subject: [kdelibs/KDE/4.10] kio/bookmarks: Set toolbar attribute on root, do not create empty bookmarks.xml.t Message-Id: <20120930211048.229B0A605D () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=134903945804017 Git commit 92d2484a4b0ba692a78faa83ceca851a6511f4f5 by Stefan Br=C3=BCns. Committed on 30/09/2012 at 22:55. Pushed by bruns into branch 'KDE/4.10'. 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=3Dyes 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/92d2484a4b0ba692a78faa83ceca851a6511f4f5 diff --git a/kio/bookmarks/kbookmarkmanager.cc b/kio/bookmarks/kbookmarkman= ager.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 =3D root().findToolbar(); if (elem.isNull()) - return root(); // Root is the bookmark toolbar if none has been se= t. + { + // 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 )