summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-09-13 17:10:30 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-09-13 17:10:30 +0200
commit681a611588781734d45395d76ec802c0a2117be3 (patch)
treedfcf89a4772664417dfd1b0b70d78f29362c0cb8 /src/mainwindow.cpp
parentGet sure about urls are restored (diff)
downloadrekonq-681a611588781734d45395d76ec802c0a2117be3.tar.xz
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
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp57
1 files changed, 14 insertions, 43 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d1650f36..ebf8d676 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -274,8 +274,8 @@ void MainWindow::postLaunch()
// Ctrl + wheel handling
connect(this->currentTab()->view(), SIGNAL(zoomChanged(int)), m_zoomBar, SLOT(setValue(int)));
- // Save session when last window is closed
- connect(this, SIGNAL(lastWindowClosed()), rApp->sessionManager(), SLOT(saveSession()));
+ // Save session on window closing
+ connect(this, SIGNAL(windowClosing()), rApp->sessionManager(), SLOT(saveSession()));
// setting up toolbars to NOT have context menu enabled
setContextMenuPolicy(Qt::DefaultContextMenu);
@@ -295,6 +295,7 @@ QSize MainWindow::sizeHint() const
return size;
}
+
void MainWindow::changeWindowIcon(int index)
{
if (ReKonfig::useFavicon())
@@ -305,6 +306,7 @@ void MainWindow::changeWindowIcon(int index)
}
}
+
void MainWindow::setupActions()
{
// this let shortcuts work..
@@ -322,7 +324,7 @@ void MainWindow::setupActions()
KStandardAction::open(this, SLOT(fileOpen()), actionCollection());
KStandardAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
KStandardAction::print(this, SLOT(printRequested()), actionCollection());
- KStandardAction::quit(rApp, SLOT(quit()), actionCollection());
+ KStandardAction::quit(rApp, SLOT(queryQuit()), actionCollection());
a = KStandardAction::find(m_findBar, SLOT(show()), actionCollection());
KShortcut findShortcut = KStandardShortcut::find();
@@ -1290,6 +1292,7 @@ void MainWindow::clearPrivateData()
dialog->deleteLater();
}
+
void MainWindow::aboutToShowBackMenu()
{
m_historyBackMenu->clear();
@@ -1403,6 +1406,7 @@ void MainWindow::openActionUrl(QAction *action)
history->goToItem(history->itemAt(index));
}
+
void MainWindow::openActionTab(QAction* action)
{
int index = action->data().toInt();
@@ -1481,46 +1485,6 @@ void MainWindow::enableNetworkAnalysis(bool b)
}
-bool MainWindow::queryClose()
-{
- // this should fux bug 240432
- if (rApp->sessionSaving())
- return true;
-
- // smooth private browsing mode
- if (QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- return true;
-
- if (rApp->mainWindowList().count() > 1)
- {
- int answer = KMessageBox::questionYesNoCancel(
- this,
- 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:
- return true;
-
- case KMessageBox::No:
- rApp->quit();
- return true;
-
- default:
- return false;
- }
- }
- emit lastWindowClosed();
- return true;
-}
-
-
void MainWindow::saveNewToolbarConfig()
{
KXmlGuiWindow::saveNewToolbarConfig();
@@ -1586,3 +1550,10 @@ void MainWindow::setEditable(bool on)
{
currentTab()->page()->setContentEditable(on);
}
+
+
+bool MainWindow::close()
+{
+ emit windowClosing();
+ return KMainWindow::close();
+}