From c2d18d73b0e1a74525ec0cda36a2e2e7e5b4ff4c Mon Sep 17 00:00:00 2001 From: aqua Date: Sun, 14 Aug 2022 18:47:37 +0300 Subject: Import BookmarkModel from poi --- src/bookmarks/bookmarkmanager.cpp | 81 +++++++++++---------------------------- 1 file changed, 22 insertions(+), 59 deletions(-) (limited to 'src/bookmarks/bookmarkmanager.cpp') diff --git a/src/bookmarks/bookmarkmanager.cpp b/src/bookmarks/bookmarkmanager.cpp index d8001819..1f406a04 100644 --- a/src/bookmarks/bookmarkmanager.cpp +++ b/src/bookmarks/bookmarkmanager.cpp @@ -1,80 +1,43 @@ /* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2008-2012 by Andrea Diamantini -* Copyright (C) 2009 by Paweł Prażak -* Copyright (C) 2009-2010 by Lionel Chauvin -* Copyright (C) 2010 by Yoann Laissus -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* ============================================================ */ - + * The rekonq project + * ============================================================ + * SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (C) 2008-2012 by Andrea Diamantini + * Copyright (C) 2009 by Paweł Prażak + * Copyright (C) 2009-2010 by Lionel Chauvin + * Copyright (C) 2010 by Yoann Laissus + * SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2022 aqua + * ============================================================ + * Description: rekonq bookmarks system interface + * ============================================================ */ // Self Includes -#include "bookmarkmanager.h" -#include "bookmarkmanager.moc" - -// Local Includes -#include "application.h" - +#include "bookmarkmanager.hpp" +#include "bookmarkowner.h" #include "bookmarksmenu.h" #include "bookmarkstoolbar.h" -#include "bookmarkowner.h" - -#include "iconmanager.h" - -// KDE Includes -#include -#include - -// Qt Includes -#include - +#include +#include +#include // ---------------------------------------------------------------------------------------------- - -QWeakPointer BookmarkManager::s_bookmarkManager; - +static std::unique_ptr s_bookmarkManager = nullptr; BookmarkManager *BookmarkManager::self() { - if (s_bookmarkManager.isNull()) - { - s_bookmarkManager = new BookmarkManager(qApp); - } - return s_bookmarkManager.data(); + if (!s_bookmarkManager) { s_bookmarkManager = new BookmarkManager(qApp); } + return *s_bookmarkManager; } // ---------------------------------------------------------------------------------------------- - -BookmarkManager::BookmarkManager(QObject *parent) - : QObject(parent) - , m_manager(0) - , m_owner(0) - , m_actionCollection(new KActionCollection(this)) +BookmarkManager::BookmarkManager(QObject *parent) : QObject(parent) { m_manager = KBookmarkManager::userBookmarksManager(); - const QString bookmarksFile = KStandardDirs::locateLocal("data", QString::fromLatin1("konqueror/bookmarks.xml")); + const auto bookmarksFile = QStandardPaths::locate(AppLocalDataLocation, QString::fromLatin1("bookmarks.xbel")); if (!QFile::exists(bookmarksFile)) { -- cgit v1.2.1