33 #include "calenservices.h" |
33 #include "calenservices.h" |
34 #include "calencontext.h" |
34 #include "calencontext.h" |
35 #include "calensettingsview.h" |
35 #include "calensettingsview.h" |
36 #include "calendateutils.h" |
36 #include "calendateutils.h" |
37 #include "calenconstants.h" |
37 #include "calenconstants.h" |
|
38 #include "OstTraceDefinitions.h" |
|
39 #ifdef OST_TRACE_COMPILER_IN_USE |
|
40 #include "calennativeviewTraces.h" |
|
41 #endif |
|
42 |
38 |
43 |
39 /*! |
44 /*! |
40 \class CalenNativeView |
45 \class CalenNativeView |
41 Base class for all calendar views |
46 Base class for all calendar views |
42 */ |
47 */ |
45 Default constructor. |
50 Default constructor. |
46 */ |
51 */ |
47 CalenNativeView::CalenNativeView(MCalenServices &services) : |
52 CalenNativeView::CalenNativeView(MCalenServices &services) : |
48 mServices(services), mIsCapturedScreenShotValid(false) |
53 mServices(services), mIsCapturedScreenShotValid(false) |
49 { |
54 { |
|
55 OstTraceFunctionEntry0( CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY ); |
|
56 |
50 setTitle(hbTrId("txt_calendar_title_calendar")); |
57 setTitle(hbTrId("txt_calendar_title_calendar")); |
51 |
58 |
52 // Create services API and register for notifications |
59 // Create services API and register for notifications |
53 RArray<TCalenNotification> notificationArray; |
60 RArray<TCalenNotification> notificationArray; |
54 CleanupClosePushL(notificationArray); |
61 CleanupClosePushL(notificationArray); |
58 notificationArray.Append(ECalenNotifyContextChanged); |
65 notificationArray.Append(ECalenNotifyContextChanged); |
59 |
66 |
60 mServices.RegisterForNotificationsL(this, notificationArray); |
67 mServices.RegisterForNotificationsL(this, notificationArray); |
61 |
68 |
62 CleanupStack::PopAndDestroy(¬ificationArray); |
69 CleanupStack::PopAndDestroy(¬ificationArray); |
|
70 |
|
71 OstTraceFunctionExit0( CALENNATIVEVIEW_CALENNATIVEVIEW_EXIT ); |
63 } |
72 } |
64 |
73 |
65 /*! |
74 /*! |
66 Destructor |
75 Destructor |
67 */ |
76 */ |
68 CalenNativeView::~CalenNativeView() |
77 CalenNativeView::~CalenNativeView() |
69 { |
78 { |
|
79 OstTraceFunctionEntry0( DUP1_CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY ); |
|
80 |
|
81 OstTraceFunctionExit0( DUP1_CALENNATIVEVIEW_CALENNATIVEVIEW_EXIT ); |
70 } |
82 } |
71 |
83 |
72 /*! |
84 /*! |
73 Issues populcaiton complete to the framework |
85 Issues populcaiton complete to the framework |
74 */ |
86 */ |
75 void CalenNativeView::populationComplete() |
87 void CalenNativeView::populationComplete() |
76 { |
88 { |
|
89 OstTraceFunctionEntry0( CALENNATIVEVIEW_POPULATIONCOMPLETE_ENTRY ); |
|
90 |
77 // Population is complete, issue the notification |
91 // Population is complete, issue the notification |
78 mServices.IssueNotificationL(ECalenNotifyViewPopulationComplete); |
92 mServices.IssueNotificationL(ECalenNotifyViewPopulationComplete); |
|
93 |
|
94 OstTraceFunctionExit0( CALENNATIVEVIEW_POPULATIONCOMPLETE_EXIT ); |
79 } |
95 } |
80 |
96 |
81 /*! |
97 /*! |
82 Slot for delete before date |
98 Slot for delete before date |
83 */ |
99 */ |
84 void CalenNativeView::deleteBeforeDate() |
100 void CalenNativeView::deleteBeforeDate() |
85 { |
101 { |
|
102 OstTraceFunctionEntry0( CALENNATIVEVIEW_DELETEBEFOREDATE_ENTRY ); |
|
103 |
86 mServices.IssueCommandL(ECalenDeleteEntriesBeforeDate); |
104 mServices.IssueCommandL(ECalenDeleteEntriesBeforeDate); |
|
105 |
|
106 OstTraceFunctionExit0( CALENNATIVEVIEW_DELETEBEFOREDATE_EXIT ); |
87 } |
107 } |
88 |
108 |
89 /*! |
109 /*! |
90 Slot for delete all entries |
110 Slot for delete all entries |
91 */ |
111 */ |
92 void CalenNativeView::deleteAllEntries() |
112 void CalenNativeView::deleteAllEntries() |
93 { |
113 { |
|
114 OstTraceFunctionEntry0( CALENNATIVEVIEW_DELETEALLENTRIES_ENTRY ); |
|
115 |
94 mServices.IssueCommandL(ECalenDeleteAllEntries); |
116 mServices.IssueCommandL(ECalenDeleteAllEntries); |
|
117 |
|
118 OstTraceFunctionExit0( CALENNATIVEVIEW_DELETEALLENTRIES_EXIT ); |
95 } |
119 } |
96 |
120 |
97 /*! |
121 /*! |
98 Slot to handle gotodate |
122 Slot to handle gotodate |
99 */ |
123 */ |
100 void CalenNativeView::goToDate() |
124 void CalenNativeView::goToDate() |
101 { |
125 { |
|
126 OstTraceFunctionEntry0( CALENNATIVEVIEW_GOTODATE_ENTRY ); |
|
127 |
102 // Create a popup with datepicker for the user to select date. |
128 // Create a popup with datepicker for the user to select date. |
103 HbDialog *popUp = new HbDialog(); |
129 HbDialog *popUp = new HbDialog(); |
104 popUp->setDismissPolicy(HbDialog::NoDismiss); |
130 popUp->setDismissPolicy(HbDialog::NoDismiss); |
105 popUp->setTimeout(HbDialog::NoTimeout); |
131 popUp->setTimeout(HbDialog::NoTimeout); |
106 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
132 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
119 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok")); |
145 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok")); |
120 popUp->addAction(okAction); |
146 popUp->addAction(okAction); |
121 connect(okAction, SIGNAL(triggered()), this, SLOT(goToSelectedDate())); |
147 connect(okAction, SIGNAL(triggered()), this, SLOT(goToSelectedDate())); |
122 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
148 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
123 popUp->open(); |
149 popUp->open(); |
|
150 |
|
151 OstTraceFunctionExit0( CALENNATIVEVIEW_GOTODATE_EXIT ); |
124 } |
152 } |
125 |
153 |
126 /* |
154 /* |
127 Slot to handle date selected on gotodate popup |
155 Slot to handle date selected on gotodate popup |
128 */ |
156 */ |
129 void CalenNativeView::goToSelectedDate() |
157 void CalenNativeView::goToSelectedDate() |
130 { |
158 { |
|
159 OstTraceFunctionEntry0( CALENNATIVEVIEW_GOTOSELECTEDDATE_ENTRY ); |
|
160 |
131 QDate selectedDate = mDatePicker->date(); |
161 QDate selectedDate = mDatePicker->date(); |
132 |
162 |
133 // Check if the selected date is within the range. |
163 // Check if the selected date is within the range. |
134 if (selectedDate.isValid() && |
164 if (selectedDate.isValid() && |
135 selectedDate >= CalenDateUtils::minTime().date() && |
165 selectedDate >= CalenDateUtils::minTime().date() && |
140 //Set the selected date to contextDate. |
170 //Set the selected date to contextDate. |
141 contextDate.setDate(selectedDate); |
171 contextDate.setDate(selectedDate); |
142 context.setFocusDateAndTime(contextDate); |
172 context.setFocusDateAndTime(contextDate); |
143 } |
173 } |
144 refreshViewOnGoToDate(); |
174 refreshViewOnGoToDate(); |
|
175 |
|
176 OstTraceFunctionExit0( CALENNATIVEVIEW_GOTOSELECTEDDATE_EXIT ); |
145 } |
177 } |
146 |
178 |
147 /*! |
179 /*! |
148 Virtual function to refresh the current view upon selecting a date |
180 Virtual function to refresh the current view upon selecting a date |
149 from GoToDate popup |
181 from GoToDate popup |
150 */ |
182 */ |
151 void CalenNativeView::refreshViewOnGoToDate() |
183 void CalenNativeView::refreshViewOnGoToDate() |
152 { |
184 { |
|
185 OstTraceFunctionEntry0( CALENNATIVEVIEW_REFRESHVIEWONGOTODATE_ENTRY ); |
|
186 |
153 mServices.IssueCommandL(ECalenStartActiveStep); |
187 mServices.IssueCommandL(ECalenStartActiveStep); |
|
188 |
|
189 OstTraceFunctionExit0( CALENNATIVEVIEW_REFRESHVIEWONGOTODATE_EXIT ); |
154 } |
190 } |
155 |
191 |
156 /*! |
192 /*! |
157 Slot to handle setting item in options menu |
193 Slot to handle setting item in options menu |
158 */ |
194 */ |
159 void CalenNativeView::launchSettingsView() |
195 void CalenNativeView::launchSettingsView() |
160 { |
196 { |
|
197 OstTraceFunctionEntry0( CALENNATIVEVIEW_LAUNCHSETTINGSVIEW_ENTRY ); |
|
198 |
161 mServices.IssueCommandL(ECalenShowSettings); |
199 mServices.IssueCommandL(ECalenShowSettings); |
|
200 |
|
201 OstTraceFunctionExit0( CALENNATIVEVIEW_LAUNCHSETTINGSVIEW_EXIT ); |
162 } |
202 } |
163 |
203 |
164 /*! |
204 /*! |
165 Slot to handle to orientation change |
205 Slot to handle to orientation change |
166 */ |
206 */ |
167 void CalenNativeView::changeOrientation(Qt::Orientation orientation) |
207 void CalenNativeView::changeOrientation(Qt::Orientation orientation) |
168 { |
208 { |
|
209 OstTraceFunctionEntry0( CALENNATIVEVIEW_CHANGEORIENTATION_ENTRY ); |
|
210 |
169 Q_UNUSED(orientation); |
211 Q_UNUSED(orientation); |
170 // Nothing, derived classes will implement it |
212 // Nothing, derived classes will implement it |
|
213 OstTraceFunctionExit0( CALENNATIVEVIEW_CHANGEORIENTATION_EXIT ); |
171 } |
214 } |
172 |
215 |
173 /*! |
216 /*! |
174 Handles the interested notifications from the calendar framework |
217 Handles the interested notifications from the calendar framework |
175 */ |
218 */ |
176 void CalenNativeView::HandleNotification(const TCalenNotification notification) |
219 void CalenNativeView::HandleNotification(const TCalenNotification notification) |
177 { |
220 { |
|
221 OstTraceFunctionEntry0( CALENNATIVEVIEW_HANDLENOTIFICATION_ENTRY ); |
|
222 |
178 switch (notification) { |
223 switch (notification) { |
179 case ECalenNotifySystemLocaleChanged: { |
224 case ECalenNotifySystemLocaleChanged: { |
180 onLocaleChanged(EChangesLocale); |
225 onLocaleChanged(EChangesLocale); |
181 } |
226 } |
182 break; |
227 break; |
185 } |
230 } |
186 break; |
231 break; |
187 default: |
232 default: |
188 break; |
233 break; |
189 } |
234 } |
|
235 |
|
236 OstTraceFunctionExit0( CALENNATIVEVIEW_HANDLENOTIFICATION_EXIT ); |
190 } |
237 } |
191 |
238 |
192 /*! |
239 /*! |
193 Returns true if plugin is loaded |
240 Returns true if plugin is loaded |
194 */ |
241 */ |
195 TBool CalenNativeView::pluginEnabled() |
242 TBool CalenNativeView::pluginEnabled() |
196 { |
243 { |
|
244 OstTraceFunctionEntry0( CALENNATIVEVIEW_PLUGINENABLED_ENTRY ); |
|
245 |
197 QString *pluginInfo = mServices.InfobarTextL(); |
246 QString *pluginInfo = mServices.InfobarTextL(); |
198 if (!pluginInfo) { |
247 if (!pluginInfo) { |
|
248 OstTraceFunctionExit0( CALENNATIVEVIEW_PLUGINENABLED_EXIT ); |
199 return false; |
249 return false; |
200 } else { |
250 } else { |
|
251 OstTraceFunctionExit0( DUP1_CALENNATIVEVIEW_PLUGINENABLED_EXIT ); |
201 return true; |
252 return true; |
202 } |
253 } |
203 } |
254 } |
204 |
255 |
205 QString *CalenNativeView::pluginText() |
256 QString *CalenNativeView::pluginText() |
206 { |
257 { |
|
258 OstTraceFunctionEntry0( CALENNATIVEVIEW_PLUGINTEXT_ENTRY ); |
|
259 |
|
260 OstTraceFunctionExit0( CALENNATIVEVIEW_PLUGINTEXT_EXIT ); |
207 return mServices.InfobarTextL(); |
261 return mServices.InfobarTextL(); |
|
262 |
208 } |
263 } |
209 |
264 |
210 // ---------------------------------------------------------------------------- |
265 // ---------------------------------------------------------------------------- |
211 // captureScreenshot caltures screen shot for the given viewId |
266 // captureScreenshot caltures screen shot for the given viewId |
212 // @param viewId view for which screenshot needs to be captured |
267 // @param viewId view for which screenshot needs to be captured |
213 // ---------------------------------------------------------------------------- |
268 // ---------------------------------------------------------------------------- |
214 // |
269 // |
215 void CalenNativeView::captureScreenshot(bool captureScreenShot) |
270 void CalenNativeView::captureScreenshot(bool captureScreenShot) |
216 { |
271 { |
|
272 OstTraceFunctionEntry0( CALENNATIVEVIEW_CAPTURESCREENSHOT_ENTRY ); |
|
273 |
217 // get a screenshot for saving to the activity manager. It's done for once |
274 // get a screenshot for saving to the activity manager. It's done for once |
218 // to optimize the performance |
275 // to optimize the performance |
219 if (captureScreenShot) { |
276 if (captureScreenShot) { |
220 mScreenShotMetadata.clear(); // remove any screenshot captured earlier |
277 mScreenShotMetadata.clear(); // remove any screenshot captured earlier |
221 mScreenShotMetadata.insert("screenshot", QPixmap::grabWidget(mainWindow(), mainWindow()->rect())); |
278 mScreenShotMetadata.insert("screenshot", QPixmap::grabWidget(mainWindow(), mainWindow()->rect())); |
222 } |
279 } |
223 mIsCapturedScreenShotValid = captureScreenShot; // set the validity of the screenshot captured |
280 mIsCapturedScreenShotValid = captureScreenShot; // set the validity of the screenshot captured |
|
281 |
|
282 OstTraceFunctionExit0( CALENNATIVEVIEW_CAPTURESCREENSHOT_EXIT ); |
224 } |
283 } |
225 |
284 |
226 // ---------------------------------------------------------------------------- |
285 // ---------------------------------------------------------------------------- |
227 // saveActivity saves the activity for current view |
286 // saveActivity saves the activity for current view |
228 // ---------------------------------------------------------------------------- |
287 // ---------------------------------------------------------------------------- |
229 // |
288 // |
230 void CalenNativeView::saveActivity() |
289 void CalenNativeView::saveActivity() |
231 { |
290 { |
|
291 OstTraceFunctionEntry0( CALENNATIVEVIEW_SAVEACTIVITY_ENTRY ); |
|
292 |
232 // Get a pointer to activity manager |
293 // Get a pointer to activity manager |
233 HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
294 HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
234 |
295 |
235 // check if alerady a valid screen shot is captured |
296 // check if alerady a valid screen shot is captured |
236 if (!mIsCapturedScreenShotValid) { |
297 if (!mIsCapturedScreenShotValid) { |