equal
deleted
inserted
replaced
16 */ |
16 */ |
17 |
17 |
18 #include <hbtoolbar.h> |
18 #include <hbtoolbar.h> |
19 #include <hbnotificationdialog.h> |
19 #include <hbnotificationdialog.h> |
20 #include <hbaction.h> |
20 #include <hbaction.h> |
|
21 #include <hbapplication.h> |
|
22 #include <hbactivitymanager.h> |
21 |
23 |
22 #include "HelpBaseView.h" |
24 #include "HelpBaseView.h" |
23 #include "HelpCategoryView.h" |
25 #include "HelpCategoryView.h" |
24 #include "HelpKeywordView.h" |
26 #include "HelpKeywordView.h" |
25 #include "HelpContentsView.h" |
27 #include "HelpContentsView.h" |
30 HelpMainWindow::HelpMainWindow() : |
32 HelpMainWindow::HelpMainWindow() : |
31 mCategoryView(NULL), |
33 mCategoryView(NULL), |
32 mKeywordView(NULL), |
34 mKeywordView(NULL), |
33 mContentsView(NULL) |
35 mContentsView(NULL) |
34 { |
36 { |
|
37 QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); |
35 activateCategoryView(); |
38 activateCategoryView(); |
36 } |
39 } |
37 |
40 |
38 HelpMainWindow::~HelpMainWindow() |
41 HelpMainWindow::~HelpMainWindow() |
39 { |
42 { |
127 { |
130 { |
128 activateKeywordView(); |
131 activateKeywordView(); |
129 mKeywordView->loadAllContent(); |
132 mKeywordView->loadAllContent(); |
130 } |
133 } |
131 |
134 |
|
135 void HelpMainWindow::saveActivity() |
|
136 { |
|
137 HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
|
138 |
|
139 // clean up any previous versions of this activity from the activity manager. |
|
140 bool ok = activityManager->removeActivity("UserGuideMainView"); |
|
141 if ( !ok ) |
|
142 { |
|
143 //qFatal("Remove failed" ); |
|
144 } |
|
145 |
|
146 // get a screenshot for saving to the activity manager |
|
147 QVariantHash metadata; |
|
148 metadata.insert("screenshot", QPixmap::grabWidget(this, rect())); |
|
149 |
|
150 // save any data necessary to save the state |
|
151 QByteArray serializedActivity; |
|
152 QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); |
|
153 stream << "whatever data you need to save the state adequately"; |
|
154 |
|
155 // add the activity to the activity manager |
|
156 ok = activityManager->addActivity("UserGuideMainView", serializedActivity, metadata); |
|
157 if ( !ok ) |
|
158 { |
|
159 qFatal("Add failed" ); |
|
160 } |
|
161 } |
|
162 |
132 // end of file |
163 // end of file |
133 |
164 |