summaryrefslogtreecommitdiff
path: root/src/sessionmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sessionmanager.cpp')
-rw-r--r--src/sessionmanager.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index f4e7cd3e..0b50791d 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -2,9 +2,9 @@
*
* This file is a part of the rekonq project
*
-* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2009-2010 by Andrea Diamantini <adjam7 at gmail dot com>
* Copyright (C) 2009 by Yoram Bar-Haim <<yoram.b at zend dot com>
-* Copyright (C) 2009 by Lionel Chauvin <megabigbug@yahoo.fr>
+* Copyright (C) 2009-2010 by Lionel Chauvin <megabigbug@yahoo.fr>
*
*
* This program is free software; you can redistribute it and/or
@@ -38,16 +38,16 @@
// KDE Includes
#include <KStandardDirs>
-#include <KDebug>
// Qt Includes
-#include <QFile>
-#include <QTextStream>
+#include <QtCore/QFile>
+#include <QtCore/QTextStream>
+
SessionManager::SessionManager(QObject *parent)
- : QObject(parent)
- , m_safe(true)
+ : QObject(parent)
+ , m_safe(true)
{
m_sessionFilePath = KStandardDirs::locateLocal("appdata" , "session");
}
@@ -60,21 +60,21 @@ SessionManager::~SessionManager()
void SessionManager::saveSession()
{
- if(!m_safe)
+ if (!m_safe)
return;
m_safe = false;
QFile sessionFile(m_sessionFilePath);
if (!sessionFile.open(QFile::WriteOnly | QFile::Truncate))
{
- kWarning() << "Unable to open session file" << sessionFile.fileName();
+ kDebug() << "Unable to open session file" << sessionFile.fileName();
return;
}
QTextStream out(&sessionFile);
MainWindowList wl = Application::instance()->mainWindowList();
- Q_FOREACH(QPointer<MainWindow> w, wl)
+ Q_FOREACH(const QWeakPointer<MainWindow> &w, wl)
{
out << "window\n";
- MainView *mv = w->mainView();
+ MainView *mv = w.data()->mainView();
for (int i = 0 ; i < mv->count() ; i++)
{
out << mv->webTab(i)->url().toEncoded() << "\n";
@@ -93,7 +93,7 @@ bool SessionManager::restoreSession()
return false;
if (!sessionFile.open(QFile::ReadOnly))
{
- kWarning() << "Unable to open session file" << sessionFile.fileName();
+ kDebug() << "Unable to open session file" << sessionFile.fileName();
return false;
}
@@ -102,18 +102,19 @@ bool SessionManager::restoreSession()
do
{
line = in.readLine();
- if(line == QString("window"))
+ if (line == QString("window"))
{
- Application::instance()->newMainWindow();
line = in.readLine();
- Application::instance()->loadUrl(line);
+ kDebug() << "New Window line: " << line;
+ Application::instance()->loadUrl(line, Rekonq::NewWindow);
}
else
{
+ kDebug() << "New Current Tab line: " << line;
Application::instance()->loadUrl(line, Rekonq::NewCurrentTab);
}
}
- while(!line.isNull());
-
+ while (!line.isEmpty());
+
return true;
}