aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-02-08 16:16:41 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-02-08 16:16:41 +0100
commitbb0eccac8d006e03e29f7b5a849994bf819405ed (patch)
tree3a0630a2f636f9ba89cc0849f00d479ecdd7b422 /src/mainwindow/mainwindow.cpp
parentFixed address bar auto-complete (diff)
downloadsmolbote-bb0eccac8d006e03e29f7b5a849994bf819405ed.tar.xz
Connected WebView::newBookmark signal
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);