aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d2eeaf8..32f36c8 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -146,6 +146,7 @@ BrowserTab * MainWindow::addEmptyTab(bool focus_new, bool load_default)
{
BrowserTab * tab = new BrowserTab(this);
+ connect(tab, &BrowserTab::destroyed, this, &MainWindow::on_tab_closed);
connect(tab, &BrowserTab::titleChanged, this, &MainWindow::on_tab_titleChanged);
connect(tab, &BrowserTab::fileLoaded, this, &MainWindow::on_tab_fileLoaded);
connect(tab, &BrowserTab::requestStateChanged, this, &MainWindow::on_tab_requestStateChanged);
@@ -366,6 +367,16 @@ void MainWindow::closeEvent(QCloseEvent *event)
event->accept();
}
+void MainWindow::on_tab_closed()
+{
+ // If the user wants, we close the window together with the last tab.
+ // tabCount() might be 1 here, as the tab is still counted as "open"
+ if(kristall::globals().options.close_window_with_last_tab and (this->tabCount() <= 1))
+ {
+ this->close();
+ }
+}
+
void MainWindow::on_browser_tabs_currentChanged(int index)
{
if(index >= 0) {