|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //debug |
|
20 #include "calendarui_debug.h" |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <aknViewAppUi.h> // CAknViewAppUi |
|
24 #include <calenagendautils.h> |
|
25 #include <calinstanceview.h> |
|
26 #include <calencontext.h> |
|
27 #include <caleninstanceid.h> // TCalenInstanceId |
|
28 #include <calenactionuiutils.h> |
|
29 #include <aknappui.h> |
|
30 #include <AknDlgShut.h> |
|
31 #include <gfxtranseffect/gfxtranseffect.h> // For transition effects |
|
32 #include <akntranseffect.h> // For transition effects |
|
33 |
|
34 #include "calenviewmanager.h" |
|
35 #include "calencmdlinelauncher.h" |
|
36 #include "calencontroller.h" // CCalenController |
|
37 #include "calencmdlineparser.h" // CCalCmdLineParser |
|
38 #include "CalenUid.h" |
|
39 #include "calensend.h" |
|
40 #include "calendialogshutter.h" |
|
41 |
|
42 const TUid KCalendarUid = {0x10005901}; // Calendar application UID |
|
43 |
|
44 // ================= MEMBER FUNCTIONS ======================= |
|
45 |
|
46 // --------------------------------------------------------- |
|
47 // CCalenCmdLineLauncher::CCalenCmdLineLauncher |
|
48 // C++ default constructor |
|
49 // (other items were commented in a header). |
|
50 // Status : Draft/Proposal/Approved |
|
51 // --------------------------------------------------------- |
|
52 // |
|
53 CCalenCmdLineLauncher::CCalenCmdLineLauncher( CCalenController& aController, |
|
54 CAknViewAppUi& aAppUi ) |
|
55 : iController( aController ), iAppUi( aAppUi ) |
|
56 { |
|
57 TRACE_ENTRY_POINT; |
|
58 TRACE_EXIT_POINT; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CCalenCmdLineLauncher::NewL |
|
63 // 1st phase of construction |
|
64 // (other items were commented in a header). |
|
65 // Status : Draft/Proposal/Approved |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 CCalenCmdLineLauncher* CCalenCmdLineLauncher::NewL( CCalenController& aController, |
|
69 CAknViewAppUi& aAppUi ) |
|
70 { |
|
71 TRACE_ENTRY_POINT; |
|
72 |
|
73 CCalenCmdLineLauncher* self = new( ELeave ) CCalenCmdLineLauncher( aController, aAppUi ); |
|
74 CleanupStack::PushL( self ); |
|
75 self->ConstructL(); |
|
76 CleanupStack::Pop( self ); |
|
77 |
|
78 TRACE_EXIT_POINT; |
|
79 return self; |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------- |
|
83 // CCalenCmdLineLauncher::~CCalenCmdLineLauncher |
|
84 // Destructor |
|
85 // (other items were commented in a header). |
|
86 // Status : Draft/Proposal/Approved |
|
87 // --------------------------------------------------------- |
|
88 // |
|
89 CCalenCmdLineLauncher::~CCalenCmdLineLauncher() |
|
90 { |
|
91 TRACE_ENTRY_POINT; |
|
92 |
|
93 iController.CancelNotifications( this ); |
|
94 |
|
95 if( iGlobalData ) |
|
96 { |
|
97 iGlobalData->Release(); |
|
98 } |
|
99 |
|
100 delete iCalendarLaunchCallBack; |
|
101 |
|
102 if ( iShutter ) |
|
103 { |
|
104 delete iShutter; |
|
105 iShutter = NULL; |
|
106 } |
|
107 |
|
108 TRACE_EXIT_POINT; |
|
109 } |
|
110 |
|
111 // ---------------------------------------------------------------------------- |
|
112 // CCalenCmdLineLauncher::ConstructL |
|
113 // 2nd phase of construction |
|
114 // (other items were commented in a header). |
|
115 // ---------------------------------------------------------------------------- |
|
116 // |
|
117 void CCalenCmdLineLauncher::ConstructL() |
|
118 { |
|
119 TRACE_ENTRY_POINT; |
|
120 |
|
121 // get the global data |
|
122 iGlobalData = CCalenGlobalData::InstanceL(); |
|
123 |
|
124 |
|
125 RArray<TCalenNotification> exitFlags; |
|
126 exitFlags.Append(ECalenNotifyEntryDeleted); |
|
127 exitFlags.Append(ECalenNotifyInstanceDeleted); |
|
128 exitFlags.Append(ECalenNotifyDialogClosed); |
|
129 exitFlags.Append(ECalenNotifyEntryClosed); |
|
130 |
|
131 iController.RegisterForNotificationsL( this, exitFlags ); |
|
132 |
|
133 exitFlags.Reset(); |
|
134 iShutter = CCalenDialogShutter::NewL( CEikonEnv::Static() ); |
|
135 TRACE_EXIT_POINT; |
|
136 } |
|
137 |
|
138 // ---------------------------------------------------------------------------- |
|
139 // CCalenCmdLineLauncher::ProcessCommandParametersL |
|
140 // takes care of commandline parameter. |
|
141 // (other items were commented in a header). |
|
142 // ---------------------------------------------------------------------------- |
|
143 // |
|
144 TBool CCalenCmdLineLauncher::ProcessCommandParametersL( |
|
145 TApaCommand /*aCommand*/, |
|
146 TFileName& /*aDocumentName*/, |
|
147 const TDesC8& aTail ) |
|
148 { |
|
149 TRACE_ENTRY_POINT; |
|
150 |
|
151 // If aTail is set, other app starts Calendar |
|
152 if( aTail.Length() ) |
|
153 { |
|
154 // If we are displaying a dialog, then Calendar is obviously already open |
|
155 // If we have been launched with cmd line parameters, we need to close the |
|
156 // open dialog and deal with the command line. An example of this would be that |
|
157 // Calendar is in the background with an open entry editor, and is then launched from |
|
158 // the command line to open a new entry editor. We need to close the old editor |
|
159 // using the same 'try and save whatever we can' logic that is used on a forced close |
|
160 // and then open the new editor. We also have to prevent the focus state being updated |
|
161 // and highlighting the old entry in the day view. |
|
162 if( AppUi().IsDisplayingDialog() ) |
|
163 { |
|
164 iIsExitOnDlgClose = EFalse; |
|
165 // Tell the editui that whatever it was doing, it should not alter |
|
166 // the focus state |
|
167 iController.IssueCommandL( ECalenNotifyFocusChange ); |
|
168 |
|
169 iShutter->Cancel(); |
|
170 //close all open dialogs in asynchronous way |
|
171 iShutter->ShutDialogsL(); |
|
172 } |
|
173 |
|
174 // Interpret 8bit data as 16bit unicode data |
|
175 //lint -e{826} Disable the lint warning of the pointer sizes being different |
|
176 const TText* buf = reinterpret_cast<const TText*> (aTail.Ptr()); |
|
177 TPtrC ptr(buf, aTail.Length() / (TInt) sizeof(TText)); |
|
178 |
|
179 // create cmd line parser |
|
180 CCalenCmdLineParser* parser = CCalenCmdLineParser::NewL(); |
|
181 CleanupStack::PushL(parser); |
|
182 // parse parameters |
|
183 parser->ParseCommandLineL(ptr); |
|
184 iCmdParameters = parser->CommandLineParameters(); |
|
185 CleanupStack::PopAndDestroy(); // parser |
|
186 } |
|
187 |
|
188 // If we are launched to a specific view, find and activate it. |
|
189 // Any other launch types are handled in CalendarLaunchCallBack |
|
190 |
|
191 TBool useLaunchCallback = EFalse; |
|
192 MCalenContext &context = iGlobalData->Context(); |
|
193 |
|
194 // If aUseViewerIfAvailable is ETrue then start activate Event view else Editor. |
|
195 TBool aUseViewerIfAvailable = EFalse; |
|
196 |
|
197 // If time variable is set we will use that as context time. |
|
198 TBool focusOnTime = iCmdParameters.iTime != Time::NullTTime() && |
|
199 iCmdParameters.iTime.Int64() != 0 ; // for some reason 0 is now coming through as a null |
|
200 // time during normal app start. perhaps it just hasn't been set. |
|
201 TCalTime focusTime; |
|
202 if( focusOnTime ) |
|
203 { |
|
204 focusTime.SetTimeLocalL( iCmdParameters.iTime ); |
|
205 } |
|
206 else |
|
207 { |
|
208 focusTime = context.DefaultCalTimeForViewsL(); |
|
209 } |
|
210 |
|
211 switch( iCmdParameters.iCommandType ) |
|
212 { |
|
213 case CCalenCmdLineParser::EStartTypeDate: |
|
214 case CCalenCmdLineParser::EStartTypeDay: |
|
215 case CCalenCmdLineParser::EStartTypeToday: |
|
216 case CCalenCmdLineParser::EStartTypeToDo: |
|
217 case CCalenCmdLineParser::EStartTypeWeek: |
|
218 case CCalenCmdLineParser::EStartTypeMonth: |
|
219 { |
|
220 TInt command( 0 ); |
|
221 TUid viewUid = TUid::Null(); |
|
222 switch( iCmdParameters.iCommandType ) |
|
223 { |
|
224 case CCalenCmdLineParser::EStartTypeDate: |
|
225 case CCalenCmdLineParser::EStartTypeDay: |
|
226 case CCalenCmdLineParser::EStartTypeToday: |
|
227 { |
|
228 command = ECalenDayView; |
|
229 viewUid = KUidCalenDayView; |
|
230 } |
|
231 break; |
|
232 case CCalenCmdLineParser::EStartTypeToDo: |
|
233 { |
|
234 command = ECalenTodoView; |
|
235 viewUid = KUidCalenTodoView; |
|
236 } |
|
237 break; |
|
238 case CCalenCmdLineParser::EStartTypeWeek: |
|
239 { |
|
240 command = ECalenWeekView; |
|
241 viewUid = KUidCalenWeekView; |
|
242 } |
|
243 break; |
|
244 case CCalenCmdLineParser::EStartTypeMonth: |
|
245 { |
|
246 command = ECalenMonthView; |
|
247 viewUid = KUidCalenMonthView; |
|
248 } |
|
249 break; |
|
250 default: |
|
251 { |
|
252 ASSERT( 0 ); |
|
253 } |
|
254 } |
|
255 |
|
256 context.SetFocusDateAndTimeL( focusTime, |
|
257 TVwsViewId( KUidCalendar, viewUid ) ); |
|
258 //Themes effect while launching. |
|
259 GfxTransEffect::BeginFullScreen( AknTransEffect::EApplicationStart,TRect(), AknTransEffect::EParameterType, AknTransEffect::GfxTransParam(KCalendarUid, |
|
260 AknTransEffect::TParameter::EActivateExplicitContinue ) ); |
|
261 |
|
262 if( iController.ViewManager().ViewsActivated() ) |
|
263 { |
|
264 iController.IssueCommandL( command ); |
|
265 iController.SetLaunchFromExternalApp( ETrue ); |
|
266 } |
|
267 else |
|
268 { |
|
269 iController.ViewManager().ActivateDefaultViewL( viewUid ); |
|
270 // Comment the following line when the the calendar.exe file is removed |
|
271 // from the startup list. |
|
272 iController.ViewManager().ActivateLocalViewL(viewUid); |
|
273 } |
|
274 } |
|
275 break; |
|
276 |
|
277 case CCalenCmdLineParser::EStartTypeUid: |
|
278 case CCalenCmdLineParser::EStartTypeUidViewer: |
|
279 case CCalenCmdLineParser::EStartTypeUidAlarmViewer: |
|
280 case CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze: |
|
281 { |
|
282 |
|
283 aUseViewerIfAvailable = ETrue; |
|
284 iIsExitOnDlgClose = ETrue; |
|
285 // Set context using local uid before launching this entry in the Event view or Editor |
|
286 SetContextBeforeLaunchL(); |
|
287 |
|
288 if (aUseViewerIfAvailable |
|
289 #ifdef RD_NO_EDIT_REPEATING_TODO_DAYNOTE |
|
290 || iForceUseViewer |
|
291 #endif // RD_NO_EDIT_REPEATING_TODO_DAYNOTE |
|
292 ) |
|
293 { |
|
294 if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewer ) |
|
295 { |
|
296 //When event viewer launched from alarm only we need to ignore tap. (ETrue) |
|
297 iController.BroadcastNotification(ECalenNotifyEventViewLaunchedFromAlarm); |
|
298 if(! iController.ViewManager().ViewsActivated() ) |
|
299 { |
|
300 iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView); |
|
301 } |
|
302 // start in alarm viewer mode |
|
303 iController.IssueCommandL( ECalenEventViewFromAlarm ); |
|
304 } |
|
305 else if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze ) |
|
306 { |
|
307 //When event viewer launched from alarm only we need to ignore tap. (ETrue) |
|
308 iController.BroadcastNotification(ECalenNotifyEventViewLaunchedFromAlarm); |
|
309 if(! iController.ViewManager().ViewsActivated() ) |
|
310 { |
|
311 iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView); |
|
312 } |
|
313 // start in alarm viewer mode (snooze key not available) |
|
314 iController.IssueCommandL( ECalenEventViewFromAlarmStopOnly ); |
|
315 } |
|
316 // Activate the Event view |
|
317 else |
|
318 { |
|
319 if( iController.ViewManager().ViewsActivated() ) |
|
320 { |
|
321 iController.IssueCommandL( ECalenEventView ); |
|
322 iController.SetLaunchFromExternalApp( ETrue ); |
|
323 } |
|
324 else |
|
325 { |
|
326 iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView); |
|
327 } |
|
328 } |
|
329 } |
|
330 else |
|
331 { |
|
332 iController.IssueCommandL( ECalenEditCurrentEntry ); |
|
333 } |
|
334 |
|
335 } |
|
336 break; |
|
337 |
|
338 |
|
339 case CCalenCmdLineParser::EStartTypeNewMeeting: |
|
340 case CCalenCmdLineParser::EStartTypeNewMeetingRequest: |
|
341 case CCalenCmdLineParser::EStartTypeNewAnniv: |
|
342 case CCalenCmdLineParser::EStartTypeNewTodo: |
|
343 { |
|
344 // Activate the day view but send calendar to the background. This handles the |
|
345 // case of a command line launch to a non existent entry uid. |
|
346 // A side effect of this is we will get an unwanted view activation notification |
|
347 // which we need to ignore. |
|
348 // See also StartEditorL and HandleViewActivation |
|
349 context.SetFocusDateAndTimeL( focusTime, |
|
350 TVwsViewId( KUidCalendar, KUidCalenDayView ) ); |
|
351 |
|
352 if(!( iController.ViewManager().ViewsActivated()) ) |
|
353 { |
|
354 iController.ViewManager().ActivateDefaultViewL( KUidCalenDayView ); |
|
355 } |
|
356 |
|
357 CEikonEnv::Static()->RootWin().SetOrdinalPosition( -1, 0 ); |
|
358 useLaunchCallback = ETrue; |
|
359 } |
|
360 break; |
|
361 default: // Launched from app list |
|
362 { |
|
363 context.SetFocusDateAndTimeL( focusTime, |
|
364 TVwsViewId( KUidCalendar, KUidCalenMonthView /*uid*/ ) ); |
|
365 |
|
366 useLaunchCallback = ETrue; |
|
367 break; |
|
368 } |
|
369 } |
|
370 |
|
371 if( useLaunchCallback ) |
|
372 { |
|
373 // Issue the callback |
|
374 if( !iCalendarLaunchCallBack ) |
|
375 { |
|
376 TCallBack callback( StaticCalendarLaunchCallBack, this ); |
|
377 iCalendarLaunchCallBack = new( ELeave ) CAsyncCallBack( callback, |
|
378 CActive::EPriorityStandard ); |
|
379 } |
|
380 // otherwise issue the callback immediately |
|
381 iCalendarLaunchCallBack->CallBack(); |
|
382 } |
|
383 |
|
384 TRACE_EXIT_POINT; |
|
385 return ETrue; |
|
386 } |
|
387 |
|
388 // ---------------------------------------------------------------------------- |
|
389 // CCalenCmdLineLauncher::StaticCalendarLaunchCallBack |
|
390 // Called from processcommand parameters using CAsyncCallBack |
|
391 // (other items were commented in a header). |
|
392 // ---------------------------------------------------------------------------- |
|
393 // |
|
394 TInt CCalenCmdLineLauncher::StaticCalendarLaunchCallBack( TAny* aObject ) |
|
395 { |
|
396 TRACE_ENTRY_POINT; |
|
397 |
|
398 CCalenCmdLineLauncher* thisPtr( static_cast<CCalenCmdLineLauncher*>( aObject ) ); |
|
399 |
|
400 TRACE_EXIT_POINT; |
|
401 return thisPtr->CalendarLaunchCallBack(); |
|
402 } |
|
403 |
|
404 // ---------------------------------------------------------------------------- |
|
405 // CCalenCmdLineLauncher::CalendarLaunchCallBack |
|
406 // Called by StaticCalendarLaunchCallBack, traps leaving version |
|
407 // of function and handles any errors. |
|
408 // (other items were commented in a header). |
|
409 // ---------------------------------------------------------------------------- |
|
410 // |
|
411 TInt CCalenCmdLineLauncher::CalendarLaunchCallBack() |
|
412 { |
|
413 TRACE_ENTRY_POINT; |
|
414 |
|
415 TInt returnValue = 0; |
|
416 TRAPD( error, returnValue = CalendarLaunchCallBackL() ); |
|
417 |
|
418 if ( error != KErrNone ) |
|
419 { |
|
420 if ( iIsExitOnDlgClose ) |
|
421 { |
|
422 // If there has been an error, gracefully exit. |
|
423 TRAPD(error,AppUi().ProcessCommandL( EAknSoftkeyExit )); |
|
424 if(error!=KErrNone) |
|
425 { |
|
426 // do avoid warning |
|
427 } |
|
428 } |
|
429 } |
|
430 |
|
431 TRACE_EXIT_POINT; |
|
432 return returnValue; |
|
433 } |
|
434 |
|
435 // ---------------------------------------------------------------------------- |
|
436 // CCalenCmdLineLauncher::CalendarLaunchCallBack |
|
437 // Called from processcommand parameters using CAsyncCallBack |
|
438 // (other items were commented in a header). |
|
439 // ---------------------------------------------------------------------------- |
|
440 // |
|
441 TInt CCalenCmdLineLauncher::CalendarLaunchCallBackL() |
|
442 { |
|
443 TRACE_ENTRY_POINT; |
|
444 |
|
445 // When entering this function, the Calendar window group |
|
446 // should be at ordinal -1. |
|
447 // When opening to a new entry editor, we should restore the |
|
448 // window group to ordinal 0 before calling EditNewEntryL |
|
449 |
|
450 if( iCmdParameters.iFlag ) |
|
451 { |
|
452 iIsExitOnDlgClose = EFalse; |
|
453 } |
|
454 else |
|
455 { |
|
456 iIsExitOnDlgClose = ETrue; |
|
457 } |
|
458 |
|
459 RWindowGroup& windowGroup = CCoeEnv::Static()->RootWin(); |
|
460 |
|
461 switch( iCmdParameters.iCommandType ) |
|
462 { |
|
463 |
|
464 case CCalenCmdLineParser::EStartTypeNewMeeting: |
|
465 // Launch a new entry editor |
|
466 windowGroup.SetOrdinalPosition( 0, 0 ); |
|
467 iController.IssueCommandL( ECalenNewMeeting ); |
|
468 break; |
|
469 |
|
470 case CCalenCmdLineParser::EStartTypeNewMeetingRequest: |
|
471 windowGroup.SetOrdinalPosition( 0, 0 ); |
|
472 // Launch a new meeting request editor |
|
473 iController.IssueCommandL( ECalenNewMeetingRequest ); |
|
474 break; |
|
475 |
|
476 case CCalenCmdLineParser::EStartTypeNewAnniv: |
|
477 windowGroup.SetOrdinalPosition( 0, 0 ); |
|
478 // Launch a new anniversary editor |
|
479 iController.IssueCommandL( ECalenNewAnniv ); |
|
480 break; |
|
481 |
|
482 case CCalenCmdLineParser::EStartTypeNewTodo: |
|
483 windowGroup.SetOrdinalPosition( 0, 0 ); |
|
484 // Launch a new Todo editor |
|
485 iController.IssueCommandL( ECalenNewTodo ); |
|
486 break; |
|
487 |
|
488 default: |
|
489 iIsExitOnDlgClose = EFalse; |
|
490 break; |
|
491 } |
|
492 |
|
493 TRACE_EXIT_POINT; |
|
494 return KLeaveExit; |
|
495 } |
|
496 |
|
497 // ---------------------------------------------------------------------------- |
|
498 // CCalenCmdLineLauncher::HandleNotification |
|
499 // Handles notifications |
|
500 // (other items were commented in a header). |
|
501 // ---------------------------------------------------------------------------- |
|
502 // |
|
503 void CCalenCmdLineLauncher::HandleNotification(const TCalenNotification aNotification ) |
|
504 { |
|
505 TRACE_ENTRY_POINT; |
|
506 |
|
507 if( aNotification == ECalenNotifyInstanceDeleted || aNotification == ECalenNotifyEntryDeleted ) |
|
508 { |
|
509 // Exit when event is deleted from EventView |
|
510 if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUid |
|
511 || iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidViewer |
|
512 || iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewer |
|
513 || iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze) |
|
514 { |
|
515 if(iIsExitOnDlgClose) |
|
516 { |
|
517 |
|
518 PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) ); |
|
519 iIsExitOnDlgClose = EFalse; |
|
520 } |
|
521 } |
|
522 } |
|
523 else if(iIsExitOnDlgClose && (aNotification == ECalenNotifyDialogClosed) ) |
|
524 { |
|
525 //dont do any thing |
|
526 //This scenario hits, when the application launched from device search application, |
|
527 //User issued a "Cancel" command while adding attachment. |
|
528 } |
|
529 else if(aNotification == ECalenNotifyEntryClosed) |
|
530 { |
|
531 // Exit when Escape pressed in Eventview |
|
532 if(iIsExitOnDlgClose) |
|
533 { |
|
534 PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) ); |
|
535 // iIsExitOnDlgClose = EFalse; |
|
536 } |
|
537 } |
|
538 else if( iIsExitOnDlgClose ) |
|
539 { |
|
540 PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) ); |
|
541 } |
|
542 else if(aNotification == ECalenNotifySettingsClosed) |
|
543 { |
|
544 PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) ); |
|
545 } |
|
546 else |
|
547 { |
|
548 |
|
549 } |
|
550 TRACE_EXIT_POINT; |
|
551 } |
|
552 |
|
553 // ---------------------------------------------------------------------------- |
|
554 // CCalenCmdLineLauncher::SetExitOnDialogclose |
|
555 // (other items were commented in a header). |
|
556 // ---------------------------------------------------------------------------- |
|
557 // |
|
558 void CCalenCmdLineLauncher::SetExitOnDialogclose( TBool aIsExitOnDlgClose ) |
|
559 { |
|
560 iIsExitOnDlgClose = aIsExitOnDlgClose; |
|
561 } |
|
562 |
|
563 // ---------------------------------------------------------------------------- |
|
564 // CCalenCmdLineLauncher::GetExitOnDialogStatus |
|
565 // (other items were commented in a header). |
|
566 // ---------------------------------------------------------------------------- |
|
567 // |
|
568 TBool CCalenCmdLineLauncher::GetExitOnDialogStatus() |
|
569 { |
|
570 return iIsExitOnDlgClose; |
|
571 } |
|
572 |
|
573 // ---------------------------------------------------------------------------- |
|
574 // CCalenCmdLineLauncher::SetContextBeforeLaunchL |
|
575 // Set context using local uid before lauching Event view or Editor. |
|
576 // (other items were commented in a header). |
|
577 // ---------------------------------------------------------------------------- |
|
578 // |
|
579 void CCalenCmdLineLauncher::SetContextBeforeLaunchL() |
|
580 { |
|
581 TRACE_ENTRY_POINT; |
|
582 |
|
583 TCalLocalUid uid( iCmdParameters.iLocalUid ); |
|
584 TCalCollectionId collectionId = iGlobalData->CalSessionL( iCmdParameters.iCalenFileName ).CollectionIdL(); |
|
585 CCalEntry* entry = iGlobalData->EntryViewL( collectionId )->FetchL( uid ); |
|
586 |
|
587 // if entry is found we will open it, otherwise we just exit. |
|
588 User::LeaveIfNull( entry ); |
|
589 |
|
590 CleanupStack::PushL( entry ); |
|
591 |
|
592 TTime instanceTime; |
|
593 TCalTime inscaltime; |
|
594 |
|
595 instanceTime = CalenAgendaUtils::EntryTimeL( *entry ); |
|
596 inscaltime.SetTimeLocalL( instanceTime ); |
|
597 |
|
598 |
|
599 // No editing of repeating todos or day notes. Always use the viewer for these. |
|
600 |
|
601 |
|
602 #ifdef RD_NO_EDIT_REPEATING_TODO_DAYNOTE |
|
603 |
|
604 CCalEntry::TType type = entry->EntryTypeL(); |
|
605 if( type == CCalEntry::ETodo || type == CCalEntry::EEvent ) |
|
606 { |
|
607 TCalRRule rrule; |
|
608 if( entry->GetRRuleL( rrule ) ) |
|
609 { |
|
610 iForceUseViewer = ETrue; |
|
611 } |
|
612 else |
|
613 { |
|
614 // Also repeating if has rdates. |
|
615 RArray<TCalTime> rdates; |
|
616 CleanupClosePushL( rdates ); |
|
617 entry->GetRDatesL( rdates ); |
|
618 if( rdates.Count() ) |
|
619 { |
|
620 iForceUseViewer = ETrue; |
|
621 } |
|
622 CleanupStack::PopAndDestroy( &rdates ); |
|
623 } |
|
624 } |
|
625 #endif // RD_NO_EDIT_REPEATING_TODO_DAYNOTE |
|
626 |
|
627 MCalenContext &context = iGlobalData->Context(); |
|
628 TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime ); |
|
629 id.iColId = collectionId; |
|
630 context.SetInstanceIdL( id, TVwsViewId( KUidCalendar, KUidCalenEventView ) ); |
|
631 |
|
632 CleanupStack::PopAndDestroy( entry ); |
|
633 |
|
634 TRACE_EXIT_POINT; |
|
635 } |
|
636 |
|
637 // ---------------------------------------------------------------------------- |
|
638 // CCalenCmdLineLauncher::AppUi |
|
639 // Get reference of CAknViewAppUi |
|
640 // (other items were commented in a header). |
|
641 // ---------------------------------------------------------------------------- |
|
642 // |
|
643 CAknViewAppUi& CCalenCmdLineLauncher::AppUi() |
|
644 { |
|
645 TRACE_ENTRY_POINT; |
|
646 |
|
647 return iAppUi; |
|
648 |
|
649 TRACE_EXIT_POINT; |
|
650 } |
|
651 |
|
652 // End of File |