33 mCategoryView(NULL), |
33 mCategoryView(NULL), |
34 mKeywordView(NULL), |
34 mKeywordView(NULL), |
35 mContentsView(NULL) |
35 mContentsView(NULL) |
36 { |
36 { |
37 QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); |
37 QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); |
|
38 HelpDataProvider::instance()->createHelpCategory(); |
38 activateCategoryView(); |
39 activateCategoryView(); |
39 } |
40 } |
40 |
41 |
41 HelpMainWindow::~HelpMainWindow() |
42 HelpMainWindow::~HelpMainWindow() |
42 { |
43 { |
132 mKeywordView->loadAllContent(); |
134 mKeywordView->loadAllContent(); |
133 } |
135 } |
134 |
136 |
135 void HelpMainWindow::saveActivity() |
137 void HelpMainWindow::saveActivity() |
136 { |
138 { |
137 HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
139 HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
138 |
140 |
139 // clean up any previous versions of this activity from the activity manager. |
141 // clean up any previous versions of this activity from the activity manager. |
140 bool ok = activityManager->removeActivity("UserGuideMainView"); |
142 bool ok = activityManager->removeActivity("UserGuideMainView"); |
141 if ( !ok ) |
143 if ( !ok ) |
142 { |
144 { |
143 //qFatal("Remove failed" ); |
145 //qFatal("Remove failed" ); |
144 } |
146 } |
145 |
147 |
146 // get a screenshot for saving to the activity manager |
148 // get a screenshot for saving to the activity manager |
147 QVariantHash metadata; |
149 QVariantHash metadata; |
148 metadata.insert("screenshot", QPixmap::grabWidget(this, rect())); |
150 metadata.insert("screenshot", QPixmap::grabWidget(this, rect())); |
149 |
151 |
150 // save any data necessary to save the state |
152 // save any data necessary to save the state |
151 QByteArray serializedActivity; |
153 QByteArray serializedActivity; |
152 QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); |
154 QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); |
153 stream << "whatever data you need to save the state adequately"; |
|
154 |
155 |
155 // add the activity to the activity manager |
156 // add the activity to the activity manager |
156 ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata); |
157 ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata); |
157 if ( !ok ) |
158 if ( !ok ) |
158 { |
159 { |
159 qFatal("Add failed" ); |
160 qFatal("Add failed" ); |
160 } |
161 } |
161 } |
162 } |
162 |
163 |
163 // end of file |
164 // end of file |
164 |
165 |