From 3e13bd13817c704a8d3614b3458e6d397c919e26 Mon Sep 17 00:00:00 2001 From: Arnaud Demaiziere Date: Sun, 9 Dec 2007 16:35:51 +0000 Subject: [PATCH] BUGFIX : when shutting down the system, qbt simply quits --- src/GUI.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index 6faa2ad1f..6d47b1518 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -496,7 +496,7 @@ void GUI::on_actionAbout_triggered() { // Called when we close the program void GUI::closeEvent(QCloseEvent *e) { - qDebug("Mainwindow received closeEvent"); + QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool(); if(!force_exit && systrayIntegration && goToSystrayOnExit && !this->isHidden()) { @@ -508,14 +508,16 @@ void GUI::closeEvent(QCloseEvent *e) { show(); if(!isMaximized()) showNormal(); - if(QMessageBox::question(this, - tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"), - tr("The download list is not empty.\nAre you sure you want to quit qBittorrent?"), - tr("&Yes"), tr("&No"), - QString(), 0, 1)) { - e->ignore(); - force_exit = false; - return; + if(e->spontaneous() == true || force_exit == true) { + if(QMessageBox::question(this, + tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"), + tr("The download list is not empty.\nAre you sure you want to quit qBittorrent?"), + tr("&Yes"), tr("&No"), + QString(), 0, 1)) { + e->ignore(); + force_exit = false; + return; + } } } hide(); @@ -533,6 +535,7 @@ void GUI::closeEvent(QCloseEvent *e) { qApp->exit(); } + // Display window to create a torrent void GUI::on_actionCreate_torrent_triggered() { createtorrent *ct = new createtorrent(this);