22 #include <HbView> |
22 #include <HbView> |
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 |
|
28 #include <hbactivitymanager> // hbactivitymanager |
27 |
29 |
28 // User includes |
30 // User includes |
29 #include "notesviewmanager.h" |
31 #include "notesviewmanager.h" |
30 #include "notesmainview.h" |
32 #include "notesmainview.h" |
31 #include "notescollectionview.h" |
33 #include "notescollectionview.h" |
57 { |
59 { |
58 HbMainWindow *window = hbInstance->allMainWindows().first(); |
60 HbMainWindow *window = hbInstance->allMainWindows().first(); |
59 |
61 |
60 mAgendaUtil = mAppControllerIf.agendaUtil(); |
62 mAgendaUtil = mAppControllerIf.agendaUtil(); |
61 |
63 |
|
64 // Check the Application Startup reason from Activity Manager |
|
65 int activityReason = qobject_cast<HbApplication*>(qApp)->activateReason(); |
|
66 |
|
67 if (Hb::ActivationReasonActivity == activityReason) // Check if application is started |
|
68 // from an application |
|
69 { |
|
70 // Application is started from an activity |
|
71 // extract activity data |
|
72 QVariant data = qobject_cast<HbApplication*>(qApp)->activateData(); |
|
73 // Restore state from activity data |
|
74 QByteArray serializedModel = data.toByteArray(); |
|
75 QDataStream stream(&serializedModel, QIODevice::ReadOnly); |
|
76 int viewId; |
|
77 stream >> viewId; // read stream into an int |
|
78 |
|
79 if (NotesNamespace::NotesMainViewId == viewId) // Check if viewId is main view |
|
80 { |
|
81 // Load MainView |
|
82 loadNotesMainView(); |
|
83 } |
|
84 else if (NotesNamespace::NotesCollectionViewId == viewId) // Check if the viewId is collective view |
|
85 { |
|
86 //no implementation yet, UI Specs not available |
|
87 } |
|
88 } |
|
89 else // application started by either service framework or normally |
|
90 { |
|
91 // Load the main view at the start up. |
|
92 loadNotesMainView(); |
|
93 } |
|
94 |
62 connect( |
95 connect( |
63 mAgendaUtil, SIGNAL(instanceViewCreationCompleted(int)), |
96 mAgendaUtil, SIGNAL(instanceViewCreationCompleted(int)), |
64 this,SLOT(handleInstanceViewCreationCompleted(int))); |
97 this,SLOT(handleInstanceViewCreationCompleted(int))); |
65 |
|
66 // Load the main view at the start up. |
|
67 loadNotesMainView(); |
|
68 |
98 |
69 // Delay loading of other views till main view is loaded. |
99 // Delay loading of other views till main view is loaded. |
70 connect( |
100 connect( |
71 window, SIGNAL(viewReady()), |
101 window, SIGNAL(viewReady()), |
72 this, SLOT(loadOtherViews())); |
102 this, SLOT(loadOtherViews())); |
92 switch (viewId) { |
122 switch (viewId) { |
93 case NotesNamespace::NotesMainViewId: |
123 case NotesNamespace::NotesMainViewId: |
94 window->removeView(window->currentView()); |
124 window->removeView(window->currentView()); |
95 window->addView(mMainView); |
125 window->addView(mMainView); |
96 window->setCurrentView(mMainView); |
126 window->setCurrentView(mMainView); |
|
127 mMainView->captureScreenShot(false); |
97 break; |
128 break; |
98 |
129 |
99 case NotesNamespace::NotesCollectionViewId: |
130 case NotesNamespace::NotesCollectionViewId: |
|
131 if (mMainView) |
|
132 { |
|
133 if (mMainView == window->currentView()) |
|
134 { |
|
135 mMainView->captureScreenShot(true); |
|
136 } |
|
137 } |
100 window->removeView(window->currentView()); |
138 window->removeView(window->currentView()); |
101 window->addView(mCollectionView); |
139 window->addView(mCollectionView); |
102 window->setCurrentView(mCollectionView); |
140 window->setCurrentView(mCollectionView); |
103 break; |
141 break; |
104 |
142 |
105 case NotesNamespace::NotesTodoViewId: |
143 case NotesNamespace::NotesTodoViewId: |
|
144 if (mMainView) |
|
145 { |
|
146 if (mMainView == window->currentView()) |
|
147 { |
|
148 mMainView->captureScreenShot(true); |
|
149 } |
|
150 } |
|
151 |
106 window->removeView(window->currentView()); |
152 window->removeView(window->currentView()); |
107 window->addView(mTodoView); |
153 window->addView(mTodoView); |
108 window->setCurrentView(mTodoView); |
154 window->setCurrentView(mTodoView); |
109 break; |
155 break; |
110 |
156 |
111 case NotesNamespace::NotesFavoritesViewId: |
157 case NotesNamespace::NotesFavoritesViewId: |
|
158 if (mMainView) |
|
159 { |
|
160 if (mMainView == window->currentView()) |
|
161 { |
|
162 mMainView->captureScreenShot(true); |
|
163 } |
|
164 } |
|
165 |
112 window->removeView(window->currentView()); |
166 window->removeView(window->currentView()); |
113 window->addView(mFavoriteView); |
167 window->addView(mFavoriteView); |
114 window->setCurrentView(mFavoriteView); |
168 window->setCurrentView(mFavoriteView); |
115 break; |
169 break; |
116 |
170 |
117 case NotesNamespace::NotesNoteViewId: |
171 case NotesNamespace::NotesNoteViewId: |
|
172 if (mMainView) |
|
173 { |
|
174 if (mMainView == window->currentView()) |
|
175 { |
|
176 mMainView->captureScreenShot(true); |
|
177 } |
|
178 } |
|
179 |
118 window->removeView(window->currentView()); |
180 window->removeView(window->currentView()); |
119 window->addView(mNoteView); |
181 window->addView(mNoteView); |
120 window->setCurrentView(mNoteView); |
182 window->setCurrentView(mNoteView); |
121 break; |
183 break; |
122 |
184 |
339 // Populate collections view. |
401 // Populate collections view. |
340 mCollectionView->populateListView(); |
402 mCollectionView->populateListView(); |
341 |
403 |
342 // Update the title for to-do view. |
404 // Update the title for to-do view. |
343 mTodoView->updateTitle(); |
405 mTodoView->updateTitle(); |
|
406 |
|
407 // Update the plain notes view. |
|
408 mNoteView->updateNoteView(); |
|
409 |
|
410 // Update the favorites view. |
|
411 mFavoriteView->updateFavoriteView(); |
344 } |
412 } |
345 // End of file --Don't remove this. |
413 // End of file --Don't remove this. |