summaryrefslogtreecommitdiff
path: root/src/sessionmanager.cpp
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@nokia.com>2010-09-15 21:21:33 +0200
committerPierre Rossi <pierre.rossi@gmail.com>2010-10-08 22:45:02 +0200
commit6181e316ce8cfc1bef05c466a2470427ceb2deac (patch)
tree6f4affcedab1a8e63b29638810ee36851642c298 /src/sessionmanager.cpp
parentMerge branch 'm220' (diff)
downloadrekonq-6181e316ce8cfc1bef05c466a2470427ceb2deac.tar.xz
Prompt user before restoring session after a crash.
Shows the about:closedTabs page in the background. Task: https://bugs.kde.org/show_bug.cgi?id=249228
Diffstat (limited to 'src/sessionmanager.cpp')
-rw-r--r--src/sessionmanager.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index 736dd76c..87f25f43 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -46,7 +46,7 @@
SessionManager::SessionManager(QObject *parent)
: QObject(parent)
- , m_safe(true)
+ , m_safe(false)
{
m_sessionFilePath = KStandardDirs::locateLocal("appdata" , "session");
}
@@ -59,12 +59,10 @@ SessionManager::~SessionManager()
void SessionManager::saveSession()
{
- if (!m_safe)
+ if (!m_safe || QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
return;
m_safe = false;
- if( QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) )
- return;
QFile sessionFile(m_sessionFilePath);
if (!sessionFile.open(QFile::WriteOnly | QFile::Truncate))
@@ -106,13 +104,19 @@ bool SessionManager::restoreSession()
QTextStream in(&sessionFile);
QString line;
+ bool windowAlreadyOpen = Application::instance()->mainWindowList().count();
do
{
line = in.readLine();
if (line == QL1S("window"))
{
line = in.readLine();
- Application::instance()->loadUrl( KUrl(line), Rekonq::NewWindow);
+ if (windowAlreadyOpen) {
+ Application::instance()->loadUrl( KUrl(line), Rekonq::CurrentTab);
+ windowAlreadyOpen = false;
+ } else {
+ Application::instance()->loadUrl( KUrl(line), Rekonq::NewWindow);
+ }
}
else
{