aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/BrowserWindow.cpp3
-rw-r--r--src/widgets/WebViewStack.cpp11
-rw-r--r--src/widgets/WebViewStack.hpp1
3 files changed, 8 insertions, 7 deletions
diff --git a/src/widgets/BrowserWindow.cpp b/src/widgets/BrowserWindow.cpp
index aad551d..f1b786b 100644
--- a/src/widgets/BrowserWindow.cpp
+++ b/src/widgets/BrowserWindow.cpp
@@ -2,6 +2,7 @@
#include <QStackedLayout>
#include <QVBoxLayout>
#include <QtCore>
+#include <qmainwindow.h>
#include "Configuration.hpp"
#include "WindowMediator.hpp"
@@ -10,7 +11,7 @@
#include "widgets/WebViewStack.hpp"
BrowserWindow::BrowserWindow(const Configuration &configuration, const QStringList &urls)
- : configuration(configuration) {
+ : QMainWindow(nullptr), configuration(configuration) {
setCentralWidget(new QWidget());
// Root stacked layout
diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp
index ae95ea6..8c432f1 100644
--- a/src/widgets/WebViewStack.cpp
+++ b/src/widgets/WebViewStack.cpp
@@ -125,13 +125,12 @@ void WebViewStack::close(WebViewId webview_id) {
disconnect(webview->page());
webview->deleteLater();
- // TODO: Focus on different webview
- // focus_webview();
-
- // TODO: Close window on empty
if (webview_list.isEmpty()) {
- // window()->close();
- create_new_webview(configuration->new_tab_url, true);
+ if (configuration->close_window_when_no_tabs) {
+ emit close_window_requested();
+ } else {
+ create_new_webview(configuration->new_tab_url, true);
+ }
}
}
diff --git a/src/widgets/WebViewStack.hpp b/src/widgets/WebViewStack.hpp
index 23b9382..7cc2143 100644
--- a/src/widgets/WebViewStack.hpp
+++ b/src/widgets/WebViewStack.hpp
@@ -47,6 +47,7 @@ public:
signals:
void current_webview_title_changed(int index);
void new_window_requested(const QUrl &url);
+ void close_window_requested();
protected:
void set_current_url(const QUrl &url);