summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-05-20 11:47:29 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-05-20 11:47:29 +0200
commitb388497f1484f9128704de08b68f33baddcf4260 (patch)
treebf7d7e0833b00d7103ae490c12e4ed82ae564c92 /src
parentFix download handling (diff)
downloadrekonq-b388497f1484f9128704de08b68f33baddcf4260.tar.xz
reenabled lost close confirm dialog
BUG:231032
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp34
-rw-r--r--src/mainwindow.h2
2 files changed, 36 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index efc6e3c7..c56dcf76 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1399,3 +1399,37 @@ void MainWindow::enableNetworkAnalysis(bool b)
currentTab()->page()->enableNetworkAnalyzer(b);
m_analyzerPanel->toggle(b);
}
+
+
+bool MainWindow::queryClose()
+{
+ if (m_view->count() > 1)
+ {
+ int answer = KMessageBox::questionYesNoCancel(
+ this,
+ i18np("Are you sure you want to close the window?\n" "You have 1 tab open",
+ "Are you sure you want to close the window?\n" "You have %1 tabs open" ,
+ m_view->count()),
+ i18n("Are you sure you want to close the window?"),
+ KStandardGuiItem::quit(),
+ KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")),
+ KStandardGuiItem::cancel(),
+ "confirmClosingMultipleTabs"
+ );
+
+ switch (answer)
+ {
+ case KMessageBox::Yes:
+ // Quit
+ return true;
+
+ case KMessageBox::No:
+ // Close only the current tab
+ m_view->closeTab();
+
+ default:
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index d8f6114f..1f6c6931 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -115,6 +115,8 @@ protected:
*/
void keyPressEvent(QKeyEvent *event);
+ bool queryClose();
+
private slots:
void postLaunch();
void browserLoading(bool);