diff -r e70b37c1a9d5 -r 3ae60d69bf22 userguide/src/HelpMainWindow.cpp --- a/userguide/src/HelpMainWindow.cpp Fri Jun 11 16:23:42 2010 +0100 +++ b/userguide/src/HelpMainWindow.cpp Thu Jul 22 16:30:58 2010 +0100 @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "HelpBaseView.h" #include "HelpCategoryView.h" @@ -32,6 +34,8 @@ mKeywordView(NULL), mContentsView(NULL) { + QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); + HelpDataProvider::instance()->createHelpCategory(); activateCategoryView(); } @@ -59,6 +63,7 @@ } break; default: + HbApplication::exit(); break; } } @@ -129,5 +134,32 @@ mKeywordView->loadAllContent(); } +void HelpMainWindow::saveActivity() +{ + HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); + + // clean up any previous versions of this activity from the activity manager. + bool ok = activityManager->removeActivity("UserGuideMainView"); + if ( !ok ) + { + //qFatal("Remove failed" ); + } + + // get a screenshot for saving to the activity manager + QVariantHash metadata; + metadata.insert("screenshot", QPixmap::grabWidget(this, rect())); + + // save any data necessary to save the state + QByteArray serializedActivity; + QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); + + // add the activity to the activity manager + ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata); + if ( !ok ) + { + qFatal("Add failed" ); + } +} + // end of file