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