From 9c24e291aa1af50c38ee513f191a60739db0f49d Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 5 Mar 2011 10:57:36 +0100 Subject: [PATCH] Updated behaviour with closing window --- src/app/mainapplication.h | 2 +- src/app/qupzilla.cpp | 21 +++++---------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/app/mainapplication.h b/src/app/mainapplication.h index 2119bf8ab..ff955bc5f 100644 --- a/src/app/mainapplication.h +++ b/src/app/mainapplication.h @@ -67,7 +67,7 @@ public: inline QString getActiveLanguage() { return m_activeLanguage; } inline bool isClosing() { return m_isClosing; } inline bool isExited() { return m_isExited; } - + inline int windowCount() { return m_mainWindows.count(); } bool checkProfileDir(); QupZilla* getWindow(); diff --git a/src/app/qupzilla.cpp b/src/app/qupzilla.cpp index c2a22a288..e77e30899 100644 --- a/src/app/qupzilla.cpp +++ b/src/app/qupzilla.cpp @@ -59,6 +59,7 @@ QupZilla::QupZilla(bool tryRestore, QUrl startUrl) : ,m_webInspectorDock(0) ,m_webSearchToolbar(0) { + setAttribute(Qt::WA_DeleteOnClose); this->resize(640,480); this->setWindowState(Qt::WindowMaximized); this->setWindowTitle("QupZilla"); @@ -653,25 +654,13 @@ void QupZilla::closeEvent(QCloseEvent* event) { if (mApp->isClosing()) return; - - QSettings settings(m_activeProfil+"settings.ini", QSettings::IniFormat); - settings.beginGroup("Web-URL-Settings"); - - if (settings.value("afterLaunch",0).toInt()!=2 && m_tabWidget->count()>1) { - QMessageBox::StandardButton button = QMessageBox::warning(this, tr("There are still open tabs"), - tr("There are still %1 open tabs and your session won't be stored. Are you sure to quit?").arg(m_tabWidget->count()), QMessageBox::Yes | QMessageBox::No); - if (button != QMessageBox::Yes) { - event->ignore(); - return; - } + if (mApp->windowCount() == 1) { + quitApp(); + return; } - settings.endGroup(); - mApp->cookieJar()->saveCookies(); - mApp->saveStateSlot(); mApp->aboutToCloseWindow(this); - - this->~QupZilla(); + mApp->saveStateSlot(); event->accept(); }