summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp61
1 files changed, 34 insertions, 27 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index efc6e3c7..2287370c 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -265,12 +265,6 @@ QSize MainWindow::sizeHint() const
}
-KActionCollection *MainWindow::actionCollection() const
-{
- return m_ac;
-}
-
-
void MainWindow::setupActions()
{
// this let shortcuts work..
@@ -984,13 +978,6 @@ void MainWindow::homePage(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers k
}
-MainView *MainWindow::mainView() const
-{
- return m_view;
-}
-
-
-
WebTab *MainWindow::currentTab() const
{
return m_view->currentWebTab();
@@ -1124,20 +1111,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
}
-QAction *MainWindow::actionByName(const QString &name)
-{
- QAction *ret = actionCollection()->action(name);
-
- if (ret)
- return ret;
-
- /* else */
- kDebug() << "Action named: " << name << " not found, returning empty action.";
-
- return new QAction(this); // return empty object instead of NULL pointer
-}
-
-
void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
{
if (this != QApplication::activeWindow())
@@ -1399,3 +1372,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;
+}