diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2012-10-14 20:59:18 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2012-12-10 02:48:05 +0100 |
commit | 2809822c951ac8c835fea5e218c6fe1a8126f3eb (patch) | |
tree | b656af9280debe34c212da464697c630cbdde771 | |
parent | document mode (diff) | |
download | rekonq-2809822c951ac8c835fea5e218c6fe1a8126f3eb.tar.xz |
Fix opening when there are no pinned tabs
-rw-r--r-- | src/application.cpp | 4 | ||||
-rw-r--r-- | src/sessionmanager.cpp | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/application.cpp b/src/application.cpp index 4f6f9651..1ac66188 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -146,8 +146,8 @@ int Application::newInstance() { restoreOk = SessionManager::self()->restoreJustThePinnedTabs(); } - - isFirstLoad = restoreOk; + + isFirstLoad = !restoreOk; } // first argument: 99% of the time we have just that... diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 7e13388e..58e9f19e 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -82,7 +82,7 @@ int loadTabs(TabWindow *tw, QDomElement & window, bool useFirstTab, bool justThe { QDomElement tab = window.elementsByTagName("tab").at(tabNo).toElement(); bool tabIsPinned = tab.hasAttribute("pinned"); - kDebug() << "Tab # " << tabNo << " is pinned? " << tabIsPinned; + kDebug() << "Tab #" << tabNo << " is pinned? " << tabIsPinned; if (!justThePinnedOnes || tabIsPinned) { @@ -118,6 +118,20 @@ int loadTabs(TabWindow *tw, QDomElement & window, bool useFirstTab, bool justThe } +bool areTherePinnedTabs(QDomElement & window) +{ + bool b = false; + + for (unsigned int tabNo = 0; tabNo < window.elementsByTagName("tab").length(); tabNo++) + { + QDomElement tab = window.elementsByTagName("tab").at(tabNo).toElement(); + b = tab.hasAttribute("pinned"); + } + + return b; +} + + // ------------------------------------------------------------------------------------------------- @@ -256,9 +270,12 @@ bool SessionManager::restoreJustThePinnedTabs() bool done = false; for (unsigned int winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++) { - done = true; QDomElement window = document.elementsByTagName("window").at(winNo).toElement(); + if (!areTherePinnedTabs(window)) + continue; + + done = true; TabWindow *tw = rApp->newTabWindow(); int currentTab = loadTabs(tw, window, true, true); |