From 30a122c20971ebe638ea5763cccd8adbdb8b3307 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 22 Mar 2009 11:33:18 +0100 Subject: Fixing loading of konqueror bookmarks in a unusual place or missing.. --- data/CMakeLists.txt | 6 +++++- src/bookmarks.cpp | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 41c9995f..4a17e30d 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,9 +1,13 @@ INSTALL( FILES - defaultbookmarks.xbel loading.gif DESTINATION ${DATA_INSTALL_DIR}/rekonq/pics ) +INSTALL( FILES + defaultbookmarks.xbel + DESTINATION ${DATA_INSTALL_DIR}/rekonq +) + INSTALL( FILES rekonq.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index 1066e3ce..6b6d549c 100644 --- a/src/bookmarks.cpp +++ b/src/bookmarks.cpp @@ -20,16 +20,22 @@ -// Local Includes +// Self Includes #include "bookmarks.h" #include "bookmarks.moc" +// Local Includes #include "mainwindow.h" #include "webview.h" // KDE Includes #include #include +#include +#include + +// Qt Includes +#include OwnBookMarks::OwnBookMarks(KMainWindow *parent) : QObject(parent) @@ -85,6 +91,22 @@ BookmarksProvider::BookmarksProvider(KMainWindow* parent) , m_bmToolbar(0) { KUrl bookfile = KUrl( "~/.kde/share/apps/konqueror/bookmarks.xml" ); // share konqueror bookmarks + + if (!QFile::exists( bookfile.path() ) ) + { + bookfile = KUrl( "~/.kde4/share/apps/konqueror/bookmarks.xml" ); + if (!QFile::exists( bookfile.path() ) ) + { + QString bookmarksDefaultPath = KStandardDirs::locate("appdata" , "defaultbookmarks.xbel"); + kWarning() << bookmarksDefaultPath; + QFile bkms(bookmarksDefaultPath); + QString bookmarksPath = KStandardDirs::locateLocal("appdata", "bookmarks.xml", true); + bookmarksPath.replace("rekonq", "konqueror"); + bkms.copy(bookmarksPath); + + bookfile = KUrl( bookmarksPath ); + } + } m_manager = KBookmarkManager::managerForExternalFile( bookfile.path() ); m_ac = new KActionCollection( this ); } -- cgit v1.2.1