summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp15
-rw-r--r--src/sessionmanager.cpp33
-rw-r--r--src/sessionmanager.h2
3 files changed, 46 insertions, 4 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index e703976d..84b87956 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -109,6 +109,18 @@ MainView::~MainView()
void MainView::postLaunch()
{
+ QStringList list = Application::sessionManager()->closedSites();
+ foreach(const QString &line, list)
+ {
+ if(line.startsWith( QL1S("about") ))
+ break;
+ QString title = line;
+ QString url = title;
+ HistoryItem item(url, QDateTime::currentDateTime(), title);
+ m_recentlyClosedTabs.removeAll(item);
+ m_recentlyClosedTabs.prepend(item);
+ }
+
// Session Manager
connect(this, SIGNAL(tabsChanged()), Application::sessionManager(), SLOT(saveSession()));
@@ -493,8 +505,7 @@ void MainView::closeTab(int index, bool del)
return;
}
- // store close tab except homepage
- if (!tab->url().prettyUrl().startsWith(QL1S("about:")) && !tab->url().isEmpty())
+ if (!tab->url().isEmpty())
{
QString title = tab->view()->title();
QString url = tab->url().prettyUrl();
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index 0b50791d..6aada509 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -106,15 +106,44 @@ bool SessionManager::restoreSession()
{
line = in.readLine();
kDebug() << "New Window line: " << line;
- Application::instance()->loadUrl(line, Rekonq::NewWindow);
+ Application::instance()->loadUrl( KUrl(line), Rekonq::NewWindow);
}
else
{
kDebug() << "New Current Tab line: " << line;
- Application::instance()->loadUrl(line, Rekonq::NewCurrentTab);
+ Application::instance()->loadUrl( KUrl(line), Rekonq::NewCurrentTab);
}
}
while (!line.isEmpty());
return true;
}
+
+
+QStringList SessionManager::closedSites()
+{
+ QStringList list;
+
+ QFile sessionFile(m_sessionFilePath);
+ if (!sessionFile.exists())
+ return list;
+ if (!sessionFile.open(QFile::ReadOnly))
+ {
+ kDebug() << "Unable to open session file" << sessionFile.fileName();
+ return list;
+ }
+
+ QTextStream in(&sessionFile);
+ QString line;
+ do
+ {
+ line = in.readLine();
+ if (line != QString("window"))
+ {
+ list << QString(line);
+ }
+ }
+ while (!line.isEmpty());
+
+ return list;
+}
diff --git a/src/sessionmanager.h b/src/sessionmanager.h
index 7960fc3e..a446b530 100644
--- a/src/sessionmanager.h
+++ b/src/sessionmanager.h
@@ -49,6 +49,8 @@ public:
~SessionManager();
bool restoreSession();
+ QStringList closedSites();
+
private slots:
void saveSession();