diff -r 99b096216bc8 -r 1038206aa0cb userguide/src/HelpMainWindow.cpp --- a/userguide/src/HelpMainWindow.cpp Fri Jun 11 13:29:58 2010 +0300 +++ b/userguide/src/HelpMainWindow.cpp Wed Jun 23 18:03:20 2010 +0300 @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "HelpBaseView.h" #include "HelpCategoryView.h" @@ -32,6 +34,7 @@ mKeywordView(NULL), mContentsView(NULL) { + QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); activateCategoryView(); } @@ -129,5 +132,33 @@ 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); + stream << "whatever data you need to save the state adequately"; + + // add the activity to the activity manager + ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata); + if ( !ok ) + { + qFatal("Add failed" ); + } +} + // end of file