diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/browser.cpp | 1 | ||||
-rw-r--r-- | src/browser.h | 5 | ||||
-rw-r--r-- | src/webengine/widgets/pagemenu.cpp | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index 7c7dca3..4c6549c 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -145,7 +145,6 @@ void Browser::setup(const QString &defaultProfile) connect(m_bookmarks.get(), &BookmarksWidget::openUrl, this, [this](const QUrl &url) { m_windows.last()->createTab(url); }); - connect(WebProfile::defaultProfile(), &WebProfile::addBookmarkRequested, m_bookmarks.get(), &BookmarksWidget::addBookmark); // downloads m_downloads = std::make_shared<DownloadsWidget>(QString::fromStdString(m_config->value<std::string>("downloads.path").value())); diff --git a/src/browser.h b/src/browser.h index e6b94e4..8148e99 100644 --- a/src/browser.h +++ b/src/browser.h @@ -36,6 +36,11 @@ public: void setConfiguration(std::shared_ptr<Configuration> &config); void setup(const QString &defaultProfile); + std::shared_ptr<BookmarksWidget> bookmarks() + { + return m_bookmarks; + } + WebProfile *profile(const QString &name) const; const QStringList profiles() const { diff --git a/src/webengine/widgets/pagemenu.cpp b/src/webengine/widgets/pagemenu.cpp index 9cfeb71..21efd3d 100644 --- a/src/webengine/widgets/pagemenu.cpp +++ b/src/webengine/widgets/pagemenu.cpp @@ -19,6 +19,7 @@ #include <QVBoxLayout> #include <QWidgetAction> #include "browser.h" +#include <bookmarks/bookmarkswidget.h> PageMenu::PageMenu(WebView *parent) : QMenu(tr("Page"), parent) @@ -28,7 +29,9 @@ PageMenu::PageMenu(WebView *parent) auto *bookmarkAction = addAction(tr("Bookmark page")); connect(bookmarkAction, &QAction::triggered, parent, [parent]() { - parent->profile()->addBookmark(parent->title(), parent->url().toString()); + auto *browser = qobject_cast<Browser *>(qApp); + Q_CHECK_PTR(browser); + browser->bookmarks()->addBookmark(parent->title(), parent->url().toString()); }); auto *savePageAction = addAction(tr("Save Page")); |