10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: This class is the base class of all Calendar views. |
14 * Description: This class is the base class of all Calendar views. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // system includes |
18 |
19 #include <QtGui> |
19 // INCLUDES |
20 #include <hbwidget.h> |
20 #include <calenconstants.h> |
21 #include <hblabel.h> |
21 #include <calenagendautils.h> |
22 #include <hbaction.h> |
22 #include <calendateutils.h> |
23 #include <hbdialog.h> |
23 #include <calentoolbar.h> |
24 #include <hbmainwindow.h> |
24 #include <Calendar.rsg> |
25 #include <hbdatetimepicker.h> |
25 #include <CalenStatusPaneUtils.h> |
26 #include <vwsdef.h> |
26 #include <calencontext.h> |
27 #include <hbactivitymanager.h> //Activity Manager |
27 #include <caltime.h> |
28 #include <hbapplication.h> //hbapplication |
28 #include <calinstance.h> |
29 #include <afactivitystorage.h> |
29 #include <calinstanceview.h> |
30 |
30 #include <calentry.h> |
31 //user includes |
31 #include <aknlists.h> |
32 #include <CalenUid.h> |
32 #include <aknnavide.h> |
|
33 #include <aknnotewrappers.h> |
|
34 #include <AknWaitDialog.h> |
|
35 #include <eikbtgpc.h> |
|
36 #include <centralrepository.h> |
|
37 #include <StringLoader.h> |
|
38 #include <sysutil.h> |
|
39 #include <hlplch.h> |
|
40 #include <akntoolbar.h> |
|
41 #include <calencommands.hrh> |
|
42 #include <calenservices.h> |
|
43 #include <calsession.h> |
|
44 #include <calenviewutils.h> |
|
45 #include <calcalendarinfo.h> |
|
46 #include <caleninstanceid.h> // TCalenInstanceId |
|
47 #include <featmgr.h> |
|
48 |
|
49 |
|
50 #include "calendarui_debug.h" // Debug. |
|
51 #include "CalendarVariant.hrh" |
33 #include "calennativeview.h" |
52 #include "calennativeview.h" |
34 #include "calenservices.h" |
53 #include "calencontainer.h" |
35 #include "calencontext.h" |
54 #include "CalenInterimUtils2.h" |
36 #include "calensettingsview.h" |
55 #include "calensend.h" |
37 #include "calendateutils.h" |
56 #include "calentitlepane.h" |
38 #include "calenconstants.h" |
57 #include "CleanupResetAndDestroy.h" |
39 #include "OstTraceDefinitions.h" |
58 #include "CalenPaths.h" |
40 #ifdef OST_TRACE_COMPILER_IN_USE |
59 #include "calendar.hrh" |
41 #include "calennativeviewTraces.h" |
60 #include "CalenUid.h" |
|
61 #include "CalendarPrivateCRKeys.h" |
|
62 #include "multicaluidialog.h" |
|
63 |
|
64 const TInt KAbbreviatedWeekNames[] = |
|
65 { |
|
66 R_QTN_WEEK_TWO_CHARS_MO, |
|
67 R_QTN_WEEK_TWO_CHARS_TU, |
|
68 R_QTN_WEEK_TWO_CHARS_WE, |
|
69 R_QTN_WEEK_TWO_CHARS_TH, |
|
70 R_QTN_WEEK_TWO_CHARS_FR, |
|
71 R_QTN_WEEK_TWO_CHARS_SA, |
|
72 R_QTN_WEEK_TWO_CHARS_SU |
|
73 }; |
|
74 |
|
75 |
|
76 #ifdef RD_CALEN_EXTERNAL_CAL |
|
77 #include <aiwservicehandler.h> |
|
78 |
|
79 // MIME types |
|
80 _LIT8(KContentTypeCalendar, "text/calendar"); |
|
81 |
|
82 #endif //RD_CALEN_EXTERNAL_CAL |
|
83 |
|
84 |
|
85 #include <aknnavilabel.h> |
|
86 #include <calennavilabel.h> |
|
87 |
|
88 |
|
89 // ================= MEMBER FUNCTIONS ======================= |
|
90 |
|
91 // ---------------------------------------------------------------------------- |
|
92 // CCalenNativeView::~CCalenNativeView |
|
93 // Destructor |
|
94 // (other items were commented in a header). |
|
95 // ---------------------------------------------------------------------------- |
|
96 // |
|
97 CCalenNativeView::~CCalenNativeView() |
|
98 { |
|
99 TRACE_ENTRY_POINT; |
|
100 |
|
101 CCoeAppUi* appui = CEikonEnv::Static()->AppUi(); |
|
102 appui->RemoveFromStack( iContainer ); |
|
103 |
|
104 delete iContainer; |
|
105 |
|
106 iServices.CancelNotifications( this ); |
|
107 |
|
108 delete iAbbreviatedDayArray; |
|
109 |
|
110 #ifdef RD_CALEN_EXTERNAL_CAL |
|
111 //delete AIW iServiceHandler; |
|
112 ReleaseServiceHandler(); |
|
113 #endif //RD_CALEN_EXTERNAL_CAL |
|
114 |
|
115 delete iMenuName; |
|
116 delete iSettingsName; |
|
117 |
|
118 delete iSPUtils; |
|
119 |
|
120 if( iAsyncCallback ) |
|
121 { |
|
122 iAsyncCallback->Cancel(); |
|
123 delete iAsyncCallback; |
|
124 iAsyncCallback = NULL; |
|
125 } |
|
126 |
|
127 TRACE_EXIT_POINT; |
|
128 } |
|
129 |
|
130 // ---------------------------------------------------------------------------- |
|
131 // CCalenNativeView::SetStatusPaneFromActiveContextL( |
|
132 // This function sets the status pane based upon the context |
|
133 // (other items were commented in a header). |
|
134 // ---------------------------------------------------------------------------- |
|
135 // |
|
136 void CCalenNativeView::SetStatusPaneFromActiveContextL() |
|
137 { |
|
138 TRACE_ENTRY_POINT; |
|
139 iSPUtils->RefreshStatusPane(); |
|
140 TRACE_EXIT_POINT; |
|
141 } |
|
142 |
|
143 // ---------------------------------------------------------------------------- |
|
144 // CCalenNativeView::Container |
|
145 // Return container control pointer. |
|
146 // (other items were commented in a header). |
|
147 // ---------------------------------------------------------------------------- |
|
148 // |
|
149 CCalenContainer* CCalenNativeView::Container() |
|
150 { |
|
151 TRACE_ENTRY_POINT; |
|
152 |
|
153 TRACE_EXIT_POINT; |
|
154 return iContainer; |
|
155 } |
|
156 |
|
157 // ---------------------------------------------------------------------------- |
|
158 // CCalenNativeView::OnCmdGotoDateL |
|
159 // Handling command "Go to day" |
|
160 // (other items were commented in a header). |
|
161 // ---------------------------------------------------------------------------- |
|
162 // |
|
163 void CCalenNativeView::OnCmdGotoDateL() |
|
164 { |
|
165 TRACE_ENTRY_POINT; |
|
166 |
|
167 TTime date = CalenDateUtils::Today(); |
|
168 |
|
169 TInt buttonId = CalenViewUtils::DateQueryL( date, 0 ); |
|
170 |
|
171 //test |
|
172 TDateTime dateTime = date.DateTime(); |
|
173 |
|
174 if (buttonId == EAknSoftkeyOk || buttonId == EEikBidOk) |
|
175 { |
|
176 MCalenContext& context = iServices.Context(); |
|
177 TCalTime dateCalTime; |
|
178 dateCalTime.SetTimeLocalL( date ); |
|
179 context.SetFocusDateAndTimeL( dateCalTime, context.ViewId() ); |
|
180 iContainer->NotifyChangeDateL(); |
|
181 } |
|
182 |
|
183 TRACE_EXIT_POINT; |
|
184 } |
|
185 |
|
186 // ---------------------------------------------------------------------------- |
|
187 // CCalenNativeView::OnCmdGotoTodayL |
|
188 // Handling command "Today". # key is pressed. |
|
189 // (other items were commented in a header). |
|
190 // ---------------------------------------------------------------------------- |
|
191 // |
|
192 void CCalenNativeView::OnCmdGotoTodayL() |
|
193 { |
|
194 TRACE_ENTRY_POINT; |
|
195 |
|
196 TTime today = CalenDateUtils::Today(); |
|
197 |
|
198 MCalenContext& context = iServices.Context(); |
|
199 TCalTime todayCalTime; |
|
200 todayCalTime.SetTimeLocalL( today ); |
|
201 context.SetFocusDateAndTimeL( todayCalTime, context.ViewId() ); |
|
202 |
|
203 iContainer->NotifyChangeDateL(); |
|
204 |
|
205 TRACE_EXIT_POINT; |
|
206 } |
|
207 |
|
208 // ---------------------------------------------------------------------------- |
|
209 // CCalenNativeView::NotifyFocusChanged |
|
210 // Notified that the focus of Container changes. |
|
211 // (other items were commented in a header). |
|
212 // ---------------------------------------------------------------------------- |
|
213 // |
|
214 void CCalenNativeView::NotifyFocusChanged() |
|
215 { |
|
216 TRACE_ENTRY_POINT; |
|
217 |
|
218 // FIXME: iLocChangeReason doesn't seem to serve any purpose. |
|
219 // Debug how it is used. |
|
220 if (iContainer && iNeedsRefresh) |
|
221 { |
|
222 if (IsForeground() && IsContainerFocused()) |
|
223 { |
|
224 //The database was changed while calendar was running as a |
|
225 //background task or the editor was open. We need to refresh. |
|
226 TRAP_IGNORE(BeginRepopulationL()); |
|
227 iNeedsRefresh = EFalse; |
|
228 } |
|
229 } |
|
230 if (iLocChangeReason && IsContainerFocused()) |
|
231 { |
|
232 PIM_TRAPD_HANDLE( OnLocaleChangedL( iLocChangeReason ) ); |
|
233 } |
|
234 iLocChangeReason = 0; |
|
235 |
|
236 TRACE_EXIT_POINT; |
|
237 } |
|
238 |
|
239 // ---------------------------------------------------------------------------- |
|
240 // CCalenNativeView::IsContainerFocused |
|
241 // Is container focused? |
|
242 // (other items were commented in a header). |
|
243 // ---------------------------------------------------------------------------- |
|
244 // |
|
245 TBool CCalenNativeView::IsContainerFocused() |
|
246 { |
|
247 TRACE_ENTRY_POINT; |
|
248 |
|
249 TRACE_EXIT_POINT; |
|
250 return (iContainer && iContainer->IsVisible()); |
|
251 } |
|
252 |
|
253 // ---------------------------------------------------------------------------- |
|
254 // CCalenNativeView::ShowValidScrollButtons |
|
255 // (other items were commented in a header). |
|
256 // ---------------------------------------------------------------------------- |
|
257 // |
|
258 void CCalenNativeView::ShowValidScrollButtons(CAknNavigationDecorator& aNaviLabel, |
|
259 const TTime& aBeforeRange, |
|
260 const TTime& aAfterRange) |
|
261 { |
|
262 TRACE_ENTRY_POINT; |
|
263 |
|
264 aNaviLabel.MakeScrollButtonVisible(ETrue); |
|
265 |
|
266 // FIXME can be written more simply. |
|
267 TBool mirrored(AknLayoutUtils::LayoutMirrored()); |
|
268 if (mirrored) |
|
269 { |
|
270 TBool validDay(CalenDateUtils::IsValidDay(aBeforeRange)); |
|
271 aNaviLabel.SetScrollButtonDimmed( |
|
272 CAknNavigationDecorator::ERightButton, !validDay); |
|
273 validDay = CalenDateUtils::IsValidDay(TTime(aAfterRange)); |
|
274 aNaviLabel.SetScrollButtonDimmed( |
|
275 CAknNavigationDecorator::ELeftButton, !validDay); |
|
276 } |
|
277 else |
|
278 { |
|
279 TBool validDay(CalenDateUtils::IsValidDay(aBeforeRange)); |
|
280 aNaviLabel.SetScrollButtonDimmed( |
|
281 CAknNavigationDecorator::ELeftButton, !validDay); |
|
282 validDay = CalenDateUtils::IsValidDay(aAfterRange); |
|
283 aNaviLabel.SetScrollButtonDimmed( |
|
284 CAknNavigationDecorator::ERightButton, !validDay); |
|
285 } |
|
286 |
|
287 |
|
288 if(iContainer && AknLayoutUtils::PenEnabled()) |
|
289 { |
|
290 aNaviLabel.SetNaviDecoratorObserver(static_cast<MAknNaviDecoratorObserver*>(iContainer)); |
|
291 CCoeControl* coeRes = aNaviLabel.DecoratedControl(); |
|
292 CCalenNaviLabel *actualLabel = static_cast<CCalenNaviLabel*>(coeRes); |
|
293 actualLabel->SetLabelObserver(static_cast<MCCalenNaviLabelObserver*>(iContainer)); |
|
294 } |
|
295 |
|
296 |
|
297 TRACE_EXIT_POINT; |
|
298 } |
|
299 |
|
300 // ---------------------------------------------------------------------------- |
|
301 // CCalenNativeView::DynInitMenuPaneL |
|
302 // Initialization of Options menu |
|
303 // (other items were commented in a header). |
|
304 // ---------------------------------------------------------------------------- |
|
305 // |
|
306 void CCalenNativeView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
307 { |
|
308 TRACE_ENTRY_POINT; |
|
309 |
|
310 switch (aResourceId) |
|
311 { |
|
312 case R_CALENDAR_NOTETYPE_MENUPANE: |
|
313 { |
|
314 if( !iServices.InterimUtilsL().MRViewersEnabledL( ETrue ) ) |
|
315 { |
|
316 aMenuPane->DeleteMenuItem( ECalenNewMeetingRequest ); |
|
317 } |
|
318 break; |
|
319 } |
|
320 case R_CALENDAR_CHANGE_VIEW_MENUPANE: |
|
321 { |
|
322 // If we get the cascading view switch menu pane, |
|
323 // need to offer it to the services, to remove |
|
324 // the current view. |
|
325 iServices.OfferMenuPaneL( aResourceId, aMenuPane ); |
|
326 } |
|
327 break; |
|
328 default: |
|
329 { |
|
330 #ifdef RD_CALEN_EXTERNAL_CAL |
|
331 // do we have a service handler, if not create one |
|
332 if (!iServiceHandler) |
|
333 { |
|
334 CreateServiceHandlerL(ETrue); |
|
335 } |
|
336 |
|
337 |
|
338 if (iServiceHandler->HandleSubmenuL(*aMenuPane)) |
|
339 { |
|
340 return; |
|
341 } |
|
342 |
|
343 // is the menu item AIW menu item if so, we will initialize our menu item |
|
344 if (iServiceHandler->IsAiwMenu(aResourceId)) |
|
345 { |
|
346 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL(); |
|
347 TInt extrainfo=0; |
|
348 TAiwVariant variant(extrainfo); |
|
349 // No generic param for integer, therefore use EGenericParamError. |
|
350 TAiwGenericParam param(EGenericParamError, variant); |
|
351 inParamList.AppendL(param); |
|
352 |
|
353 iServiceHandler->InitializeMenuPaneL( |
|
354 *aMenuPane, |
|
355 aResourceId, |
|
356 ECalenExtAiwCommandId, |
|
357 inParamList); |
|
358 } |
42 #endif |
359 #endif |
43 |
360 break; |
44 |
361 } |
45 /*! |
362 } |
46 \class CalenNativeView |
363 TRACE_EXIT_POINT; |
47 Base class for all calendar views |
364 } |
48 */ |
365 |
49 |
366 // ---------------------------------------------------------------------------- |
50 /*! |
367 // CCalenNativeView::HandleCommandL |
51 Default constructor. |
368 // Command handling for each view |
52 */ |
369 // (other items were commented in a header). |
53 CalenNativeView::CalenNativeView(MCalenServices &services) : |
370 // ---------------------------------------------------------------------------- |
54 mServices(services), |
371 // |
55 mEntriesInDataBase(false), |
372 void CCalenNativeView::HandleCommandL(TInt aCommand) |
56 mDatePicker(0), |
373 { |
57 mIsCapturedScreenShotValid(false), |
374 TRACE_ENTRY_POINT; |
58 mForcedExit(false) |
375 |
59 { |
376 switch (aCommand) |
60 OstTraceFunctionEntry0( CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY ); |
377 { |
61 |
378 case EAknCmdHelp: |
62 setTitle(hbTrId("txt_calendar_title_calendar")); |
379 HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), iAvkonAppUi->AppHelpContextL() ); |
63 //initialize the activity |
380 break; |
64 mActivityStorage = new AfActivityStorage(this); |
381 |
65 // Create services API and register for notifications |
382 // Context should be 8am on current focused day for these actions. |
66 RArray<TCalenNotification> notificationArray; |
383 case ECalenNewMeeting: |
67 CleanupClosePushL(notificationArray); |
384 case ECalenNewMeetingRequest: |
68 |
385 case ECalenNewAnniv: |
69 notificationArray.Append(ECalenNotifySystemTimeChanged); |
386 case ECalenNewDayNote: |
70 notificationArray.Append(ECalenNotifySystemLocaleChanged); |
387 case ECalenNewTodo: |
71 notificationArray.Append(ECalenNotifyContextChanged); |
388 { |
72 notificationArray.Append(ECalenNotifyCloseDialogs); |
389 iIsEditorActive = ETrue; |
73 notificationArray.Append(ECalenNotifyForcedExit); |
390 MCalenContext& context = iServices.Context(); |
74 mServices.RegisterForNotificationsL(this, notificationArray); |
391 // Set the date on the context. It will set it to be the |
75 |
392 // default of view (8am) on that day as we don't set the time. |
76 CleanupStack::PopAndDestroy(¬ificationArray); |
393 TCalTime time; |
|
394 time.SetTimeLocalL( CCalenContainer::DateFromContextL( context ) ); |
|
395 context.SetFocusDateL( time, |
|
396 TVwsViewId( KUidCalendar, Id() ) ); |
|
397 iServices.IssueCommandL( aCommand ); |
|
398 } |
|
399 break; |
|
400 case ECalenShowSettings: |
|
401 { |
|
402 iIsEditorActive = ETrue; |
|
403 iServices.IssueCommandL( aCommand ); |
|
404 } |
|
405 break; |
|
406 case ECalenMonthView: |
|
407 case ECalenWeekView: |
|
408 case ECalenDayView: |
|
409 case ECalenTodoView: |
|
410 { |
|
411 MCalenContext& context = iServices.Context(); |
|
412 // Set the date on the context. It will set it to be the |
|
413 // default of view (8am) on that day as we don't set the time. |
|
414 TCalTime time; |
|
415 time.SetTimeLocalL( CCalenContainer::DateFromContextL( context ) ); |
|
416 context.SetFocusDateL( time, |
|
417 TVwsViewId( KUidCalendar, Id() ) ); |
|
418 iServices.IssueCommandL( aCommand ); |
|
419 } |
|
420 break; |
|
421 |
|
422 // The context should remain the same for these actions. |
|
423 case ECalenForwardsToDayView: |
|
424 case ECalenNextView: |
|
425 case ECalenPrevView: |
|
426 case ECalenViewCurrentEntry: |
|
427 case ECalenEditCurrentEntry: |
|
428 case ECalenCompleteTodo: |
|
429 case ECalenRestoreTodo: |
|
430 case ECalenDeleteAllEntries: |
|
431 case ECalenDeleteCurrentEntry: |
|
432 case ECalenDeleteEntriesBeforeDate: |
|
433 //case ECalenGlobalSendAsCmdId: |
|
434 |
|
435 |
|
436 SetCommandHandlingInProgress( ETrue ); |
|
437 iServices.IssueCommandL( aCommand ); |
|
438 break; |
|
439 |
|
440 case ECalenEventView: |
|
441 case ECalenSwitchView: |
|
442 case ECalenSend: |
|
443 iServices.IssueCommandL( aCommand ); |
|
444 break; |
|
445 |
|
446 case ECalenGotoDate: |
|
447 OnCmdGotoDateL(); |
|
448 break; |
|
449 |
|
450 case ECalenGotoToday: |
|
451 OnCmdGotoTodayL(); |
|
452 break; |
|
453 |
|
454 default: |
|
455 { |
|
456 #ifdef RD_CALEN_EXTERNAL_CAL |
|
457 // by default we will check also AIW commands |
|
458 if (!iServiceHandler) |
|
459 { |
|
460 CreateServiceHandlerL(ETrue); |
|
461 } |
|
462 |
|
463 |
|
464 TInt aiwCmd = iServiceHandler->ServiceCmdByMenuCmd(aCommand); |
|
465 |
|
466 // if we have right one, handle it |
|
467 if(aiwCmd) |
|
468 { |
|
469 // add current focused date to param list |
|
470 MCalenContext& context = iServices.Context(); |
|
471 TTime time = context.FocusTime().TimeLocalL(); |
|
472 |
|
473 CAiwGenericParamList& inparams=iServiceHandler->InParamListL(); |
|
474 TAiwGenericParam date(EGenericParamDateTime); |
|
475 date.Value().Set(time); |
|
476 inparams.AppendL(date); |
|
477 |
|
478 // Execute AIW menu service command. |
|
479 PIM_TRAPD_HANDLE( |
|
480 iServiceHandler->ExecuteMenuCmdL( |
|
481 aCommand, // The service command |
|
482 inparams, // pass our date |
|
483 iServiceHandler->OutParamListL(), // No output parameters needed |
|
484 KAiwOptASyncronous, // we are using async version |
|
485 this )); // and we want to call us back |
|
486 } |
|
487 // if not then let ui framwork handle it |
|
488 |
|
489 else |
|
490 { |
|
491 #endif |
|
492 iServices.IssueCommandL( aCommand ); |
|
493 |
|
494 #ifdef RD_CALEN_EXTERNAL_CAL |
|
495 } |
|
496 #endif // RD_CALEN_EXTERNAL_CAL |
|
497 |
|
498 break; |
|
499 |
|
500 } |
|
501 |
|
502 } |
|
503 |
|
504 TRACE_EXIT_POINT; |
|
505 } |
|
506 |
|
507 // ---------------------------------------------------------------------------- |
|
508 // CCalenNativeView::DynInitMenuBarL |
|
509 // other details are commented in the header |
|
510 // ---------------------------------------------------------------------------- |
|
511 // |
|
512 void CCalenNativeView::DynInitMenuBarL( TInt /*aResourceId*/, CEikMenuBar* aMenuBar ) |
|
513 { |
|
514 TRACE_ENTRY_POINT; |
|
515 |
|
516 if( aMenuBar && IsCommandHandlingInProgress() ) |
|
517 { |
|
518 aMenuBar->StopDisplayingMenuBar(); |
|
519 } |
|
520 |
|
521 TRACE_EXIT_POINT; |
|
522 } |
|
523 |
|
524 // ---------------------------------------------------------------------------- |
|
525 // CCalenNativeView::CopytoCalendarsL |
|
526 // From CAknView |
|
527 // Return the UID of the day view |
|
528 // (other items were commented in a header) |
|
529 // ---------------------------------------------------------------------------- |
|
530 // |
|
531 void CCalenNativeView::CopyToCalendarsL() |
|
532 { |
|
533 TRACE_ENTRY_POINT; |
|
534 |
|
535 iAsyncCallback->CallBack(); |
|
536 |
|
537 TRACE_EXIT_POINT; |
|
538 } |
|
539 |
|
540 // ---------------------------------------------------------------------------- |
|
541 // CCalenNativeView::AsyncCopyToCalendarsL |
|
542 // From CAknView |
|
543 // Return the UID of the day view |
|
544 // (other items were commented in a header) |
|
545 // ---------------------------------------------------------------------------- |
|
546 // |
|
547 TInt CCalenNativeView::AsyncCopyToCalendarsL( TAny* aThisPtr ) |
|
548 { |
|
549 TRACE_ENTRY_POINT; |
|
550 |
|
551 static_cast<CCalenNativeView*>(aThisPtr)->CopyEntryToCalendarsL(); |
|
552 |
|
553 TRACE_EXIT_POINT; |
|
554 return 0; |
|
555 |
|
556 } |
|
557 |
|
558 // ---------------------------------------------------------------------------- |
|
559 // CCalenNativeView::CopyEntryToCalendarsL |
|
560 // From CAknView |
|
561 // Return the UID of the day view |
|
562 // (other items were commented in a header) |
|
563 // ---------------------------------------------------------------------------- |
|
564 // |
|
565 void CCalenNativeView::CopyEntryToCalendarsL() |
|
566 { |
|
567 TRACE_ENTRY_POINT; |
|
568 |
|
569 // Create settings own titlepane and navipane, and swap with existing ones |
|
570 CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
571 |
|
572 // Hide the toolbar before we display settings menu |
|
573 MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
574 if(toolbar) |
|
575 { |
|
576 toolbar->SetToolbarVisibilityL(EFalse); |
|
577 } |
|
578 iSPUtils->UnderLineTitleText( EFalse ); |
|
579 |
|
580 // Titlepane |
|
581 CAknTitlePane* newtp = new( ELeave ) CAknTitlePane(); |
|
582 CleanupStack::PushL( newtp ); |
|
583 CCoeControl* oldtp = sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), newtp ); |
|
584 CleanupStack::Pop( newtp ); // ownership is passed to statuspane |
|
585 TRect oldRect( 0, 0, 0, 0 ); |
|
586 if( oldtp ) |
|
587 { |
|
588 CleanupStack::PushL( oldtp ); |
|
589 oldRect = oldtp->Rect(); |
|
590 CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidTitle )); |
|
591 newtp->SetContainerWindowL( *ctrl ); |
|
592 newtp->ConstructL(); |
|
593 newtp->SetRect(oldRect); |
|
594 newtp->ActivateL(); |
|
595 } |
|
596 |
|
597 // NaviPane |
|
598 CAknNavigationControlContainer* newnp = new( ELeave )CAknNavigationControlContainer(); |
|
599 CleanupStack::PushL( newnp ); |
|
600 CCoeControl* oldnp = sp->SwapControlL( TUid::Uid( EEikStatusPaneUidNavi ), newnp ); |
|
601 CleanupStack::Pop( newnp ); // ownership is passed to statuspane |
|
602 if( oldnp ) |
|
603 { |
|
604 CleanupStack::PushL( oldnp ); |
|
605 oldRect = oldnp->Rect(); |
|
606 CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); |
|
607 newnp->SetContainerWindowL( *ctrl ); |
|
608 newnp->ConstructL(); |
|
609 newnp->SetRect( oldRect ); |
|
610 newnp->PushDefaultL(); |
|
611 newnp->ActivateL(); |
|
612 } |
|
613 |
|
614 MCalenContext& context = iServices.Context(); |
|
615 TCalLocalUid instanceId = context.InstanceId().iEntryLocalUid; |
|
616 |
|
617 CCalEntry* entry = iServices.EntryViewL(context.InstanceId().iColId)->FetchL(instanceId); |
|
618 CleanupStack::PushL(entry); |
|
619 |
|
620 RPointerArray<CCalEntry> calentryArray; |
|
621 calentryArray.Append( entry ); |
|
622 |
|
623 // Launch the Calendar List Dialiog. |
|
624 CMultiCalUiDialog* calenDbListDialog = CMultiCalUiDialog::NewLC(calentryArray, EFalse); |
|
625 TInt err = KErrNone; |
|
626 // Execute. |
|
627 TRAP( err,calenDbListDialog->LaunchL() ); |
|
628 CleanupStack::PopAndDestroy( calenDbListDialog ); |
|
629 |
|
630 iSPUtils->UnderLineTitleText( EFalse ); |
|
631 // Unhide the toolbar when settings is closed |
|
632 if(toolbar) |
|
633 { |
|
634 toolbar->SetToolbarVisibilityL(ETrue); |
|
635 } |
|
636 |
|
637 CleanupStack::Pop(entry); |
|
638 calentryArray.ResetAndDestroy(); |
|
639 |
|
640 // When setting is closed, swap back old titlepane and navipane |
|
641 if( oldnp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidNavi), oldnp ) ) |
|
642 { |
|
643 CleanupStack::Pop( oldnp ); |
|
644 delete newnp; |
|
645 oldnp->ActivateL(); |
|
646 } |
|
647 |
|
648 if( oldtp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), oldtp ) ) |
|
649 { |
|
650 CleanupStack::Pop( oldtp ); |
|
651 delete newtp; |
|
652 oldtp->ActivateL(); |
|
653 } |
|
654 |
|
655 BeginRepopulationL(); |
|
656 |
|
657 TRACE_EXIT_POINT; |
|
658 |
|
659 } |
|
660 |
|
661 // ---------------------------------------------------------------------------- |
|
662 // C++ constructor can NOT contain any code, that |
|
663 // might leave. |
|
664 // ---------------------------------------------------------------------------- |
|
665 // |
|
666 CCalenNativeView::CCalenNativeView( MCalenServices& aServices ) |
|
667 : iServices( aServices ) |
|
668 { |
|
669 TRACE_ENTRY_POINT; |
|
670 TRACE_EXIT_POINT; |
|
671 } |
|
672 |
|
673 // ---------------------------------------------------------------------------- |
|
674 // CCalenNativeView::ConstructL |
|
675 // Symbian OS default constructor |
|
676 // (other items were commented in a header). |
|
677 // ---------------------------------------------------------------------------- |
|
678 // |
|
679 void CCalenNativeView::CommonConstructL( TInt aViewResource ) |
|
680 { |
|
681 TRACE_ENTRY_POINT; |
|
682 |
|
683 BaseConstructL( aViewResource ); |
|
684 |
|
685 // Initialize CCalenStatusPaneUtils |
|
686 CEikStatusPane* sp = StatusPane(); |
|
687 iSPUtils = CCalenStatusPaneUtils::NewL( sp ); |
|
688 |
|
689 ClearViewSpecificDataL(); // Reset vsd. |
|
690 |
|
691 // Create services API and register for notifications |
|
692 RArray<TCalenNotification> notificationArray; |
|
693 notificationArray.Append(ECalenNotifySystemTimeChanged); |
|
694 notificationArray.Append(ECalenNotifyMarkedEntryDeleted); |
|
695 notificationArray.Append(ECalenNotifyContextChanged); |
|
696 notificationArray.Append(ECalenNotifyDialogClosed); |
|
697 notificationArray.Append(ECalenNotifyEntrySent); |
|
698 notificationArray.Append(ECalenNotifyEntryClosed); |
|
699 notificationArray.Append(ECalenNotifySystemLocaleChanged); |
|
700 notificationArray.Append(ECalenNotifyAppForegrounded); |
|
701 notificationArray.Append(ECalenNotifyAppBackgrounded); |
|
702 notificationArray.Append(ECalenNotifyEntrySaved); |
|
703 notificationArray.Append(ECalenNotifyInstanceSaved); |
|
704 notificationArray.Append(ECalenNotifySettingsClosed); |
|
705 notificationArray.Append(ECalenNotifySettingsChanged); |
|
706 notificationArray.Append(ECalenNotifyMarkedEntryCompleted); |
|
707 notificationArray.Append(ECalenNotifyDeleteInstanceView); |
|
708 notificationArray.Append(ECalenNotifyStopAlarm); |
|
709 notificationArray.Append(ECalenNotifyDeleteFailed); |
|
710 notificationArray.Append(ECalenNotifyEntryDeleted); |
|
711 notificationArray.Append(ECalenNotifyResourceChanged); |
|
712 notificationArray.Append(ECalenNotifyCalenLaunchedFromExtApp); |
77 |
713 |
78 OstTraceFunctionExit0( CALENNATIVEVIEW_CALENNATIVEVIEW_EXIT ); |
|
79 } |
|
80 |
|
81 /*! |
|
82 Destructor |
|
83 */ |
|
84 CalenNativeView::~CalenNativeView() |
|
85 { |
|
86 OstTraceFunctionEntry0( DUP1_CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY ); |
|
87 |
|
88 OstTraceFunctionExit0( DUP1_CALENNATIVEVIEW_CALENNATIVEVIEW_EXIT ); |
|
89 } |
|
90 |
|
91 /*! |
|
92 Issues populcaiton complete to the framework |
|
93 */ |
|
94 void CalenNativeView::populationComplete() |
|
95 { |
|
96 OstTraceFunctionEntry0( CALENNATIVEVIEW_POPULATIONCOMPLETE_ENTRY ); |
|
97 |
|
98 // Population is complete, issue the notification |
|
99 mServices.IssueNotificationL(ECalenNotifyViewPopulationComplete); |
|
100 //if entry is created in editor, and app closed from either |
|
101 // task switcher or red key |
|
102 //latest entry should be shown in activity |
|
103 //provide uinfo to user that entry get saved |
|
104 if(mForcedExit){ |
|
105 captureScreenshot(true); |
|
106 saveActivity(); |
|
107 } |
|
108 else{ |
|
109 captureScreenshot(false); |
|
110 } |
|
111 OstTraceFunctionExit0( CALENNATIVEVIEW_POPULATIONCOMPLETE_EXIT ); |
|
112 } |
|
113 |
|
114 /*! |
|
115 Slot for delete before date |
|
116 */ |
|
117 void CalenNativeView::deleteBeforeDate() |
|
118 { |
|
119 OstTraceFunctionEntry0( CALENNATIVEVIEW_DELETEBEFOREDATE_ENTRY ); |
|
120 |
|
121 mServices.IssueCommandL(ECalenDeleteEntriesBeforeDate); |
|
122 |
714 |
123 OstTraceFunctionExit0( CALENNATIVEVIEW_DELETEBEFOREDATE_EXIT ); |
715 iServices.RegisterForNotificationsL( this,notificationArray); |
124 } |
716 |
125 |
717 notificationArray.Reset(); |
126 /*! |
718 |
127 Slot for delete all entries |
719 iIgnoreTap = EFalse; |
128 */ |
720 |
129 void CalenNativeView::deleteAllEntries() |
721 iCommandProcessing = EFalse; |
130 { |
722 TCallBack callback(CCalenNativeView::AsyncCopyToCalendarsL,this); |
131 OstTraceFunctionEntry0( CALENNATIVEVIEW_DELETEALLENTRIES_ENTRY ); |
723 iAsyncCallback = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard); |
132 |
724 |
133 mServices.IssueCommandL(ECalenDeleteAllEntries); |
725 TRACE_EXIT_POINT; |
134 mEntriesInDataBase = false; |
726 } |
|
727 |
|
728 // ---------------------------------------------------------------------------- |
|
729 // CCalenNativeView::CreateContainerL |
|
730 // A container control is created. |
|
731 // (other items were commented in a header). |
|
732 // ---------------------------------------------------------------------------- |
|
733 // |
|
734 void CCalenNativeView::CreateContainerL() |
|
735 { |
|
736 TRACE_ENTRY_POINT; |
|
737 |
|
738 if (!iContainer) |
|
739 { |
|
740 CCalenContainer* container = CreateContainerImplL(); |
|
741 CleanupStack::PushL(container); |
|
742 container->SetMopParent(this); |
|
743 container->ConstructL(); |
|
744 CleanupStack::Pop(); // container |
|
745 |
|
746 iContainer = container; |
|
747 iContainer->SetRect( ClientRect() ); |
|
748 iContainer->ActivateL(); |
|
749 } |
|
750 else |
|
751 { |
|
752 iContainer->MakeVisible(ETrue); |
|
753 } |
|
754 |
|
755 TRACE_EXIT_POINT; |
|
756 } |
|
757 |
|
758 // ---------------------------------------------------------------------------- |
|
759 // CCalenNativeView::AbbreviatedDayArrayL |
|
760 // Returns an array of descriptors of abbreviated days (e.g. MO, TU). This |
|
761 // will only get called by the month and week views. |
|
762 // (other items were commented in a header). |
|
763 // ---------------------------------------------------------------------------- |
|
764 // |
|
765 const CDesCArrayFlat& CCalenNativeView::AbbreviatedDayArrayL() |
|
766 { |
|
767 TRACE_ENTRY_POINT; |
|
768 |
|
769 if( !iAbbreviatedDayArray ) |
|
770 { |
|
771 iAbbreviatedDayArray = new( ELeave )CDesCArrayFlat( 7 ); |
|
772 HBufC* dayAbb; |
|
773 |
|
774 for ( TInt i(0); i<7; ++i ) |
|
775 { |
|
776 dayAbb = StringLoader::LoadLC( KAbbreviatedWeekNames[i] ); |
|
777 iAbbreviatedDayArray->AppendL( *dayAbb ); |
|
778 CleanupStack::PopAndDestroy( dayAbb ); |
|
779 } |
|
780 } |
|
781 |
|
782 TRACE_EXIT_POINT; |
|
783 return *iAbbreviatedDayArray; |
|
784 } |
|
785 |
|
786 // ---------------------------------------------------------------------------- |
|
787 // CCalenNativeView::DoActivateL |
|
788 // View activation handler |
|
789 // (other items were commented in a header). |
|
790 // ---------------------------------------------------------------------------- |
|
791 // |
|
792 void CCalenNativeView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
793 TUid aCustomMessageId, |
|
794 const TDesC8& aCustomMessage) |
|
795 { |
|
796 TRACE_ENTRY_POINT; |
|
797 |
|
798 iLocChangeReason = 0; |
|
799 |
|
800 if( KCalenHideInBackGround.iUid == aCustomMessageId.iUid ) |
|
801 { |
|
802 SetFasterAppActive(ETrue); |
|
803 DoDeactivate(); |
|
804 } |
|
805 |
|
806 if( AknLayoutUtils::PenEnabled() ) |
|
807 { |
|
808 MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull(); |
|
809 if(toolbarImpl) |
|
810 { |
|
811 CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
812 toolbar.SetToolbarVisibility(ETrue); |
|
813 } |
|
814 } |
|
815 |
|
816 if ( Toolbar() ) |
|
817 { |
|
818 ShowToolbarOnViewActivation( ETrue ); |
|
819 } |
|
820 |
|
821 CreateContainerL(); |
|
822 |
|
823 DoActivateImplL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
824 |
|
825 TRACE_EXIT_POINT; |
|
826 } |
|
827 |
|
828 // ---------------------------------------------------------------------------- |
|
829 // CCalenNativeView::DoDeactivate |
|
830 // View deactivation handler |
|
831 // (other items were commented in a header). |
|
832 // ---------------------------------------------------------------------------- |
|
833 // |
|
834 void CCalenNativeView::DoDeactivate() |
|
835 { |
|
836 TRACE_ENTRY_POINT; |
|
837 #ifdef RD_CALEN_EXTERNAL_CAL |
|
838 //delete AIW iServiceHandler; |
|
839 ReleaseServiceHandler(); |
|
840 #endif //RD_CALEN_EXTERNAL_CAL |
|
841 |
|
842 if (iContainer) |
|
843 { |
|
844 iContainer->RemoveFromStackAndMakeInvisible(); |
|
845 DoDeactivateImpl(); |
|
846 delete iContainer; |
|
847 iContainer = NULL; |
|
848 } |
|
849 TRACE_EXIT_POINT; |
|
850 } |
|
851 |
|
852 // ---------------------------------------------------------------------------- |
|
853 // CCalenNativeView::HandleDBChangeL |
|
854 // Called from CCalenGlobalData when the agenda database |
|
855 // is modified from an external session. |
|
856 // ---------------------------------------------------------------------------- |
|
857 // |
|
858 void CCalenNativeView::HandleDBChangeL() |
|
859 { |
|
860 TRACE_ENTRY_POINT; |
|
861 |
|
862 // If iContainer is NULL then this is not the active view, so do nothing. |
|
863 // The view will be refreshed when the container is constructed. |
|
864 if ( iContainer ) |
|
865 { |
|
866 if (IsForeground() && Container()->ComponentControl(0)->IsFocused()) |
|
867 { |
|
868 // Application is in the foreground and the container is visible |
|
869 // on screen. We know that the editor is not open as the |
|
870 // containers first component control currently has keyboard focus. |
|
871 // The first component control will either be a listbox or grid |
|
872 // depending on the viewtype. Refresh the container. |
|
873 BeginRepopulationL(); |
|
874 iNeedsRefresh = EFalse; |
|
875 } |
|
876 else |
|
877 { |
|
878 // This is the active view, but we are in one of two states: |
|
879 // 1: The application is in the background |
|
880 // 2: The editor is open and currently has keyboard focus. |
|
881 // When we recieve a focus change notification we will need to |
|
882 // refresh the view. This happens in CCalenNativeView::NotifyFocusChanged |
|
883 iNeedsRefresh = ETrue; |
|
884 } |
|
885 } |
|
886 |
|
887 TRACE_EXIT_POINT; |
|
888 } |
|
889 |
|
890 // ---------------------------------------------------------------------------- |
|
891 // CCalenNativeView::SetCbaL() |
|
892 // Set CBA and change button from Back to Exit if necessary |
|
893 // (other items were commented in a header). |
|
894 // ---------------------------------------------------------------------------- |
|
895 // |
|
896 void CCalenNativeView::SetCbaL(TInt aCbaResourceId) |
|
897 { |
|
898 TRACE_ENTRY_POINT; |
|
899 |
|
900 CEikButtonGroupContainer* cba = Cba(); |
|
901 cba->SetCommandSetL(aCbaResourceId); |
|
902 cba->DrawNow(); |
|
903 |
|
904 TRACE_EXIT_POINT; |
|
905 } |
|
906 |
|
907 |
|
908 #ifdef RD_CALEN_EXTERNAL_CAL |
|
909 |
|
910 // ---------------------------------------------------------------------------- |
|
911 // CCalenNativeView::CreateServiceHandlerL() |
|
912 // Create new AIW service handler and attach to menu services if needed |
|
913 // (other items were commented in a header). |
|
914 // ---------------------------------------------------------------------------- |
|
915 // |
|
916 void CCalenNativeView::CreateServiceHandlerL(TBool aAttachMenu) |
|
917 { |
|
918 TRACE_ENTRY_POINT; |
|
919 |
|
920 |
|
921 if ((iServiceHandler!=NULL) && (aAttachMenu==EFalse)) |
|
922 { |
|
923 TRACE_EXIT_POINT; |
|
924 return; |
|
925 } |
|
926 |
|
927 // Create service handler instance. |
|
928 if (!iServiceHandler) |
|
929 { |
|
930 iServiceHandler = CAiwServiceHandler::NewL(); |
|
931 } |
|
932 if (aAttachMenu) |
|
933 { |
|
934 // Attach menu service interest to AIW framework. We will add |
|
935 // menus to all the views |
|
936 PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_DAY_MENUPANE, |
|
937 R_EXTERNAL_CALENDAR_AIW_INTEREST) ); |
|
938 |
|
939 PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_MONTH_MENUPANE, |
|
940 R_EXTERNAL_CALENDAR_AIW_INTEREST) ); |
|
941 |
|
942 |
|
943 PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_WEEK_MENUPANE, |
|
944 R_EXTERNAL_CALENDAR_AIW_INTEREST) ); |
|
945 |
|
946 PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_TODO_LIST_MENUPANE, |
|
947 R_EXTERNAL_CALENDAR_AIW_INTEREST) ); |
|
948 } |
|
949 |
|
950 |
|
951 TRACE_EXIT_POINT; |
|
952 } |
|
953 |
|
954 #endif //RD_CALEN_EXTERNAL_CAL |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 #ifdef RD_CALEN_EXTERNAL_CAL |
|
960 // ---------------------------------------------------------------------------- |
|
961 // CCalenNativeView::ReleaseServiceHandler() |
|
962 // Release service handler and unload provider |
|
963 // (other items were commented in a header). |
|
964 // ---------------------------------------------------------------------------- |
|
965 // |
|
966 void CCalenNativeView::ReleaseServiceHandler() |
|
967 { |
|
968 TRACE_ENTRY_POINT; |
|
969 if (iServiceHandler) |
|
970 { |
|
971 iServiceHandler->Reset(); |
|
972 delete iServiceHandler; |
|
973 iServiceHandler=NULL; |
|
974 } |
|
975 TRACE_EXIT_POINT; |
|
976 } |
|
977 #endif //RD_CALEN_EXTERNAL_CAL |
|
978 |
|
979 |
|
980 #ifdef RD_CALEN_EXTERNAL_CAL |
|
981 // ---------------------------------------------------------------------------- |
|
982 // CCalenNativeView::ServiceHandler() |
|
983 // Return pointer to service handler |
|
984 // (other items were commented in a header). |
|
985 // ---------------------------------------------------------------------------- |
|
986 // |
|
987 CAiwServiceHandler* CCalenNativeView::ServiceHandler() |
|
988 { |
|
989 TRACE_ENTRY_POINT; |
|
990 return iServiceHandler; |
|
991 TRACE_EXIT_POINT; |
|
992 } |
|
993 #endif //RD_CALEN_EXTERNAL_CAL |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 #ifdef RD_CALEN_EXTERNAL_CAL |
|
1000 |
|
1001 // ---------------------------------------------------------------------------- |
|
1002 //* Handles notifications caused by an asynchronous Execute*CmdL call |
|
1003 //* or an event. |
|
1004 //* |
|
1005 //* @param aCmdId The service command associated to the event. |
|
1006 //* @param aEventId Occured event, see AiwCommon.hrh. |
|
1007 //* @param aEventParamList Event parameters, if any, as defined per |
|
1008 //* each event. |
|
1009 //* @param aInParamList Input parameters, if any, given in the |
|
1010 //* related HandleCommmandL. |
|
1011 //* @return Error code for the callback. |
|
1012 // ---------------------------------------------------------------------------- |
|
1013 // |
|
1014 TInt CCalenNativeView::HandleNotifyL(TInt /*aCmdId*/,TInt /*aEventId*/,CAiwGenericParamList& aEventParamList,const CAiwGenericParamList& /*aInParamList*/) |
|
1015 { |
|
1016 TRACE_ENTRY_POINT; |
|
1017 TInt count=aEventParamList.Count(); |
|
1018 TInt index=0; |
|
1019 TTime date(0); |
|
1020 |
|
1021 // find first TTime parameter |
|
1022 const TAiwGenericParam* param = aEventParamList.FindFirst(index, EGenericParamDateTime); |
|
1023 if (index >= 0) |
|
1024 { |
|
1025 // get date value from it |
|
1026 const TAiwVariant& val = param->Value(); |
|
1027 val.Get(date); |
|
1028 } |
|
1029 else |
|
1030 { |
|
1031 TRACE_EXIT_POINT; |
|
1032 return KErrNone; |
|
1033 } |
|
1034 |
|
1035 // use date got from provider and set it to calendar |
|
1036 MCalenContext& context = iServices.Context(); |
|
1037 TCalTime focusTime; |
|
1038 focusTime.SetTimeLocalL( date + TCalenContext::DefaultTimeForViews() ); |
|
1039 context.SetFocusTime( focusTime , context.ViewId() ); |
|
1040 iContainer->NotifyChangeDateL(); |
|
1041 TRACE_EXIT_POINT; |
|
1042 return KErrNone; |
|
1043 } |
|
1044 |
|
1045 #endif //RD_CALEN_EXTERNAL_CAL |
|
1046 |
|
1047 // ---------------------------------------------------------------------------- |
|
1048 // CCalenNativeView::HandleNotification |
|
1049 // From MCalenNotificationHandler |
|
1050 // Handles a notification of a calendar event that this |
|
1051 // MCalenNotificationHandler has registered for |
|
1052 // ---------------------------------------------------------------------------- |
|
1053 // |
|
1054 void CCalenNativeView::HandleNotification(const TCalenNotification aNotification ) |
|
1055 { |
|
1056 TRACE_ENTRY_POINT; |
|
1057 |
|
1058 switch ( aNotification ) |
|
1059 { |
|
1060 case ECalenNotifyContextChanged: |
|
1061 { |
|
1062 // If we're not on screen, clear VSD. |
|
1063 if ( !iContainer ) |
|
1064 { |
|
1065 PIM_TRAPD_HANDLE( ClearViewSpecificDataL() ); |
|
1066 } |
|
1067 } |
|
1068 break; |
|
1069 case ECalenNotifyMarkedEntryDeleted: // Todo view specific notification |
|
1070 { |
|
1071 PIM_TRAPD_HANDLE( NotifyMarkedEntryDeletedL() ); |
|
1072 } |
|
1073 break; |
|
1074 case ECalenNotifyMarkedEntryCompleted: // Todo view specific notification |
|
1075 { |
|
1076 PIM_TRAPD_HANDLE( NotifyMarkedEntryCompletedL() ); |
|
1077 } |
|
1078 break; |
|
1079 case ECalenNotifySystemTimeChanged: |
|
1080 { |
|
1081 PIM_TRAPD_HANDLE( OnLocaleChangedL( EChangesSystemTime ) ); |
|
1082 } |
|
1083 break; |
|
1084 case ECalenNotifyCalenLaunchedFromExtApp: |
|
1085 { |
|
1086 SetTapIgnore(ETrue); |
|
1087 } |
|
1088 break; |
|
1089 case ECalenNotifyEntryClosed: |
|
1090 { |
|
1091 // The editor/ viewer is changed |
|
1092 PIM_TRAPD_HANDLE( OnEditorClosedL() ); |
|
1093 } |
|
1094 break; |
|
1095 case ECalenNotifyDialogClosed: |
|
1096 { |
|
1097 // The editor/ viewer is changed |
|
1098 PIM_TRAPD_HANDLE( OnEditorClosedL() ); |
|
1099 iIsEditorActive = EFalse; |
|
1100 iCommandProcessing = EFalse; |
|
1101 break; |
|
1102 } |
|
1103 case ECalenNotifySettingsClosed: |
|
1104 case ECalenNotifyEntrySent: |
|
1105 { |
|
1106 iIsEditorActive = EFalse; |
|
1107 iCommandProcessing = EFalse; |
|
1108 } |
|
1109 break; |
|
1110 case ECalenNotifySettingsChanged: |
|
1111 { |
|
1112 if(FeatureManager::FeatureSupported |
|
1113 (KFeatureIdFfCalScrollablePreview) && iContainer) |
|
1114 { |
|
1115 iContainer->HandleDisplayPreviewPaneSettingsChangeL(); |
|
1116 } |
|
1117 iIsEditorActive = EFalse; |
|
1118 iCommandProcessing = EFalse; |
|
1119 } |
|
1120 break; |
|
1121 case ECalenNotifyEntrySaved: |
|
1122 case ECalenNotifyInstanceSaved: |
|
1123 { |
|
1124 iIsEditorActive = EFalse; |
|
1125 if( Container() ) |
|
1126 { |
|
1127 PIM_TRAPD_HANDLE(UpdateDateFromContextL()); |
|
1128 } |
|
1129 } |
|
1130 break; |
|
1131 case ECalenNotifySystemLocaleChanged: |
|
1132 { |
|
1133 PIM_TRAPD_HANDLE( OnLocaleChangedL( EChangesLocale ) ); |
|
1134 } |
|
1135 break; |
|
1136 case ECalenNotifyAppForegrounded: |
|
1137 { |
|
1138 iIsBackgrounded = EFalse; |
|
1139 // Updates the previewpane/preview popup in month view/week view |
|
1140 if(iFasterAppActive) |
|
1141 { |
|
1142 iFasterAppActive = EFalse; |
|
1143 if(iIsEditorActive) |
|
1144 { |
|
1145 iIsEditorActive = EFalse; |
|
1146 } |
|
1147 } |
|
1148 PIM_TRAPD_HANDLE(UpdatePreviewPaneL()); |
|
1149 } |
|
1150 break; |
|
1151 case ECalenNotifyAppBackgrounded: |
|
1152 { |
|
1153 iIsBackgrounded = ETrue; |
|
1154 // Hides previewpane/preview popup in month view/week view when |
|
1155 // application goes to background or whenever fake exit is done |
|
1156 PIM_TRAPD_HANDLE(HidePreviewPane()); |
|
1157 } |
|
1158 break; |
|
1159 case ECalenNotifyEntryDeleted: |
|
1160 case ECalenNotifyMultipleEntriesDeleted: |
|
1161 case ECalenNotifyInstanceDeleted: |
|
1162 case ECalenNotifyCancelDelete: |
|
1163 case ECalenNotifyDeleteInstanceView: |
|
1164 { |
|
1165 // Called when user does not delete an entry. |
|
1166 if( IsCommandHandlingInProgress() ) |
|
1167 { |
|
1168 SetCommandHandlingInProgress( EFalse ); |
|
1169 } |
|
1170 |
|
1171 if(iContainer) |
|
1172 { |
|
1173 iContainer->CleanupInstances(); |
|
1174 } |
|
1175 } |
|
1176 break; |
|
1177 case ECalenNotifyDeleteFailed: |
|
1178 { |
|
1179 // Called when user does not delete an entry. |
|
1180 if( IsCommandHandlingInProgress() ) |
|
1181 { |
|
1182 SetCommandHandlingInProgress( EFalse ); |
|
1183 } |
|
1184 |
|
1185 } |
|
1186 break; |
|
1187 case ECalenNotifyStopAlarm: |
|
1188 { |
|
1189 if(iContainer) |
|
1190 { |
|
1191 PIM_TRAPD_HANDLE(iContainer->HandleStopCommandL()); |
|
1192 } |
|
1193 } |
|
1194 break; |
|
1195 case ECalenNotifyResourceChanged: |
|
1196 { |
|
1197 if(iContainer ) |
|
1198 { |
|
1199 CAknAppUi* Appui = (CAknAppUi*)CEikonEnv::Static()->EikAppUi(); |
|
1200 //handle this event when the app is in background |
|
1201 if(!Appui->IsForeground()) |
|
1202 { |
|
1203 iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch); |
|
1204 } |
|
1205 } |
|
1206 } |
|
1207 break; |
|
1208 default: |
|
1209 ASSERT( 0 ); // should never get here |
|
1210 break; |
|
1211 } |
|
1212 |
|
1213 TRACE_EXIT_POINT; |
|
1214 } |
|
1215 |
|
1216 #ifdef RD_CALEN_EXTERNAL_CAL |
|
1217 // ---------------------------------------------------------------------------- |
|
1218 // ?classname::?member_function |
|
1219 // ?implementation_description |
|
1220 // (other items were commented in a header). |
|
1221 // ---------------------------------------------------------------------------- |
|
1222 // |
|
1223 TBool CCalenNativeView::ExtCalendarAvailableL() |
|
1224 { |
|
1225 TRACE_ENTRY_POINT; |
|
1226 |
|
1227 |
|
1228 TBool res=EFalse; |
|
1229 |
|
1230 |
|
1231 TInt enabled( 0 ); |
|
1232 CRepository* repository = NULL; |
|
1233 |
|
1234 // first we check central repository if it has our external calendar enabled. |
|
1235 PIM_TRAPD_HANDLE( (repository = CRepository::NewL( KCRUidCalenUIExtensions )) ); |
|
1236 if( repository ) |
|
1237 { |
|
1238 TInt err = repository->Get( KCalenExternalCalendarEnabled, enabled ); |
|
1239 delete repository; |
|
1240 } |
|
1241 // if setting says it is not enabled there is no point of loading provider at all, improves performance. |
|
1242 if (!enabled) |
|
1243 { |
|
1244 TRACE_EXIT_POINT; |
|
1245 return EFalse; |
|
1246 } |
|
1247 |
|
1248 // if setting was enabled we should also find out if there is a service provider. |
|
1249 CreateServiceHandlerL(EFalse); |
|
1250 CAiwCriteriaItem* crit = CAiwCriteriaItem::NewLC(ECalenExtAiwCommandId, KAiwCmdView, KContentTypeCalendar); |
|
1251 // we will connect to base service which is currently just empty. This is needed just for finding out if |
|
1252 // there are any providers available. This will change in the future in AIW framework as it is a bug. |
|
1253 crit->SetServiceClass(TUid::Uid(KAiwClassBase)); |
|
1254 crit->SetMaxProviders(1); |
|
1255 RCriteriaArray array; |
|
1256 array.Append(crit); |
|
1257 |
|
1258 // attach to base service. |
|
1259 // ownership of array is not transferred. |
|
1260 iServiceHandler->AttachL(array); |
|
1261 |
|
1262 // get number of matching providers. |
|
1263 TInt num=iServiceHandler->NbrOfProviders(crit); |
|
1264 |
|
1265 |
|
1266 array.ResetAndDestroy(); |
|
1267 CleanupStack::Pop(crit); |
|
1268 |
|
1269 // ok if we have provider and setting was also enabled then we should show menu items. |
|
1270 if ((num>0)&&(enabled)) |
|
1271 { |
|
1272 res=ETrue; |
|
1273 } |
|
1274 TRACE_EXIT_POINT; |
|
1275 return res; |
|
1276 } |
|
1277 #endif //RD_CALEN_EXTERNAL_CAL |
|
1278 |
|
1279 // ---------------------------------------------------------------------------- |
|
1280 // CCalenNativeView::BeginRepopulationL |
|
1281 // Starts population again. |
|
1282 // (other items were commented in a header). |
|
1283 // ---------------------------------------------------------------------------- |
|
1284 // |
|
1285 void CCalenNativeView::BeginRepopulationL() |
|
1286 { |
|
1287 TRACE_ENTRY_POINT; |
|
1288 |
|
1289 CancelPopulation(); |
|
1290 iServices.IssueCommandL( ECalenStartActiveStep ); |
|
1291 |
|
1292 TRACE_EXIT_POINT; |
|
1293 } |
|
1294 |
|
1295 // ---------------------------------------------------------------------------- |
|
1296 // CCalenNativeView::RemoveViewsFromCycle |
|
1297 // From CCalenView. Does nothing. |
|
1298 // (other items were commented in a header). |
|
1299 // ---------------------------------------------------------------------------- |
|
1300 // |
|
1301 void CCalenNativeView::RemoveViewsFromCycle( RArray<TInt>& /*aViews*/ ) |
|
1302 { |
|
1303 TRACE_ENTRY_POINT; |
|
1304 TRACE_EXIT_POINT; |
|
1305 } |
|
1306 |
|
1307 // ---------------------------------------------------------------------------- |
|
1308 // CCalenNativeView::GetHelpContext |
|
1309 // From CCalenView. Does nothing. |
|
1310 // (other items were commented in a header). |
|
1311 // ---------------------------------------------------------------------------- |
|
1312 // |
|
1313 void CCalenNativeView::GetHelpContext( TCoeHelpContext& /*aHelpContext*/ ) |
|
1314 { |
|
1315 TRACE_ENTRY_POINT; |
|
1316 TRACE_EXIT_POINT; |
|
1317 } |
|
1318 |
|
1319 // ---------------------------------------------------------------------------- |
|
1320 // CCalenNativeView::CalenViewExtensionL |
|
1321 // From CCalenView. Does nothing. |
|
1322 // (other items were commented in a header). |
|
1323 // ---------------------------------------------------------------------------- |
|
1324 // |
|
1325 TAny* CCalenNativeView::CalenViewExtensionL( TUid /*aExtensionId*/ ) |
|
1326 { |
|
1327 TRACE_ENTRY_POINT; |
|
1328 TRACE_EXIT_POINT; |
|
1329 return NULL; |
|
1330 } |
|
1331 |
|
1332 // ---------------------------------------------------------------------------- |
|
1333 // CCalenNativeView::OnEditorClosedL |
|
1334 // Called when editor/viewer is closed |
|
1335 // (other items were commented in a header). |
|
1336 // ---------------------------------------------------------------------------- |
|
1337 // |
|
1338 void CCalenNativeView::OnEditorClosedL() |
|
1339 { |
|
1340 TRACE_ENTRY_POINT; |
|
1341 |
|
1342 SetTapIgnore(EFalse); |
|
1343 // If the view is active, then update status pane |
|
1344 if( Container() ) |
|
1345 { |
|
1346 RedrawStatusPaneL(); |
|
1347 iIsEditorActive = EFalse; |
|
1348 } |
|
1349 TRACE_EXIT_POINT; |
|
1350 } |
|
1351 |
|
1352 // ---------------------------------------------------------------------------- |
|
1353 // CCalenNativeView::SetEditorActive |
|
1354 // Set the flag iIsEditorActive whenever new event editor is launched from any |
|
1355 // native view.This is to prevent the preview popup display |
|
1356 // (other items were commented in a header). |
|
1357 // ---------------------------------------------------------------------------- |
|
1358 // |
|
1359 void CCalenNativeView::SetEditorActive(TBool aEditorActive) |
|
1360 { |
|
1361 TRACE_ENTRY_POINT; |
|
1362 |
|
1363 iIsEditorActive = aEditorActive; |
|
1364 |
|
1365 TRACE_EXIT_POINT; |
|
1366 } |
135 |
1367 |
136 OstTraceFunctionExit0( CALENNATIVEVIEW_DELETEALLENTRIES_EXIT ); |
1368 // ---------------------------------------------------------------------------- |
137 } |
1369 // CCalenNativeView::IsCommandHandlingInProgress |
138 |
1370 // other details are commented in the header |
139 /*! |
1371 // ---------------------------------------------------------------------------- |
140 Refreshes the already open date picker with proper |
1372 // |
141 date format as per current locale settings. |
1373 TBool CCalenNativeView::IsCommandHandlingInProgress() |
142 */ |
1374 { |
143 void CalenNativeView::refreshDatePicker() |
1375 TRACE_ENTRY_POINT; |
144 { |
1376 |
145 if(!(mDatePicker.isNull())) { |
1377 return iCommandProcessing; |
146 mDatePicker->setDisplayFormat(CalenDateUtils::dateFormatString()); |
1378 |
147 mDatePicker->setDate(QDate::currentDate()); |
1379 TRACE_EXIT_POINT; |
148 } |
1380 } |
149 } |
1381 |
150 |
1382 // ---------------------------------------------------------------------------- |
151 /*! |
1383 // CCalenNativeView::IsCalenLaunchedFromExtApp |
152 Slot to handle gotodate |
1384 // other details are commented in the header |
153 */ |
1385 // ---------------------------------------------------------------------------- |
154 void CalenNativeView::goToDate() |
1386 // |
155 { |
1387 TBool CCalenNativeView::IsCalenLaunchedFromExtApp() |
156 OstTraceFunctionEntry0( CALENNATIVEVIEW_GOTODATE_ENTRY ); |
1388 { |
157 |
1389 TRACE_ENTRY_POINT; |
158 // Create a popup with datepicker for the user to select date. |
1390 return iIgnoreTap; |
159 HbDialog *popUp = new HbDialog(); |
1391 TRACE_EXIT_POINT; |
160 popUp->setParent(this); |
1392 } |
161 popUp->setDismissPolicy(HbDialog::NoDismiss); |
1393 // ---------------------------------------------------------------------------- |
162 popUp->setTimeout(HbDialog::NoTimeout); |
1394 // CCalenNativeView::SetCommandHandlingProgress |
163 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
1395 // other details are commented in the header |
164 popUp->setHeadingWidget(new HbLabel(hbTrId("txt_calendar_opt_go_to_date"))); |
1396 // ---------------------------------------------------------------------------- |
|
1397 // |
|
1398 void CCalenNativeView::SetCommandHandlingInProgress( TBool aInProgress ) |
|
1399 { |
|
1400 TRACE_ENTRY_POINT; |
|
1401 |
|
1402 iCommandProcessing = aInProgress; |
|
1403 |
|
1404 TRACE_EXIT_POINT; |
|
1405 } |
165 |
1406 |
166 if(mDatePicker) { |
1407 |
167 mDatePicker = NULL; |
1408 // ---------------------------------------------------------------------------- |
168 } |
1409 // CCalenNativeView::SetEditorActive |
169 mDatePicker = new HbDateTimePicker(QDate::currentDate(), popUp); |
1410 // Returns an array of active collection ids. |
170 // Set the date range. |
1411 // (other items were commented in a header). |
171 mDatePicker->setMinimumDate(CalenDateUtils::minTime().date()); |
|
172 mDatePicker->setMaximumDate(CalenDateUtils::maxTime().date()); |
|
173 mDatePicker->setDisplayFormat(CalenDateUtils::dateFormatString()); |
|
174 mDatePicker->setDate(QDate::currentDate()); |
|
175 |
|
176 popUp->setContentWidget(mDatePicker); |
|
177 HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok")); |
|
178 popUp->addAction(okAction); |
|
179 connect(okAction, SIGNAL(triggered()), this, SLOT(goToSelectedDate())); |
|
180 popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp)); |
|
181 |
|
182 // Close the popup once closeDialogs() is received |
|
183 connect(this, SIGNAL(closeDialogs()), popUp, SLOT(close())); |
|
184 |
|
185 popUp->open(); |
|
186 |
|
187 OstTraceFunctionExit0( CALENNATIVEVIEW_GOTODATE_EXIT ); |
|
188 } |
|
189 |
|
190 /* |
|
191 Slot to handle date selected on gotodate popup |
|
192 */ |
|
193 void CalenNativeView::goToSelectedDate() |
|
194 { |
|
195 OstTraceFunctionEntry0( CALENNATIVEVIEW_GOTOSELECTEDDATE_ENTRY ); |
|
196 |
|
197 QDate selectedDate = mDatePicker->date(); |
|
198 |
|
199 // Check if the selected date is within the range. |
|
200 if (selectedDate.isValid() && |
|
201 selectedDate >= CalenDateUtils::minTime().date() && |
|
202 selectedDate <= CalenDateUtils::maxTime().date()) { |
|
203 MCalenContext& context = mServices.Context(); |
|
204 QDateTime contextDate = context.focusDateAndTime(); |
|
205 |
|
206 //Set the selected date to contextDate. |
|
207 contextDate.setDate(selectedDate); |
|
208 context.setFocusDateAndTime(contextDate); |
|
209 } |
|
210 refreshViewOnGoToDate(); |
|
211 |
|
212 OstTraceFunctionExit0( CALENNATIVEVIEW_GOTOSELECTEDDATE_EXIT ); |
|
213 } |
|
214 |
|
215 /*! |
|
216 Virtual function to refresh the current view upon selecting a date |
|
217 from GoToDate popup |
|
218 */ |
|
219 void CalenNativeView::refreshViewOnGoToDate() |
|
220 { |
|
221 OstTraceFunctionEntry0( CALENNATIVEVIEW_REFRESHVIEWONGOTODATE_ENTRY ); |
|
222 |
|
223 mServices.IssueCommandL(ECalenStartActiveStep); |
|
224 |
|
225 OstTraceFunctionExit0( CALENNATIVEVIEW_REFRESHVIEWONGOTODATE_EXIT ); |
|
226 } |
|
227 |
|
228 /*! |
|
229 Slot to handle setting item in options menu |
|
230 */ |
|
231 void CalenNativeView::launchSettingsView() |
|
232 { |
|
233 OstTraceFunctionEntry0( CALENNATIVEVIEW_LAUNCHSETTINGSVIEW_ENTRY ); |
|
234 |
|
235 mServices.IssueCommandL(ECalenShowSettings); |
|
236 |
|
237 OstTraceFunctionExit0( CALENNATIVEVIEW_LAUNCHSETTINGSVIEW_EXIT ); |
|
238 } |
|
239 |
|
240 /*! |
|
241 Slot to handle to orientation change |
|
242 */ |
|
243 void CalenNativeView::changeOrientation(Qt::Orientation orientation) |
|
244 { |
|
245 OstTraceFunctionEntry0( CALENNATIVEVIEW_CHANGEORIENTATION_ENTRY ); |
|
246 |
|
247 Q_UNUSED(orientation); |
|
248 // Nothing, derived classes will implement it |
|
249 OstTraceFunctionExit0( CALENNATIVEVIEW_CHANGEORIENTATION_EXIT ); |
|
250 } |
|
251 |
|
252 /*! |
|
253 Handles the interested notifications from the calendar framework |
|
254 */ |
|
255 void CalenNativeView::HandleNotification(const TCalenNotification notification) |
|
256 { |
|
257 OstTraceFunctionEntry0( CALENNATIVEVIEW_HANDLENOTIFICATION_ENTRY ); |
|
258 |
|
259 switch (notification) { |
|
260 case ECalenNotifySystemLocaleChanged: { |
|
261 refreshDatePicker(); |
|
262 onLocaleChanged(EChangesLocale); |
|
263 } |
|
264 break; |
|
265 case ECalenNotifySystemTimeChanged: { |
|
266 onLocaleChanged(EChangesSystemTime); |
|
267 } |
|
268 break; |
|
269 case ECalenNotifyContextChanged: { |
|
270 onContextChanged(); |
|
271 } |
|
272 break; |
|
273 case ECalenNotifyCloseDialogs: { |
|
274 // Emit the signal to close the dialogs which are already opened |
|
275 emit closeDialogs(); |
|
276 } |
|
277 break; |
|
278 case ECalenNotifyForcedExit:{ |
|
279 mForcedExit = true; |
|
280 } |
|
281 break; |
|
282 default: |
|
283 break; |
|
284 } |
|
285 |
|
286 OstTraceFunctionExit0( CALENNATIVEVIEW_HANDLENOTIFICATION_EXIT ); |
|
287 } |
|
288 |
|
289 /*! |
|
290 Returns true if plugin is loaded |
|
291 */ |
|
292 TBool CalenNativeView::pluginEnabled() |
|
293 { |
|
294 OstTraceFunctionEntry0( CALENNATIVEVIEW_PLUGINENABLED_ENTRY ); |
|
295 |
|
296 QString *pluginInfo = mServices.InfobarTextL(); |
|
297 if (!pluginInfo) { |
|
298 OstTraceFunctionExit0( CALENNATIVEVIEW_PLUGINENABLED_EXIT ); |
|
299 return false; |
|
300 } else { |
|
301 OstTraceFunctionExit0( DUP1_CALENNATIVEVIEW_PLUGINENABLED_EXIT ); |
|
302 return true; |
|
303 } |
|
304 } |
|
305 |
|
306 QString *CalenNativeView::pluginText() |
|
307 { |
|
308 OstTraceFunctionEntry0( CALENNATIVEVIEW_PLUGINTEXT_ENTRY ); |
|
309 |
|
310 OstTraceFunctionExit0( CALENNATIVEVIEW_PLUGINTEXT_EXIT ); |
|
311 return mServices.InfobarTextL(); |
|
312 |
|
313 } |
|
314 |
|
315 // ---------------------------------------------------------------------------- |
|
316 // captureScreenshot caltures screen shot for the given viewId |
|
317 // @param viewId view for which screenshot needs to be captured |
|
318 // ---------------------------------------------------------------------------- |
1412 // ---------------------------------------------------------------------------- |
319 // |
1413 // |
320 void CalenNativeView::captureScreenshot(bool captureScreenShot) |
1414 void CCalenNativeView::GetActiveCollectionidsL( |
321 { |
1415 MCalenServices& aServices, |
322 OstTraceFunctionEntry0( CALENNATIVEVIEW_CAPTURESCREENSHOT_ENTRY ); |
1416 RArray< TInt >& aCollectionIds ) |
323 |
1417 { |
324 // get a screenshot for saving to the activity manager. It's done for once |
1418 TRACE_ENTRY_POINT; |
325 // to optimize the performance |
1419 RPointerArray<CCalCalendarInfo> calendarInfoList; |
326 if (captureScreenShot) { |
1420 CleanupClosePushL(calendarInfoList); |
327 mScreenShotMetadata.clear(); // remove any screenshot captured earlier |
1421 aServices.GetAllCalendarInfoL(calendarInfoList); |
328 mScreenShotMetadata.insert("screenshot", QPixmap::grabWidget(mainWindow(), mainWindow()->rect())); |
1422 |
329 } |
1423 for(TInt index=0;index<calendarInfoList.Count();index++) |
330 mIsCapturedScreenShotValid = captureScreenShot; // set the validity of the screenshot captured |
1424 { |
331 |
1425 if(calendarInfoList[index]->Enabled()) |
332 OstTraceFunctionExit0( CALENNATIVEVIEW_CAPTURESCREENSHOT_EXIT ); |
1426 { |
333 } |
1427 aCollectionIds.Append( aServices.SessionL( |
334 |
1428 calendarInfoList[index]->FileNameL() ).CollectionIdL() ); |
335 // ---------------------------------------------------------------------------- |
1429 } |
336 // saveActivity saves the activity for current view |
1430 } |
337 // ---------------------------------------------------------------------------- |
1431 |
338 // |
1432 CleanupStack::PopAndDestroy(&calendarInfoList); |
339 void CalenNativeView::saveActivity() |
1433 TRACE_EXIT_POINT; |
340 { |
1434 } |
341 OstTraceFunctionEntry0( CALENNATIVEVIEW_SAVEACTIVITY_ENTRY ); |
1435 |
342 // check if alerady a valid screen shot is captured |
1436 // ---------------------------------------------------------------------------- |
343 if (!mIsCapturedScreenShotValid) { |
1437 // CCalenNativeView::SetFasterAppActive |
344 mScreenShotMetadata.clear(); // remove any screenshot captured earlier |
1438 // Set the flag 'iFasterApp' to ETrue if application is fake exited |
345 mScreenShotMetadata.insert("screenshot", QPixmap::grabWidget(mainWindow(), mainWindow()->rect())); |
1439 // and to EFalse once the application comes to foreground. |
346 } |
1440 // (other items were commented in a header). |
347 |
1441 // ---------------------------------------------------------------------------- |
348 // Save any data necessary to save the state |
1442 void CCalenNativeView::SetFasterAppActive( TBool aFlag ) |
349 QByteArray serializedActivity; |
1443 { |
350 QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); |
1444 TRACE_ENTRY_POINT; |
351 stream << mActivityId; |
1445 TRACE_EXIT_POINT; |
352 |
1446 iFasterAppActive = aFlag; |
353 bool ok(false); |
1447 } |
354 // Save activity |
1448 |
355 ok = mActivityStorage->saveActivity(activityName,serializedActivity,mScreenShotMetadata); |
1449 // ---------------------------------------------------------------------------- |
356 // Check is activity saved sucessfully |
1450 // CCalenNativeView::IsEditorActiveOrFasterAppExit |
357 if ( !ok ) { |
1451 // Returns ETrue whenever editor is active or whenever fake exit is active |
358 qFatal("Add failed" ); // Panic is activity is not saved successfully |
1452 // (other items were commented in a header). |
359 } |
1453 // ---------------------------------------------------------------------------- |
360 OstTraceFunctionExit0( CALENNATIVEVIEW_SAVEACTIVITY_EXIT ); |
1454 // |
361 } |
1455 TBool CCalenNativeView::IsEditorActiveOrFasterAppExit() |
362 |
1456 { |
363 /*! |
1457 TRACE_ENTRY_POINT; |
364 Function to tell if we can perform swipe effect on the preview pane. |
1458 |
365 This will affect when the next preview pane that is not going to |
1459 if( iIsEditorActive || iFasterAppActive || iIsBackgrounded ) |
366 come has valid date or not |
1460 { |
367 */ |
1461 TRACE_EXIT_POINT; |
368 bool CalenNativeView::checkIfWeCanSwipe(QDateTime& date, bool rightGesture) |
1462 return ETrue; |
369 { |
1463 } |
370 OstTraceFunctionEntry0( CALENNATIVEVIEW_CHECKIFWECANSWIPE_ENTRY ); |
1464 else |
371 |
1465 { |
372 bool value; |
1466 TRACE_EXIT_POINT; |
373 // For right gesture, see if previous day is valid or not |
1467 return EFalse; |
374 if (rightGesture) { |
1468 } |
375 value = CalenDateUtils::isValidDay(date.addDays(-1)); |
1469 } |
376 } else { // For left gesture, see if next day is valid or not |
1470 |
377 value = CalenDateUtils::isValidDay(date.addDays(1)); |
1471 // ---------------------------------------------------------------------------- |
378 } |
1472 // CCalenNativeView::SetTapIgnore |
379 |
1473 // Sets flag to ignore tap on any of the views |
380 OstTraceFunctionExit0( CALENNATIVEVIEW_CHECKIFWECANSWIPE_EXIT ); |
1474 // (other items were commented in a header). |
381 |
1475 // ---------------------------------------------------------------------------- |
382 return value; |
1476 // |
383 } |
1477 void CCalenNativeView::SetTapIgnore(TBool aIgnore) |
384 |
1478 { |
385 /*! |
1479 iIgnoreTap = aIgnore; |
386 Function to remove the activity |
1480 } |
387 */ |
1481 |
388 bool CalenNativeView::removeActivity() |
1482 // End of File |
389 { |
|
390 OstTraceFunctionEntry0( CALENNATIVEVIEW_REMOVEACTIVITY_ENTRY ); |
|
391 OstTraceFunctionEntry0( CALENNATIVEVIEW_REMOVEACTIVITY_EXIT ); |
|
392 return mActivityStorage->removeActivity(activityName); |
|
393 } |
|
394 //End Of File |
|