From a10c41adb4df9015183ca01a4dd07c519619827c Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 7 Oct 2011 19:59:23 +0200 Subject: Clean up windows close and app quit --- src/application.cpp | 15 ++++++++++++--- src/mainwindow.cpp | 9 +++++++-- src/mainwindow.h | 5 +++-- 3 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index 63be0f51..39879e4c 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -92,42 +92,49 @@ Application::~Application() Q_FOREACH(QWeakPointer window, m_mainWindows) { + kDebug() << "deleting windows..."; delete window.data(); window.clear(); } if (!m_historyManager.isNull()) { + kDebug() << "deleting history manager"; delete m_historyManager.data(); m_historyManager.clear(); } if (!m_bookmarkProvider.isNull()) { + kDebug() << "deleting bookmark Provider"; delete m_bookmarkProvider.data(); m_bookmarkProvider.clear(); } if (!m_sessionManager.isNull()) { + kDebug() << "deleting session manager"; delete m_sessionManager.data(); m_sessionManager.clear(); } if (!m_opensearchManager.isNull()) { + kDebug() << "deleting opensearch manager"; delete m_opensearchManager.data(); m_opensearchManager.clear(); } if (!m_iconManager.isNull()) { + kDebug() << "deleting icon manager"; delete m_iconManager.data(); m_iconManager.clear(); } if (!m_adblockManager.isNull()) { + kDebug() << "deleting adblock manager"; delete m_adblockManager.data(); m_adblockManager.clear(); } @@ -135,12 +142,14 @@ Application::~Application() // TODO: // add a check to NOT close rekonq // until last download is finished - if (!m_downloadManager.isNull()) { - delete m_adblockManager.data(); - m_adblockManager.clear(); + kDebug() << "deleting download manager"; + delete m_downloadManager.data(); + m_downloadManager.clear(); } + + kDebug() << "Bye bye..."; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f0df00e8..abd5455a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -118,6 +118,10 @@ MainWindow::MainWindow() , m_hidePopupTimer(new QTimer(this)) , m_rekonqMenu(0) { + // 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; centralWidget->setContentsMargins(0, 0, 0, 0); @@ -1569,8 +1573,9 @@ void MainWindow::setEditable(bool on) } -bool MainWindow::close() +void MainWindow::closeEvent(QCloseEvent *event) { emit windowClosing(); - return KMainWindow::close(); + kDebug() << "CLOSING WINDOW..."; + KXmlGuiWindow::closeEvent(event); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 3144222b..df6e40c1 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -115,8 +115,6 @@ public Q_SLOTS: void changeWindowIcon(int index); - bool close(); - Q_SIGNALS: // switching tabs void ctrlTabPressed(); @@ -139,7 +137,10 @@ protected: void keyPressEvent(QKeyEvent *event); void moveEvent(QMoveEvent *event); void resizeEvent(QResizeEvent *event); + void closeEvent(QCloseEvent *event); + bool event(QEvent *event); + void finalizeGUI(KXMLGUIClient *client); private Q_SLOTS: -- cgit v1.2.1