23 #include <HbInstance> |
23 #include <HbInstance> |
24 #include <HbListView> |
24 #include <HbListView> |
25 #include <HbMessageBox> |
25 #include <HbMessageBox> |
26 #include <HbAction> |
26 #include <HbAction> |
27 #include <hbapplication> // hbapplication |
27 #include <hbapplication> // hbapplication |
28 #include <hbactivitymanager> // hbactivitymanager |
28 #include <AfActivation.h> |
|
29 #include <AfActivityStorage.h> |
29 |
30 |
30 // User includes |
31 // User includes |
31 #include "notesviewmanager.h" |
32 #include "notesviewmanager.h" |
32 #include "notesmainview.h" |
33 #include "notesmainview.h" |
33 #include "notescollectionview.h" |
34 #include "notescollectionview.h" |
72 HbMainWindow *window = hbInstance->allMainWindows().first(); |
73 HbMainWindow *window = hbInstance->allMainWindows().first(); |
73 |
74 |
74 mAgendaUtil = mAppControllerIf.agendaUtil(); |
75 mAgendaUtil = mAppControllerIf.agendaUtil(); |
75 |
76 |
76 // Check the Application Startup reason from Activity Manager |
77 // Check the Application Startup reason from Activity Manager |
77 int activityReason = qobject_cast<HbApplication*>(qApp)->activateReason(); |
78 AfActivation *activation = new AfActivation(); |
78 |
79 |
79 // Check if application is started from an application |
80 // Check if application is started from an application |
80 if (Hb::ActivationReasonActivity == activityReason) { |
81 if (Af::ActivationReasonActivity == activation->reason()) { |
81 // Application is started from an activity |
82 // Application is started from an activity |
82 // extract activity data |
83 // extract activity data |
83 QVariant data = qobject_cast<HbApplication*>(qApp)->activateData(); |
84 AfActivityStorage *activitystorage = new AfActivityStorage(); |
|
85 QVariant data = activitystorage->activityData(activation->name()); |
|
86 delete activitystorage; |
84 // Restore state from activity data |
87 // Restore state from activity data |
85 QByteArray serializedModel = data.toByteArray(); |
88 QByteArray serializedModel = data.toByteArray(); |
86 QDataStream stream(&serializedModel, QIODevice::ReadOnly); |
89 QDataStream stream(&serializedModel, QIODevice::ReadOnly); |
87 int viewId; |
90 int viewId; |
88 stream >> viewId; // read stream into an int |
91 stream >> viewId; // read stream into an int |
98 } else { |
101 } else { |
99 // application started by either service framework or normally |
102 // application started by either service framework or normally |
100 // Load the main view at the start up. |
103 // Load the main view at the start up. |
101 loadNotesMainView(); |
104 loadNotesMainView(); |
102 } |
105 } |
103 |
106 //delet the activity instance |
|
107 delete activation; |
104 connect( |
108 connect( |
105 mAgendaUtil, SIGNAL(instanceViewCreationCompleted(int)), |
109 mAgendaUtil, SIGNAL(instanceViewCreationCompleted(int)), |
106 this,SLOT(handleInstanceViewCreationCompleted(int))); |
110 this,SLOT(handleInstanceViewCreationCompleted(int))); |
107 |
111 |
108 // Delay loading of other views till main view is loaded. |
112 // Delay loading of other views till main view is loaded. |