diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-09-10 21:59:09 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-09-10 21:59:09 +0200 |
commit | cfbfe4ba48c747772e86018df41f6970fc007b11 (patch) | |
tree | 6bafe57c475a724866afa0b807b22508f3be9d6f /src/application.cpp | |
parent | Webkit -> WebKit (diff) | |
download | rekonq-cfbfe4ba48c747772e86018df41f6970fc007b11.tar.xz |
Session Management (restore on crash)
This is HEAVILY based on code from Lionel and Yoram branches.
But this code behaves differently: it restores rekonq tabs (just) on crash.
Thanks to Lionel suggestions, it seems "better" than my initial idea :)
It is quite extensible. We need just to fix it better as possible and then
manage its behaviour in newInstance code.. ;)
Diffstat (limited to 'src/application.cpp')
-rw-r--r-- | src/application.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/application.cpp b/src/application.cpp index 8324d212..1e30cfd0 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -41,6 +41,7 @@ #include "mainview.h" #include "webview.h" #include "urlbar.h" +#include "sessionmanager.h" // KDE Includes #include <KCmdLineArgs> @@ -62,6 +63,7 @@ QPointer<HistoryManager> Application::s_historyManager; QPointer<NetworkAccessManager> Application::s_networkAccessManager; QPointer<BookmarkProvider> Application::s_bookmarkProvider; +QPointer<SessionManager> Application::s_sessionManager; @@ -82,6 +84,11 @@ Application::~Application() int Application::newInstance() { + if( isSessionRestored() && sessionManager()->restoreSession() ) + { + return 1; + } + KCmdLineArgs::setCwd(QDir::currentPath().toUtf8()); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); @@ -141,6 +148,7 @@ void Application::postLaunch() QWebSettings::setIconDatabasePath(directory); Application::historyManager(); + Application::sessionManager(); } @@ -208,6 +216,16 @@ BookmarkProvider *Application::bookmarkProvider() } +SessionManager *Application::sessionManager() +{ + if(!s_sessionManager) + { + s_sessionManager = new SessionManager(instance()); + } + return s_sessionManager; +} + + KIcon Application::icon(const KUrl &url) { KIcon icon; @@ -384,3 +402,8 @@ MainWindow *Application::newMainWindow() return w; } + +MainWindowList Application::mainWindowList() +{ + return m_mainWindows; +} |