diff options
| author | Andrea Diamantini <adjam7@gmail.com> | 2010-05-16 11:49:52 +0200 | 
|---|---|---|
| committer | Andrea Diamantini <adjam7@gmail.com> | 2010-05-16 11:49:52 +0200 | 
| commit | a99e044b51fa43517d6faa678924fdfe2b0206bf (patch) | |
| tree | 19cec498ad5a06eaaad3b8699c1c7f38d569cd06 /src | |
| parent | Merge commit 'refs/merge-requests/2259' of git://gitorious.org/rekonq/mainlin... (diff) | |
| parent | Adds current tab to session state (bug 237720) (diff) | |
| download | rekonq-a99e044b51fa43517d6faa678924fdfe2b0206bf.tar.xz | |
Merge commit 'refs/merge-requests/2262' of git://gitorious.org/rekonq/mainline into m2262
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainview.cpp | 1 | ||||
| -rw-r--r-- | src/sessionmanager.cpp | 27 | 
2 files changed, 27 insertions, 1 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 4fbd5959..58247d53 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -123,6 +123,7 @@ void MainView::postLaunch()      // Session Manager      connect(this, SIGNAL(tabsChanged()), Application::sessionManager(), SLOT(saveSession())); +    connect(this, SIGNAL(currentChanged(int)), Application::sessionManager(), SLOT(saveSession()));      m_addTabButton->setDefaultAction(m_parentWindow->actionByName("new_tab")); diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 6aada509..97d9bc36 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -35,6 +35,7 @@  #include "mainwindow.h"  #include "mainview.h"  #include "webtab.h" +#include "tabbar.h"  // KDE Includes  #include <KStandardDirs> @@ -79,6 +80,10 @@ void SessionManager::saveSession()          {              out << mv->webTab(i)->url().toEncoded() << "\n";          } +         +        // Current Tab for window +        out << "currenttab\n"; +        out << mv->tabBar()->currentIndex() << "\n";      }      sessionFile.close();      m_safe = true; @@ -108,10 +113,30 @@ bool SessionManager::restoreSession()              kDebug() << "New Window line: " << line;              Application::instance()->loadUrl( KUrl(line), Rekonq::NewWindow);          } +        else if (line == QString("currenttab")) +        { +	  kDebug() << "Set Current Tab Line" << endl; +	  line = in.readLine(); +	  bool ok; +	  int idx = line.toInt(&ok); +	  if (ok) +	  { +	    kDebug() << "Setting current tab to " << idx << endl; +	    // Get last mainwindow created which will be first one in mainwindow list +	    MainWindowList wl = Application::instance()->mainWindowList(); +	    if (wl.count() > 0) +	    { +	      MainView *mv = wl[0].data()->mainView(); +	      emit mv->tabBar()->setCurrentIndex(idx); +	    }	     +	  } +	  else +	    kDebug() << "Failed to convert currenttab index line <" << line << "> to in value" << endl; +	}          else          {              kDebug() << "New Current Tab line: " << line; -            Application::instance()->loadUrl( KUrl(line), Rekonq::NewCurrentTab); +	    Application::instance()->loadUrl( KUrl(line), Rekonq::NewCurrentTab);          }      }      while (!line.isEmpty());  | 
