summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-12-28 15:13:11 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-12-28 15:13:11 +0100
commit1dbb045f0e374ef78a76086912d2ca3dac6cedeb (patch)
treeca16fe8d7bc418f7db68e344f5825cab80eb163e
parentIconManager, small cleanup: use (QWeb)Frames instead of pages. (diff)
downloadrekonq-1dbb045f0e374ef78a76086912d2ca3dac6cedeb.tar.xz
Session Management clean up
PS: ignore about urls in the session manager
-rw-r--r--src/application.cpp13
-rw-r--r--src/sessionmanager.cpp22
2 files changed, 17 insertions, 18 deletions
diff --git a/src/application.cpp b/src/application.cpp
index f5547fa2..942e0876 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -185,7 +185,7 @@ int Application::newInstance()
// so, we have 8 possible cases...
bool isFirstLoad = m_mainWindows.isEmpty();
bool areThereArguments = (args->count() > 0);
- bool isRekonqCrashed = ReKonfig::recoverOnCrash();
+ bool isRekonqCrashed = (ReKonfig::recoverOnCrash() > 0);
// note that isRekonqCrashed is always true if it is not the first load
// !isFirstLoad -> isRekonqCrashed
@@ -198,6 +198,7 @@ int Application::newInstance()
if (isRekonqCrashed && isFirstLoad)
{
loadUrl(KUrl("about:closedTabs"), Rekonq::NewWindow);
+ mainWindow()->currentTab()->showMessageBar();
}
if (areThereArguments)
@@ -213,7 +214,7 @@ int Application::newInstance()
}
// first argument: 99% of the time we have just that...
- if (isFirstLoad && !isRekonqCrashed)
+ if (isFirstLoad)
{
// No windows in the current desktop? No windows at all?
// Create a new one and load there sites...
@@ -245,8 +246,6 @@ int Application::newInstance()
for (int i = 1; i < urlList.count(); ++i)
loadUrl(urlList.at(i), Rekonq::NewWindow);
}
-
- KStartupInfo::appStarted();
}
else
{
@@ -308,15 +307,11 @@ int Application::newInstance()
connect(bookmarkManager(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&)));
- // crash recovering
- if (ReKonfig::recoverOnCrash())
- {
- mainWindow()->currentTab()->showMessageBar();
- }
ReKonfig::setRecoverOnCrash(ReKonfig::recoverOnCrash() + 1);
saveConfiguration();
}
+ KStartupInfo::appStarted();
return exitValue;
}
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
index 04b67a89..20b35016 100644
--- a/src/sessionmanager.cpp
+++ b/src/sessionmanager.cpp
@@ -77,12 +77,19 @@ void SessionManager::saveSession()
{
MainView *mv = w.data()->mainView();
QDomElement window = document.createElement("window");
+ int tabInserted = 0;
for (signed int tabNo = 0; tabNo < mv->count(); tabNo++)
{
+ // IGNORE about urls
+ KUrl u = mv->webTab(tabNo)->url();
+ if (u.protocol() == QL1S("about"))
+ continue;
+
+ tabInserted++;
QDomElement tab = document.createElement("tab");
tab.setAttribute("title", mv->webTab(tabNo)->view()->title()); // redundant, but needed for closedSites()
// as there's not way to read out the historyData
- tab.setAttribute("url", mv->webTab(tabNo)->url().url()); // Use WebTab's instead of WebView's url() to fix about links
+ tab.setAttribute("url", u.url());
if (mv->tabBar()->currentIndex() == tabNo)
{
tab.setAttribute("currentTab", 1);
@@ -95,7 +102,8 @@ void SessionManager::saveSession()
tab.appendChild(historySection);
window.appendChild(tab);
}
- session.appendChild(window);
+ if (tabInserted > 0)
+ session.appendChild(window);
}
QTextStream TextStream(&sessionFile);
@@ -118,10 +126,6 @@ bool SessionManager::restoreSessionFromScratch()
return false;
}
- bool windowAlreadyOpen = (rApp->mainWindowList().count() == 0) ? false : true;
- if (!windowAlreadyOpen)
- rApp->newMainWindow(false);
-
QDomDocument document("session");
if (!document.setContent(&sessionFile, false))
{
@@ -134,7 +138,7 @@ bool SessionManager::restoreSessionFromScratch()
QDomElement window = document.elementsByTagName("window").at(winNo).toElement();
int currentTab = 0;
- MainView *mv = rApp->mainWindowList().at(0).data()->mainView(); //last mainwindow created will be first one in mainwindow list
+ MainView *mv = rApp->newMainWindow(false)->mainView();
for (unsigned int tabNo = 0; tabNo < window.elementsByTagName("tab").length(); tabNo++)
{
@@ -150,10 +154,10 @@ bool SessionManager::restoreSessionFromScratch()
QDataStream readingStream(&history, QIODevice::ReadOnly);
readingStream >> *(view->history());
- // Get sure about urls are loaded
+ // IGNORE "eventual" about urls
KUrl u = KUrl(tab.attribute("url"));
if (u.protocol() == QL1S("about"))
- view->load(u);
+ continue;
}
mv->tabBar()->setCurrentIndex(currentTab);