From e96ee72ff00de1de77dd4a50fca83cea15d5b549 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 17 Jun 2014 13:04:01 +0900 Subject: Added code to copy global bookmarks from /opt/trinity/share/apps/konqueror/bookmarks.xml to $HOME/.trinity/share/apps/konqueror/bookmarks.xml if the user has no personal bookmarks. This allows giving default bookmarks to the users upon first konqueror startup. Thanks to François Andriot for the original patch, which had to be fixed in order to get this to work correctly. This relates to bug 1499. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libkonq/konqbookmarkmanager.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libkonq/konqbookmarkmanager.h b/libkonq/konqbookmarkmanager.h index 9774d92e9..88ff45ced 100644 --- a/libkonq/konqbookmarkmanager.h +++ b/libkonq/konqbookmarkmanager.h @@ -3,15 +3,27 @@ #include #include +#include +#include #include +#include class LIBKONQ_EXPORT KonqBookmarkManager { public: - static KBookmarkManager * self() { + static KBookmarkManager * self() + { if ( !s_bookmarkManager ) { - TQString bookmarksFile = locateLocal("data", TQString::fromLatin1("konqueror/bookmarks.xml")); + TQString globalBookmarkFile = locate( "data", TQString::fromLatin1( "konqueror/bookmarks.xml" ) ); + TQString bookmarksFile = locateLocal( "data", TQString::fromLatin1("konqueror/bookmarks.xml" ), true); + if (globalBookmarkFile != TQString::null && bookmarksFile != TQString::null && + globalBookmarkFile != bookmarksFile) + { + TDEIO::file_copy(KURL::fromPathOrURL(globalBookmarkFile), + KURL::fromPathOrURL(bookmarksFile)); + kapp->processEvents(3000); // Allows up to 3 seconds to copy the file + } s_bookmarkManager = KBookmarkManager::managerForFile( bookmarksFile ); } return s_bookmarkManager; -- cgit v1.2.3