author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:11:35 +0300 | |
branch | RCL_3 |
changeset 78 | 356f28cd5ca0 |
parent 74 | 97232defd20e |
child 86 | ed599363c2d7 |
permissions | -rw-r--r-- |
66 | 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 |
{ |
|
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
264 |
if(command == ECalenDayView) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
265 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
266 |
iController.BroadcastNotification(ECalenNotifyCalenLaunchedFromExtApp); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
267 |
} |
66 | 268 |
iController.IssueCommandL( command ); |
269 |
iController.SetLaunchFromExternalApp( ETrue ); |
|
270 |
} |
|
271 |
else |
|
272 |
{ |
|
273 |
iController.ViewManager().ActivateDefaultViewL( viewUid ); |
|
274 |
// Comment the following line when the the calendar.exe file is removed |
|
275 |
// from the startup list. |
|
276 |
iController.ViewManager().ActivateLocalViewL(viewUid); |
|
277 |
} |
|
278 |
} |
|
279 |
break; |
|
280 |
||
281 |
case CCalenCmdLineParser::EStartTypeUid: |
|
282 |
case CCalenCmdLineParser::EStartTypeUidViewer: |
|
283 |
case CCalenCmdLineParser::EStartTypeUidAlarmViewer: |
|
284 |
case CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze: |
|
285 |
{ |
|
286 |
||
287 |
aUseViewerIfAvailable = ETrue; |
|
288 |
iIsExitOnDlgClose = ETrue; |
|
289 |
// Set context using local uid before launching this entry in the Event view or Editor |
|
290 |
SetContextBeforeLaunchL(); |
|
291 |
||
292 |
if (aUseViewerIfAvailable |
|
293 |
#ifdef RD_NO_EDIT_REPEATING_TODO_DAYNOTE |
|
294 |
|| iForceUseViewer |
|
295 |
#endif // RD_NO_EDIT_REPEATING_TODO_DAYNOTE |
|
296 |
) |
|
297 |
{ |
|
298 |
if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewer ) |
|
299 |
{ |
|
300 |
//When event viewer launched from alarm only we need to ignore tap. (ETrue) |
|
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
301 |
iController.BroadcastNotification(ECalenNotifyCalenLaunchedFromExtApp); |
66 | 302 |
if(! iController.ViewManager().ViewsActivated() ) |
303 |
{ |
|
304 |
iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView); |
|
305 |
} |
|
306 |
// start in alarm viewer mode |
|
307 |
iController.IssueCommandL( ECalenEventViewFromAlarm ); |
|
308 |
} |
|
309 |
else if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze ) |
|
310 |
{ |
|
311 |
//When event viewer launched from alarm only we need to ignore tap. (ETrue) |
|
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
312 |
iController.BroadcastNotification(ECalenNotifyCalenLaunchedFromExtApp); |
66 | 313 |
if(! iController.ViewManager().ViewsActivated() ) |
314 |
{ |
|
315 |
iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView); |
|
316 |
} |
|
317 |
// start in alarm viewer mode (snooze key not available) |
|
318 |
iController.IssueCommandL( ECalenEventViewFromAlarmStopOnly ); |
|
319 |
} |
|
320 |
// Activate the Event view |
|
321 |
else |
|
322 |
{ |
|
323 |
if( iController.ViewManager().ViewsActivated() ) |
|
324 |
{ |
|
325 |
iController.IssueCommandL( ECalenEventView ); |
|
326 |
iController.SetLaunchFromExternalApp( ETrue ); |
|
327 |
} |
|
328 |
else |
|
329 |
{ |
|
330 |
iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView); |
|
331 |
} |
|
332 |
} |
|
333 |
} |
|
334 |
else |
|
335 |
{ |
|
336 |
iController.IssueCommandL( ECalenEditCurrentEntry ); |
|
337 |
} |
|
338 |
||
339 |
} |
|
340 |
break; |
|
341 |
||
342 |
||
343 |
case CCalenCmdLineParser::EStartTypeNewMeeting: |
|
344 |
case CCalenCmdLineParser::EStartTypeNewMeetingRequest: |
|
345 |
case CCalenCmdLineParser::EStartTypeNewAnniv: |
|
346 |
case CCalenCmdLineParser::EStartTypeNewTodo: |
|
347 |
{ |
|
348 |
// Activate the day view but send calendar to the background. This handles the |
|
349 |
// case of a command line launch to a non existent entry uid. |
|
350 |
// A side effect of this is we will get an unwanted view activation notification |
|
351 |
// which we need to ignore. |
|
352 |
// See also StartEditorL and HandleViewActivation |
|
353 |
context.SetFocusDateAndTimeL( focusTime, |
|
354 |
TVwsViewId( KUidCalendar, KUidCalenDayView ) ); |
|
355 |
||
356 |
if(!( iController.ViewManager().ViewsActivated()) ) |
|
357 |
{ |
|
358 |
iController.ViewManager().ActivateDefaultViewL( KUidCalenDayView ); |
|
359 |
} |
|
360 |
||
361 |
CEikonEnv::Static()->RootWin().SetOrdinalPosition( -1, 0 ); |
|
362 |
useLaunchCallback = ETrue; |
|
363 |
} |
|
364 |
break; |
|
365 |
default: // Launched from app list |
|
366 |
{ |
|
367 |
context.SetFocusDateAndTimeL( focusTime, |
|
368 |
TVwsViewId( KUidCalendar, KUidCalenMonthView /*uid*/ ) ); |
|
369 |
||
370 |
useLaunchCallback = ETrue; |
|
371 |
break; |
|
372 |
} |
|
373 |
} |
|
374 |
||
375 |
if( useLaunchCallback ) |
|
376 |
{ |
|
377 |
// Issue the callback |
|
378 |
if( !iCalendarLaunchCallBack ) |
|
379 |
{ |
|
380 |
TCallBack callback( StaticCalendarLaunchCallBack, this ); |
|
381 |
iCalendarLaunchCallBack = new( ELeave ) CAsyncCallBack( callback, |
|
382 |
CActive::EPriorityStandard ); |
|
383 |
} |
|
384 |
// otherwise issue the callback immediately |
|
385 |
iCalendarLaunchCallBack->CallBack(); |
|
386 |
} |
|
387 |
||
388 |
TRACE_EXIT_POINT; |
|
389 |
return ETrue; |
|
390 |
} |
|
391 |
||
392 |
// ---------------------------------------------------------------------------- |
|
393 |
// CCalenCmdLineLauncher::StaticCalendarLaunchCallBack |
|
394 |
// Called from processcommand parameters using CAsyncCallBack |
|
395 |
// (other items were commented in a header). |
|
396 |
// ---------------------------------------------------------------------------- |
|
397 |
// |
|
398 |
TInt CCalenCmdLineLauncher::StaticCalendarLaunchCallBack( TAny* aObject ) |
|
399 |
{ |
|
400 |
TRACE_ENTRY_POINT; |
|
401 |
||
402 |
CCalenCmdLineLauncher* thisPtr( static_cast<CCalenCmdLineLauncher*>( aObject ) ); |
|
403 |
||
404 |
TRACE_EXIT_POINT; |
|
405 |
return thisPtr->CalendarLaunchCallBack(); |
|
406 |
} |
|
407 |
||
408 |
// ---------------------------------------------------------------------------- |
|
409 |
// CCalenCmdLineLauncher::CalendarLaunchCallBack |
|
410 |
// Called by StaticCalendarLaunchCallBack, traps leaving version |
|
411 |
// of function and handles any errors. |
|
412 |
// (other items were commented in a header). |
|
413 |
// ---------------------------------------------------------------------------- |
|
414 |
// |
|
415 |
TInt CCalenCmdLineLauncher::CalendarLaunchCallBack() |
|
416 |
{ |
|
417 |
TRACE_ENTRY_POINT; |
|
418 |
||
419 |
TInt returnValue = 0; |
|
420 |
TRAPD( error, returnValue = CalendarLaunchCallBackL() ); |
|
421 |
||
422 |
if ( error != KErrNone ) |
|
423 |
{ |
|
424 |
if ( iIsExitOnDlgClose ) |
|
425 |
{ |
|
426 |
// If there has been an error, gracefully exit. |
|
427 |
TRAPD(error,AppUi().ProcessCommandL( EAknSoftkeyExit )); |
|
428 |
if(error!=KErrNone) |
|
429 |
{ |
|
430 |
// do avoid warning |
|
431 |
} |
|
432 |
} |
|
433 |
} |
|
434 |
||
435 |
TRACE_EXIT_POINT; |
|
436 |
return returnValue; |
|
437 |
} |
|
438 |
||
439 |
// ---------------------------------------------------------------------------- |
|
440 |
// CCalenCmdLineLauncher::CalendarLaunchCallBack |
|
441 |
// Called from processcommand parameters using CAsyncCallBack |
|
442 |
// (other items were commented in a header). |
|
443 |
// ---------------------------------------------------------------------------- |
|
444 |
// |
|
445 |
TInt CCalenCmdLineLauncher::CalendarLaunchCallBackL() |
|
446 |
{ |
|
447 |
TRACE_ENTRY_POINT; |
|
448 |
||
449 |
// When entering this function, the Calendar window group |
|
450 |
// should be at ordinal -1. |
|
451 |
// When opening to a new entry editor, we should restore the |
|
452 |
// window group to ordinal 0 before calling EditNewEntryL |
|
453 |
||
454 |
if( iCmdParameters.iFlag ) |
|
455 |
{ |
|
456 |
iIsExitOnDlgClose = EFalse; |
|
457 |
} |
|
458 |
else |
|
459 |
{ |
|
460 |
iIsExitOnDlgClose = ETrue; |
|
461 |
} |
|
462 |
||
463 |
RWindowGroup& windowGroup = CCoeEnv::Static()->RootWin(); |
|
464 |
||
465 |
switch( iCmdParameters.iCommandType ) |
|
466 |
{ |
|
467 |
||
468 |
case CCalenCmdLineParser::EStartTypeNewMeeting: |
|
469 |
// Launch a new entry editor |
|
470 |
windowGroup.SetOrdinalPosition( 0, 0 ); |
|
471 |
iController.IssueCommandL( ECalenNewMeeting ); |
|
472 |
break; |
|
473 |
||
474 |
case CCalenCmdLineParser::EStartTypeNewMeetingRequest: |
|
475 |
windowGroup.SetOrdinalPosition( 0, 0 ); |
|
476 |
// Launch a new meeting request editor |
|
477 |
iController.IssueCommandL( ECalenNewMeetingRequest ); |
|
478 |
break; |
|
479 |
||
480 |
case CCalenCmdLineParser::EStartTypeNewAnniv: |
|
481 |
windowGroup.SetOrdinalPosition( 0, 0 ); |
|
482 |
// Launch a new anniversary editor |
|
483 |
iController.IssueCommandL( ECalenNewAnniv ); |
|
484 |
break; |
|
485 |
||
486 |
case CCalenCmdLineParser::EStartTypeNewTodo: |
|
487 |
windowGroup.SetOrdinalPosition( 0, 0 ); |
|
488 |
// Launch a new Todo editor |
|
489 |
iController.IssueCommandL( ECalenNewTodo ); |
|
490 |
break; |
|
491 |
||
492 |
default: |
|
493 |
iIsExitOnDlgClose = EFalse; |
|
494 |
break; |
|
495 |
} |
|
496 |
||
497 |
TRACE_EXIT_POINT; |
|
498 |
return KLeaveExit; |
|
499 |
} |
|
500 |
||
501 |
// ---------------------------------------------------------------------------- |
|
502 |
// CCalenCmdLineLauncher::HandleNotification |
|
503 |
// Handles notifications |
|
504 |
// (other items were commented in a header). |
|
505 |
// ---------------------------------------------------------------------------- |
|
506 |
// |
|
507 |
void CCalenCmdLineLauncher::HandleNotification(const TCalenNotification aNotification ) |
|
508 |
{ |
|
509 |
TRACE_ENTRY_POINT; |
|
510 |
||
511 |
if( aNotification == ECalenNotifyInstanceDeleted || aNotification == ECalenNotifyEntryDeleted ) |
|
512 |
{ |
|
513 |
// Exit when event is deleted from EventView |
|
514 |
if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUid |
|
515 |
|| iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidViewer |
|
516 |
|| iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewer |
|
517 |
|| iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze) |
|
518 |
{ |
|
519 |
if(iIsExitOnDlgClose) |
|
520 |
{ |
|
521 |
||
522 |
PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) ); |
|
523 |
iIsExitOnDlgClose = EFalse; |
|
524 |
} |
|
525 |
} |
|
526 |
} |
|
527 |
else if(iIsExitOnDlgClose && (aNotification == ECalenNotifyDialogClosed) ) |
|
528 |
{ |
|
529 |
//dont do any thing |
|
530 |
//This scenario hits, when the application launched from device search application, |
|
531 |
//User issued a "Cancel" command while adding attachment. |
|
532 |
} |
|
533 |
else if(aNotification == ECalenNotifyEntryClosed) |
|
534 |
{ |
|
535 |
// Exit when Escape pressed in Eventview |
|
536 |
if(iIsExitOnDlgClose) |
|
537 |
{ |
|
538 |
PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) ); |
|
539 |
// iIsExitOnDlgClose = EFalse; |
|
540 |
} |
|
541 |
} |
|
542 |
else if( iIsExitOnDlgClose ) |
|
543 |
{ |
|
544 |
PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) ); |
|
545 |
} |
|
546 |
else if(aNotification == ECalenNotifySettingsClosed) |
|
547 |
{ |
|
548 |
PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) ); |
|
549 |
} |
|
550 |
else |
|
551 |
{ |
|
552 |
||
553 |
} |
|
554 |
TRACE_EXIT_POINT; |
|
555 |
} |
|
556 |
||
557 |
// ---------------------------------------------------------------------------- |
|
558 |
// CCalenCmdLineLauncher::SetExitOnDialogclose |
|
559 |
// (other items were commented in a header). |
|
560 |
// ---------------------------------------------------------------------------- |
|
561 |
// |
|
562 |
void CCalenCmdLineLauncher::SetExitOnDialogclose( TBool aIsExitOnDlgClose ) |
|
563 |
{ |
|
564 |
iIsExitOnDlgClose = aIsExitOnDlgClose; |
|
565 |
} |
|
566 |
||
567 |
// ---------------------------------------------------------------------------- |
|
568 |
// CCalenCmdLineLauncher::GetExitOnDialogStatus |
|
569 |
// (other items were commented in a header). |
|
570 |
// ---------------------------------------------------------------------------- |
|
571 |
// |
|
572 |
TBool CCalenCmdLineLauncher::GetExitOnDialogStatus() |
|
573 |
{ |
|
574 |
return iIsExitOnDlgClose; |
|
575 |
} |
|
576 |
||
577 |
// ---------------------------------------------------------------------------- |
|
578 |
// CCalenCmdLineLauncher::SetContextBeforeLaunchL |
|
579 |
// Set context using local uid before lauching Event view or Editor. |
|
580 |
// (other items were commented in a header). |
|
581 |
// ---------------------------------------------------------------------------- |
|
582 |
// |
|
583 |
void CCalenCmdLineLauncher::SetContextBeforeLaunchL() |
|
584 |
{ |
|
585 |
TRACE_ENTRY_POINT; |
|
586 |
||
587 |
TCalLocalUid uid( iCmdParameters.iLocalUid ); |
|
588 |
TCalCollectionId collectionId = iGlobalData->CalSessionL( iCmdParameters.iCalenFileName ).CollectionIdL(); |
|
589 |
CCalEntry* entry = iGlobalData->EntryViewL( collectionId )->FetchL( uid ); |
|
590 |
||
591 |
// if entry is found we will open it, otherwise we just exit. |
|
592 |
User::LeaveIfNull( entry ); |
|
593 |
||
594 |
CleanupStack::PushL( entry ); |
|
595 |
||
596 |
TTime instanceTime; |
|
597 |
TCalTime inscaltime; |
|
598 |
||
599 |
instanceTime = CalenAgendaUtils::EntryTimeL( *entry ); |
|
600 |
inscaltime.SetTimeLocalL( instanceTime ); |
|
601 |
||
602 |
||
603 |
// No editing of repeating todos or day notes. Always use the viewer for these. |
|
604 |
||
605 |
||
606 |
#ifdef RD_NO_EDIT_REPEATING_TODO_DAYNOTE |
|
607 |
||
608 |
CCalEntry::TType type = entry->EntryTypeL(); |
|
609 |
if( type == CCalEntry::ETodo || type == CCalEntry::EEvent ) |
|
610 |
{ |
|
611 |
TCalRRule rrule; |
|
612 |
if( entry->GetRRuleL( rrule ) ) |
|
613 |
{ |
|
614 |
iForceUseViewer = ETrue; |
|
615 |
} |
|
616 |
else |
|
617 |
{ |
|
618 |
// Also repeating if has rdates. |
|
619 |
RArray<TCalTime> rdates; |
|
620 |
CleanupClosePushL( rdates ); |
|
621 |
entry->GetRDatesL( rdates ); |
|
622 |
if( rdates.Count() ) |
|
623 |
{ |
|
624 |
iForceUseViewer = ETrue; |
|
625 |
} |
|
626 |
CleanupStack::PopAndDestroy( &rdates ); |
|
627 |
} |
|
628 |
} |
|
629 |
#endif // RD_NO_EDIT_REPEATING_TODO_DAYNOTE |
|
630 |
||
631 |
MCalenContext &context = iGlobalData->Context(); |
|
632 |
TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime ); |
|
633 |
id.iColId = collectionId; |
|
634 |
context.SetInstanceIdL( id, TVwsViewId( KUidCalendar, KUidCalenEventView ) ); |
|
635 |
||
636 |
CleanupStack::PopAndDestroy( entry ); |
|
637 |
||
638 |
TRACE_EXIT_POINT; |
|
639 |
} |
|
640 |
||
641 |
// ---------------------------------------------------------------------------- |
|
642 |
// CCalenCmdLineLauncher::AppUi |
|
643 |
// Get reference of CAknViewAppUi |
|
644 |
// (other items were commented in a header). |
|
645 |
// ---------------------------------------------------------------------------- |
|
646 |
// |
|
647 |
CAknViewAppUi& CCalenCmdLineLauncher::AppUi() |
|
648 |
{ |
|
649 |
TRACE_ENTRY_POINT; |
|
650 |
||
651 |
return iAppUi; |
|
652 |
||
653 |
TRACE_EXIT_POINT; |
|
654 |
} |
|
655 |
||
656 |
// End of File |