summaryrefslogtreecommitdiff
path: root/src/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/application.cpp')
-rw-r--r--src/application.cpp54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 38ad7477..0f86feec 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -5,13 +5,11 @@
* Copyright (C) 2012-2013 by Andrea Diamantini <adjam7 at gmail dot com>
* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
- * ============================================================
- * Description: Application Main Class
* ============================================================ */
#include "application.hpp"
+#include "bookmarks/bookmarkstreemodel.hpp"
#include "plugins/pluginloader.h"
-#include "plugins/rplugininterface.hpp"
#include "rekonqwindow.hpp"
#include "settings/settings.hpp"
#include "settings/settingsdialog.h"
@@ -59,11 +57,6 @@ Application::Application(int &argc, char *argv[]) : SingleApplication(argc, argv
Application::~Application()
{
- // ok, we are closing well: don't recover on next load..
- // ReKonfig::setRecoverOnCrash(0);
- // saveConfiguration();
- delete m_settings;
-
// Destroy all windows...
for (const auto &window : m_windows) delete window;
@@ -75,6 +68,11 @@ Application::~Application()
plugin->unload();
delete plugin;
}
+
+ // ok, we are closing well: don't recover on next load..
+ // ReKonfig::setRecoverOnCrash(0);
+ // saveConfiguration();
+ delete m_settings;
}
// ---------------------------------------------------------------------------------------------------------------
@@ -95,7 +93,31 @@ bool Application::registerPlugin(const QString &path)
m_plugins.append(loader);
return true;
}
+
// ---------------------------------------------------------------------------------------------------------------
+// Bookmarks
+
+struct BookmarksModelPrivate {
+
+ BookmarksModelPrivate()
+ {
+ model = new BookmarkModel;
+ const auto path = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/bookmarks.xbel";
+ spdlog::debug("Loading bookmarks from {}", qUtf8Printable(path));
+ QFile f(path);
+ if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ model->load(&f);
+ f.close();
+ }
+ }
+ ~BookmarksModelPrivate() noexcept { delete model; }
+
+ BookmarkModel *model;
+};
+Q_GLOBAL_STATIC(BookmarksModelPrivate, bookmarks_d);
+
+QAbstractItemModel *Application::bookmarks() const { return bookmarks_d->model; }
+
/*
int Application::newInstance()
{
@@ -409,22 +431,8 @@ RekonqView *Application::newView(const QUrl &url, RekonqWindow *window)
return view;
}
-/*
-RekonqWindowList Application::rekonqWindowList()
-{
- return m_rekonqWindows;
-}
-
-
-WebAppList Application::webAppList()
-{
- return m_webApps;
-}
-
-
// ------------------------------------------------------------------------------------------------------------------
-
-
+/*
bool Application::eventFilter(QObject* watched, QEvent* event)
{
// Track which window was activated most recently to prefer it on window choosing