From 624f44cf8228b12a4c7ae6f8dd36b800a4f03739 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 24 Nov 2011 16:08:52 +0100 Subject: Properly handle window/app close BUG: 286831 --- src/application.cpp | 8 +------- src/mainview.cpp | 7 ++++--- src/mainview.h | 1 + src/mainwindow.cpp | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/application.cpp b/src/application.cpp index 6ef0b0c3..f37720ff 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -462,13 +462,7 @@ MainWindow *Application::newMainWindow(bool withTab) void Application::removeMainWindow(MainWindow *window) { m_mainWindows.removeOne(window); - - // QApplication should quit as soon we have no mainwindow - // But QtWebkit seems to create windows without Qt::WA_QuitOnClose attribute, - // making rekonq keep running after last window is closed - if (m_mainWindows.length() == 0) - QCoreApplication::quit(); - + kDebug() << "Removing Window from app window list..."; } diff --git a/src/mainview.cpp b/src/mainview.cpp index 1ad452ea..fb6a1d78 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -422,9 +422,10 @@ void MainView::closeTab(int index, bool del) { if (ReKonfig::lastTabClosesWindow()) { - // closing window... - MainWindow *w = qobject_cast(parent()); - w->close(); + emit closeWindow(); +// // closing window... +// MainWindow *w = qobject_cast(parent()); +// w->close(); return; } diff --git a/src/mainview.h b/src/mainview.h index 632ddbca..4e6f1bbb 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -114,6 +114,7 @@ Q_SIGNALS: void browserTabLoading(bool); void openPreviousInHistory(); void openNextInHistory(); + void closeWindow(); void printRequested(QWebFrame *frame); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 811f1cf8..c53fcb6c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -121,7 +121,6 @@ MainWindow::MainWindow() { // Setting attributes (just to be sure...) setAttribute(Qt::WA_DeleteOnClose, true); - setAttribute(Qt::WA_QuitOnClose, false); // creating a centralWidget containing panel, m_view and the hidden findbar QWidget *centralWidget = new QWidget; @@ -186,6 +185,7 @@ MainWindow::MainWindow() // connect signals and slots connect(m_view, SIGNAL(currentTitle(const QString &)), this, SLOT(updateWindowTitle(const QString &))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); + connect(m_view, SIGNAL(closeWindow()), this, SLOT(close())); // (shift +) ctrl + tab switching connect(this, SIGNAL(ctrlTabPressed()), m_view, SLOT(nextTab())); -- cgit v1.2.1