20 #include <HbMainWindow> |
20 #include <HbMainWindow> |
21 #include <HbInstance> |
21 #include <HbInstance> |
22 #include <HbApplication> |
22 #include <HbApplication> |
23 #include <HbActivityManager> |
23 #include <HbActivityManager> |
24 #include <HbToolBar> |
24 #include <HbToolBar> |
|
25 #include <AfActivation.h> |
|
26 #include <AfActivityStorage.h> |
25 |
27 |
26 // User includes |
28 // User includes |
27 #include "clockviewmanager.h" |
29 #include "clockviewmanager.h" |
28 #include "clockdocloader.h" |
30 #include "clockdocloader.h" |
29 #include "clockmainview.h" |
31 #include "clockmainview.h" |
54 mAppControllerIf(controllerIf), |
56 mAppControllerIf(controllerIf), |
55 mWorldClockView(0) |
57 mWorldClockView(0) |
56 { |
58 { |
57 OstTraceFunctionEntry0( CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_ENTRY ); |
59 OstTraceFunctionEntry0( CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_ENTRY ); |
58 // Activity Reason from Activity Manager |
60 // Activity Reason from Activity Manager |
59 int activityReason = qobject_cast<HbApplication*>(qApp)->activateReason(); |
61 AfActivation *activation = new AfActivation(); |
60 |
62 |
61 if (Hb::ActivationReasonActivity == activityReason) { |
63 if (Af::ActivationReasonActivity == activation->reason()) { |
62 // Application is started from an activity |
64 // Application is started from an activity |
63 // extract activity data |
65 // extract activity data |
64 QVariant data = qobject_cast<HbApplication*>(qApp)->activateData(); |
66 AfActivityStorage *activitystorage = new AfActivityStorage(); |
|
67 QVariant data = activitystorage->activityData(activation->name()); |
|
68 delete activitystorage; |
65 // restore state from activity data |
69 // restore state from activity data |
66 QByteArray serializedModel = data.toByteArray(); |
70 QByteArray serializedModel = data.toByteArray(); |
67 QDataStream stream(&serializedModel, QIODevice::ReadOnly); |
71 QDataStream stream(&serializedModel, QIODevice::ReadOnly); |
68 int activityId; |
72 int activityId; |
69 stream >> activityId; |
73 stream >> activityId; |
90 HbMainWindow *window = hbInstance->allMainWindows().first(); |
94 HbMainWindow *window = hbInstance->allMainWindows().first(); |
91 connect( |
95 connect( |
92 window, SIGNAL(viewReady()), |
96 window, SIGNAL(viewReady()), |
93 this, SLOT(loadOtherViews())); |
97 this, SLOT(loadOtherViews())); |
94 } |
98 } |
95 |
99 delete activation; |
96 OstTraceFunctionExit0( CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_EXIT ); |
100 OstTraceFunctionExit0( CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_EXIT ); |
97 } |
101 } |
98 |
102 |
99 /*! |
103 /*! |
100 Destructor. |
104 Destructor. |