summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-04-19 16:56:07 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-04-19 16:56:07 +0200
commitf7843a008851ca9fdd31b6e01bdb7f8e6206633d (patch)
tree84a77b1703626652f5983d7c593eb447d79f66a8 /src/mainwindow.cpp
parentPorting "view page source" code to KDE (diff)
downloadrekonq-f7843a008851ca9fdd31b6e01bdb7f8e6206633d.tar.xz
Simpler MessageBoxs handling..
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp54
1 files changed, 18 insertions, 36 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 37e1f760..9b04cbbd 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -699,9 +699,11 @@ void MainWindow::slotToggleInspector(bool enable)
if (enable)
{
int result = KMessageBox::questionYesNo(this,
- i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n"
- "Do you want to reload all pages?"),
- i18n("Web Inspector"));
+ i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n"
+ "Do you want to reload all pages?"),
+ i18n("Web Inspector")
+ );
+
if (result == KMessageBox::Yes)
{
m_view->slotReloadAllTabs();
@@ -818,46 +820,26 @@ void MainWindow::slotShowMenubar(bool enable)
bool MainWindow::queryClose()
{
- KConfig config("rekonqrc");
- KConfigGroup group = config.group("Hand Settings");
- bool doNotAskAgainResult = group.readEntry("ExitConfirmationDialog", false);
-
- if(doNotAskAgainResult)
- return true;
-
if (m_view->count() > 1)
{
- KDialog *dialog = new KDialog(this, Qt::Dialog);
- dialog->setCaption( i18n("Closing") );
- dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel );
- dialog->setModal(true);
- dialog->showButtonSeparator(true);
- dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit());
- dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
- dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel());
- dialog->setDefaultButton(KDialog::Yes);
-
- int ret = KMessageBox::createKMessageBox( dialog,
- QMessageBox::Warning,
- i18n("Are you sure you want to close the window?\nThere are %1 tab open" , m_view->count() ),
- QStringList(),
- i18n("Do not ask again"),
- &doNotAskAgainResult,
- KMessageBox::Notify
- );
-
- if (doNotAskAgainResult)
- {
- group.writeEntry("ExitConfirmationDialog", true);
- }
- switch (ret)
+ int answer = KMessageBox::questionYesNoCancel(
+ this,
+ i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) 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 KDialog::Yes:
+ case KMessageBox::Yes:
// Quit
return true;
break;
- case KDialog::No:
+ case KMessageBox::No:
// Close only the current tab
m_view->slotCloseTab();
default: