aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow/mainwindow.cpp')
-rw-r--r--src/mainwindow/mainwindow.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index 5ee0a78..2d7ba09 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -16,6 +16,7 @@
#include <bookmarks/bookmarkswidget.h>
#include <downloads/downloadswidget.h>
#include <src/addressbar/urllineedit.h>
+#include <lib/bookmarks/bookmarksview.h>
//#include <settings/settingsdialog.h>
MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent)
@@ -247,6 +248,9 @@ void MainWindow::handleTabChanged(WebView *view)
{
Q_CHECK_PTR(view);
+ disconnect(titleChangedConnection);
+ disconnect(newBookmarkConnection);
+
m_currentView = view;
// centralWidget can be a nullptr
@@ -266,7 +270,14 @@ void MainWindow::handleTabChanged(WebView *view)
m_addressBar->connectWebView(view);
- connect(view, &WebView::titleChanged, this, &MainWindow::handleTitleUpdated);
+ titleChangedConnection = connect(view, &WebView::titleChanged, this, &MainWindow::handleTitleUpdated);
+ newBookmarkConnection = connect(view, &WebView::newBookmark, this, [this](const QString &title, const QUrl &url) {
+ if(m_bookmarksWidget) {
+ auto *bookmark = m_bookmarksWidget->model()->createBookmark(nullptr);
+ bookmark->setText(0, title);
+ bookmark->setText(1, url.toString());
+ }
+ });
m_progressBar->connectWebView(view);