From 681a611588781734d45395d76ec802c0a2117be3 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 13 Sep 2011 17:10:30 +0200 Subject: Fix close & session First, I'm really sorry for this bad commit ('git' talking..). The fact is that the 3 bugs fixed here were found chained playing with close code. Here it is the report: - fix close window (it now really appears on multiple window closing) - fix saveSession (saving one call for each site loaded and storing better information): saveSession is now called on loadFinished - clean up some compilation warnings --- src/application.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/application.cpp') diff --git a/src/application.cpp b/src/application.cpp index b30867bb..2d8cddb2 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -61,6 +61,7 @@ #include #include #include +#include // Qt Includes #include @@ -687,3 +688,37 @@ void Application::setPrivateBrowsingMode(bool b) loadUrl(KUrl("about:home"), Rekonq::NewWindow); } } + + +void Application::queryQuit() +{ + if (mainWindowList().count() > 1) + { + int answer = KMessageBox::questionYesNoCancel( + mainWindow(), + i18n("Wanna close the window or the whole app?"), + i18n("Application/Window closing..."), + KGuiItem(i18n("C&lose Current Window"), + KIcon("window-close")), + KStandardGuiItem::quit(), + KStandardGuiItem::cancel(), + "confirmClosingMultipleWindows" + ); + + switch (answer) + { + case KMessageBox::Yes: + mainWindow()->close(); + return; + + case KMessageBox::No: + break; + + default: + return; + } + } + + // in case of just one window... + quit(); +} -- cgit v1.2.1