89
|
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 |
|
|
155 |
|
|
156 |
// Interpret 8bit data as 16bit unicode data
|
|
157 |
//lint -e{826} Disable the lint warning of the pointer sizes being different
|
|
158 |
const TText* buf = reinterpret_cast<const TText*> (aTail.Ptr());
|
|
159 |
TPtrC ptr(buf, aTail.Length() / (TInt) sizeof(TText));
|
|
160 |
|
|
161 |
// create cmd line parser
|
|
162 |
CCalenCmdLineParser* parser = CCalenCmdLineParser::NewL();
|
|
163 |
CleanupStack::PushL(parser);
|
|
164 |
// parse parameters
|
|
165 |
parser->ParseCommandLineL(ptr);
|
|
166 |
iCmdParameters = parser->CommandLineParameters();
|
|
167 |
CleanupStack::PopAndDestroy(); // parser
|
|
168 |
|
|
169 |
if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewer
|
|
170 |
|| iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze)
|
|
171 |
|
|
172 |
{
|
|
173 |
if(iController.IsEditorActive())
|
|
174 |
{
|
|
175 |
TCalLocalUid uid( iCmdParameters.iLocalUid );
|
|
176 |
TCalCollectionId colId = iGlobalData->CalSessionL( iCmdParameters.iCalenFileName ).CollectionIdL();
|
|
177 |
|
|
178 |
// get the context
|
|
179 |
MCalenContext& context = iController.Services().Context();
|
|
180 |
TCalLocalUid entryUid = context.InstanceId().iEntryLocalUid;
|
|
181 |
TCalCollectionId collectionId = context.InstanceId().iColId;
|
|
182 |
|
|
183 |
if(entryUid == uid && colId == collectionId)
|
|
184 |
{
|
|
185 |
return ETrue;
|
|
186 |
}
|
|
187 |
}
|
|
188 |
}
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
// If we are displaying a dialog, then Calendar is obviously already open
|
|
193 |
// If we have been launched with cmd line parameters, we need to close the
|
|
194 |
// open dialog and deal with the command line. An example of this would be that
|
|
195 |
// Calendar is in the background with an open entry editor, and is then launched from
|
|
196 |
// the command line to open a new entry editor. We need to close the old editor
|
|
197 |
// using the same 'try and save whatever we can' logic that is used on a forced close
|
|
198 |
// and then open the new editor. We also have to prevent the focus state being updated
|
|
199 |
// and highlighting the old entry in the day view.
|
|
200 |
if( AppUi().IsDisplayingDialog() )
|
|
201 |
{
|
|
202 |
iIsExitOnDlgClose = EFalse;
|
|
203 |
// Tell the editui that whatever it was doing, it should not alter
|
|
204 |
// the focus state
|
|
205 |
iController.IssueCommandL( ECalenNotifyFocusChange );
|
|
206 |
|
|
207 |
iShutter->Cancel();
|
|
208 |
//close all open dialogs in asynchronous way
|
|
209 |
iShutter->ShutDialogsL();
|
|
210 |
}
|
|
211 |
}
|
|
212 |
|
|
213 |
// If we are launched to a specific view, find and activate it.
|
|
214 |
// Any other launch types are handled in CalendarLaunchCallBack
|
|
215 |
|
|
216 |
TBool useLaunchCallback = EFalse;
|
|
217 |
MCalenContext &context = iGlobalData->Context();
|
|
218 |
|
|
219 |
// If aUseViewerIfAvailable is ETrue then start activate Event view else Editor.
|
|
220 |
TBool aUseViewerIfAvailable = EFalse;
|
|
221 |
|
|
222 |
// If time variable is set we will use that as context time.
|
|
223 |
TBool focusOnTime = iCmdParameters.iTime != Time::NullTTime() &&
|
|
224 |
iCmdParameters.iTime.Int64() != 0 ; // for some reason 0 is now coming through as a null
|
|
225 |
// time during normal app start. perhaps it just hasn't been set.
|
|
226 |
TCalTime focusTime;
|
|
227 |
if( focusOnTime )
|
|
228 |
{
|
|
229 |
focusTime.SetTimeLocalL( iCmdParameters.iTime );
|
|
230 |
}
|
|
231 |
else
|
|
232 |
{
|
|
233 |
focusTime = context.DefaultCalTimeForViewsL();
|
|
234 |
}
|
|
235 |
|
|
236 |
switch( iCmdParameters.iCommandType )
|
|
237 |
{
|
|
238 |
case CCalenCmdLineParser::EStartTypeDate:
|
|
239 |
case CCalenCmdLineParser::EStartTypeDay:
|
|
240 |
case CCalenCmdLineParser::EStartTypeToday:
|
|
241 |
case CCalenCmdLineParser::EStartTypeToDo:
|
|
242 |
case CCalenCmdLineParser::EStartTypeWeek:
|
|
243 |
case CCalenCmdLineParser::EStartTypeMonth:
|
|
244 |
{
|
|
245 |
TInt command( 0 );
|
|
246 |
TUid viewUid = TUid::Null();
|
|
247 |
switch( iCmdParameters.iCommandType )
|
|
248 |
{
|
|
249 |
case CCalenCmdLineParser::EStartTypeDate:
|
|
250 |
case CCalenCmdLineParser::EStartTypeDay:
|
|
251 |
case CCalenCmdLineParser::EStartTypeToday:
|
|
252 |
{
|
|
253 |
command = ECalenDayView;
|
|
254 |
viewUid = KUidCalenDayView;
|
|
255 |
}
|
|
256 |
break;
|
|
257 |
case CCalenCmdLineParser::EStartTypeToDo:
|
|
258 |
{
|
|
259 |
command = ECalenTodoView;
|
|
260 |
viewUid = KUidCalenTodoView;
|
|
261 |
}
|
|
262 |
break;
|
|
263 |
case CCalenCmdLineParser::EStartTypeWeek:
|
|
264 |
{
|
|
265 |
command = ECalenWeekView;
|
|
266 |
viewUid = KUidCalenWeekView;
|
|
267 |
}
|
|
268 |
break;
|
|
269 |
case CCalenCmdLineParser::EStartTypeMonth:
|
|
270 |
{
|
|
271 |
command = ECalenMonthView;
|
|
272 |
viewUid = KUidCalenMonthView;
|
|
273 |
}
|
|
274 |
break;
|
|
275 |
default:
|
|
276 |
{
|
|
277 |
ASSERT( 0 );
|
|
278 |
}
|
|
279 |
}
|
|
280 |
|
|
281 |
context.SetFocusDateAndTimeL( focusTime,
|
|
282 |
TVwsViewId( KUidCalendar, viewUid ) );
|
|
283 |
//Themes effect while launching.
|
|
284 |
GfxTransEffect::BeginFullScreen( AknTransEffect::EApplicationStart,TRect(), AknTransEffect::EParameterType, AknTransEffect::GfxTransParam(KCalendarUid,
|
|
285 |
AknTransEffect::TParameter::EActivateExplicitContinue ) );
|
|
286 |
|
|
287 |
if( iController.ViewManager().ViewsActivated() )
|
|
288 |
{
|
|
289 |
if(command == ECalenDayView)
|
|
290 |
{
|
|
291 |
iController.BroadcastNotification(ECalenNotifyCalenLaunchedFromExtApp);
|
|
292 |
}
|
|
293 |
iController.IssueCommandL( command );
|
|
294 |
iController.SetLaunchFromExternalApp( ETrue );
|
|
295 |
}
|
|
296 |
else
|
|
297 |
{
|
|
298 |
iController.ViewManager().ActivateDefaultViewL( viewUid );
|
|
299 |
// Comment the following line when the the calendar.exe file is removed
|
|
300 |
// from the startup list.
|
|
301 |
iController.ViewManager().ActivateLocalViewL(viewUid);
|
|
302 |
}
|
|
303 |
}
|
|
304 |
break;
|
|
305 |
|
|
306 |
case CCalenCmdLineParser::EStartTypeUid:
|
|
307 |
case CCalenCmdLineParser::EStartTypeUidViewer:
|
|
308 |
case CCalenCmdLineParser::EStartTypeUidAlarmViewer:
|
|
309 |
case CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze:
|
|
310 |
{
|
|
311 |
|
|
312 |
aUseViewerIfAvailable = ETrue;
|
|
313 |
iIsExitOnDlgClose = ETrue;
|
|
314 |
// Set context using local uid before launching this entry in the Event view or Editor
|
|
315 |
SetContextBeforeLaunchL();
|
|
316 |
|
|
317 |
if (aUseViewerIfAvailable
|
|
318 |
#ifdef RD_NO_EDIT_REPEATING_TODO_DAYNOTE
|
|
319 |
|| iForceUseViewer
|
|
320 |
#endif // RD_NO_EDIT_REPEATING_TODO_DAYNOTE
|
|
321 |
)
|
|
322 |
{
|
|
323 |
if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewer )
|
|
324 |
{
|
|
325 |
//When event viewer launched from alarm only we need to ignore tap. (ETrue)
|
|
326 |
iController.BroadcastNotification(ECalenNotifyCalenLaunchedFromExtApp);
|
|
327 |
if(! iController.ViewManager().ViewsActivated() )
|
|
328 |
{
|
|
329 |
iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView);
|
|
330 |
}
|
|
331 |
// start in alarm viewer mode
|
|
332 |
iController.IssueCommandL( ECalenEventViewFromAlarm );
|
|
333 |
}
|
|
334 |
else if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze )
|
|
335 |
{
|
|
336 |
//When event viewer launched from alarm only we need to ignore tap. (ETrue)
|
|
337 |
iController.BroadcastNotification(ECalenNotifyCalenLaunchedFromExtApp);
|
|
338 |
if(! iController.ViewManager().ViewsActivated() )
|
|
339 |
{
|
|
340 |
iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView);
|
|
341 |
}
|
|
342 |
// start in alarm viewer mode (snooze key not available)
|
|
343 |
iController.IssueCommandL( ECalenEventViewFromAlarmStopOnly );
|
|
344 |
}
|
|
345 |
// Activate the Event view
|
|
346 |
else
|
|
347 |
{
|
|
348 |
if( iController.ViewManager().ViewsActivated() )
|
|
349 |
{
|
|
350 |
iController.IssueCommandL( ECalenEventView );
|
|
351 |
iController.SetLaunchFromExternalApp( ETrue );
|
|
352 |
}
|
|
353 |
else
|
|
354 |
{
|
|
355 |
iController.ViewManager().ActivateDefaultViewL( KUidCalenEventView);
|
|
356 |
// Comment the following line when the the calendar.exe file is removed
|
|
357 |
// from the startup list.
|
|
358 |
iController.ViewManager().ActivateLocalViewL(KUidCalenEventView);
|
|
359 |
}
|
|
360 |
}
|
|
361 |
}
|
|
362 |
else
|
|
363 |
{
|
|
364 |
iController.IssueCommandL( ECalenEditCurrentEntry );
|
|
365 |
}
|
|
366 |
|
|
367 |
}
|
|
368 |
break;
|
|
369 |
|
|
370 |
|
|
371 |
case CCalenCmdLineParser::EStartTypeNewMeeting:
|
|
372 |
case CCalenCmdLineParser::EStartTypeNewMeetingRequest:
|
|
373 |
case CCalenCmdLineParser::EStartTypeNewAnniv:
|
|
374 |
case CCalenCmdLineParser::EStartTypeNewTodo:
|
|
375 |
{
|
|
376 |
// Activate the day view but send calendar to the background. This handles the
|
|
377 |
// case of a command line launch to a non existent entry uid.
|
|
378 |
// A side effect of this is we will get an unwanted view activation notification
|
|
379 |
// which we need to ignore.
|
|
380 |
// See also StartEditorL and HandleViewActivation
|
|
381 |
context.SetFocusDateAndTimeL( focusTime,
|
|
382 |
TVwsViewId( KUidCalendar, KUidCalenDayView ) );
|
|
383 |
|
|
384 |
if(!( iController.ViewManager().ViewsActivated()) )
|
|
385 |
{
|
|
386 |
iController.ViewManager().ActivateDefaultViewL( KUidCalenDayView );
|
|
387 |
}
|
|
388 |
|
|
389 |
CEikonEnv::Static()->RootWin().SetOrdinalPosition( -1, 0 );
|
|
390 |
useLaunchCallback = ETrue;
|
|
391 |
}
|
|
392 |
break;
|
|
393 |
default: // Launched from app list
|
|
394 |
{
|
|
395 |
context.SetFocusDateAndTimeL( focusTime,
|
|
396 |
TVwsViewId( KUidCalendar, KUidCalenMonthView /*uid*/ ) );
|
|
397 |
|
|
398 |
useLaunchCallback = ETrue;
|
|
399 |
break;
|
|
400 |
}
|
|
401 |
}
|
|
402 |
|
|
403 |
if( useLaunchCallback )
|
|
404 |
{
|
|
405 |
// Issue the callback
|
|
406 |
if( !iCalendarLaunchCallBack )
|
|
407 |
{
|
|
408 |
TCallBack callback( StaticCalendarLaunchCallBack, this );
|
|
409 |
iCalendarLaunchCallBack = new( ELeave ) CAsyncCallBack( callback,
|
|
410 |
CActive::EPriorityStandard );
|
|
411 |
}
|
|
412 |
// otherwise issue the callback immediately
|
|
413 |
iCalendarLaunchCallBack->CallBack();
|
|
414 |
}
|
|
415 |
|
|
416 |
TRACE_EXIT_POINT;
|
|
417 |
return ETrue;
|
|
418 |
}
|
|
419 |
|
|
420 |
// ----------------------------------------------------------------------------
|
|
421 |
// CCalenCmdLineLauncher::StaticCalendarLaunchCallBack
|
|
422 |
// Called from processcommand parameters using CAsyncCallBack
|
|
423 |
// (other items were commented in a header).
|
|
424 |
// ----------------------------------------------------------------------------
|
|
425 |
//
|
|
426 |
TInt CCalenCmdLineLauncher::StaticCalendarLaunchCallBack( TAny* aObject )
|
|
427 |
{
|
|
428 |
TRACE_ENTRY_POINT;
|
|
429 |
|
|
430 |
CCalenCmdLineLauncher* thisPtr( static_cast<CCalenCmdLineLauncher*>( aObject ) );
|
|
431 |
|
|
432 |
TRACE_EXIT_POINT;
|
|
433 |
return thisPtr->CalendarLaunchCallBack();
|
|
434 |
}
|
|
435 |
|
|
436 |
// ----------------------------------------------------------------------------
|
|
437 |
// CCalenCmdLineLauncher::CalendarLaunchCallBack
|
|
438 |
// Called by StaticCalendarLaunchCallBack, traps leaving version
|
|
439 |
// of function and handles any errors.
|
|
440 |
// (other items were commented in a header).
|
|
441 |
// ----------------------------------------------------------------------------
|
|
442 |
//
|
|
443 |
TInt CCalenCmdLineLauncher::CalendarLaunchCallBack()
|
|
444 |
{
|
|
445 |
TRACE_ENTRY_POINT;
|
|
446 |
|
|
447 |
TInt returnValue = 0;
|
|
448 |
TRAPD( error, returnValue = CalendarLaunchCallBackL() );
|
|
449 |
|
|
450 |
if ( error != KErrNone )
|
|
451 |
{
|
|
452 |
if ( iIsExitOnDlgClose )
|
|
453 |
{
|
|
454 |
// If there has been an error, gracefully exit.
|
|
455 |
TRAPD(error,AppUi().ProcessCommandL( EAknSoftkeyExit ));
|
|
456 |
if(error!=KErrNone)
|
|
457 |
{
|
|
458 |
// do avoid warning
|
|
459 |
}
|
|
460 |
}
|
|
461 |
}
|
|
462 |
|
|
463 |
TRACE_EXIT_POINT;
|
|
464 |
return returnValue;
|
|
465 |
}
|
|
466 |
|
|
467 |
// ----------------------------------------------------------------------------
|
|
468 |
// CCalenCmdLineLauncher::CalendarLaunchCallBack
|
|
469 |
// Called from processcommand parameters using CAsyncCallBack
|
|
470 |
// (other items were commented in a header).
|
|
471 |
// ----------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
TInt CCalenCmdLineLauncher::CalendarLaunchCallBackL()
|
|
474 |
{
|
|
475 |
TRACE_ENTRY_POINT;
|
|
476 |
|
|
477 |
// When entering this function, the Calendar window group
|
|
478 |
// should be at ordinal -1.
|
|
479 |
// When opening to a new entry editor, we should restore the
|
|
480 |
// window group to ordinal 0 before calling EditNewEntryL
|
|
481 |
|
|
482 |
if( iCmdParameters.iFlag )
|
|
483 |
{
|
|
484 |
iIsExitOnDlgClose = EFalse;
|
|
485 |
}
|
|
486 |
else
|
|
487 |
{
|
|
488 |
iIsExitOnDlgClose = ETrue;
|
|
489 |
}
|
|
490 |
|
|
491 |
RWindowGroup& windowGroup = CCoeEnv::Static()->RootWin();
|
|
492 |
|
|
493 |
switch( iCmdParameters.iCommandType )
|
|
494 |
{
|
|
495 |
|
|
496 |
case CCalenCmdLineParser::EStartTypeNewMeeting:
|
|
497 |
// Launch a new entry editor
|
|
498 |
windowGroup.SetOrdinalPosition( 0, 0 );
|
|
499 |
iController.IssueCommandL( ECalenNewMeeting );
|
|
500 |
break;
|
|
501 |
|
|
502 |
case CCalenCmdLineParser::EStartTypeNewMeetingRequest:
|
|
503 |
windowGroup.SetOrdinalPosition( 0, 0 );
|
|
504 |
// Launch a new meeting request editor
|
|
505 |
iController.IssueCommandL( ECalenNewMeetingRequest );
|
|
506 |
break;
|
|
507 |
|
|
508 |
case CCalenCmdLineParser::EStartTypeNewAnniv:
|
|
509 |
windowGroup.SetOrdinalPosition( 0, 0 );
|
|
510 |
// Launch a new anniversary editor
|
|
511 |
iController.IssueCommandL( ECalenNewAnniv );
|
|
512 |
break;
|
|
513 |
|
|
514 |
case CCalenCmdLineParser::EStartTypeNewTodo:
|
|
515 |
windowGroup.SetOrdinalPosition( 0, 0 );
|
|
516 |
// Launch a new Todo editor
|
|
517 |
iController.IssueCommandL( ECalenNewTodo );
|
|
518 |
break;
|
|
519 |
|
|
520 |
default:
|
|
521 |
iIsExitOnDlgClose = EFalse;
|
|
522 |
break;
|
|
523 |
}
|
|
524 |
|
|
525 |
TRACE_EXIT_POINT;
|
|
526 |
return KLeaveExit;
|
|
527 |
}
|
|
528 |
|
|
529 |
// ----------------------------------------------------------------------------
|
|
530 |
// CCalenCmdLineLauncher::HandleNotification
|
|
531 |
// Handles notifications
|
|
532 |
// (other items were commented in a header).
|
|
533 |
// ----------------------------------------------------------------------------
|
|
534 |
//
|
|
535 |
void CCalenCmdLineLauncher::HandleNotification(const TCalenNotification aNotification )
|
|
536 |
{
|
|
537 |
TRACE_ENTRY_POINT;
|
|
538 |
|
|
539 |
if( aNotification == ECalenNotifyInstanceDeleted || aNotification == ECalenNotifyEntryDeleted )
|
|
540 |
{
|
|
541 |
// Exit when event is deleted from EventView
|
|
542 |
if( iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUid
|
|
543 |
|| iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidViewer
|
|
544 |
|| iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewer
|
|
545 |
|| iCmdParameters.iCommandType == CCalenCmdLineParser::EStartTypeUidAlarmViewerNoSnooze)
|
|
546 |
{
|
|
547 |
if(iIsExitOnDlgClose)
|
|
548 |
{
|
|
549 |
|
|
550 |
PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) );
|
|
551 |
iIsExitOnDlgClose = EFalse;
|
|
552 |
}
|
|
553 |
}
|
|
554 |
}
|
|
555 |
else if(iIsExitOnDlgClose && (aNotification == ECalenNotifyDialogClosed) )
|
|
556 |
{
|
|
557 |
//dont do any thing
|
|
558 |
//This scenario hits, when the application launched from device search application,
|
|
559 |
//User issued a "Cancel" command while adding attachment.
|
|
560 |
}
|
|
561 |
else if(aNotification == ECalenNotifyEntryClosed)
|
|
562 |
{
|
|
563 |
// Exit when Escape pressed in Eventview
|
|
564 |
if(iIsExitOnDlgClose)
|
|
565 |
{
|
|
566 |
PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) );
|
|
567 |
// iIsExitOnDlgClose = EFalse;
|
|
568 |
}
|
|
569 |
}
|
|
570 |
else if( iIsExitOnDlgClose )
|
|
571 |
{
|
|
572 |
PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) );
|
|
573 |
}
|
|
574 |
else if(aNotification == ECalenNotifySettingsClosed)
|
|
575 |
{
|
|
576 |
PIM_TRAPD_HANDLE( AppUi().ProcessCommandL(EAknSoftkeyExit) );
|
|
577 |
}
|
|
578 |
else
|
|
579 |
{
|
|
580 |
|
|
581 |
}
|
|
582 |
TRACE_EXIT_POINT;
|
|
583 |
}
|
|
584 |
|
|
585 |
// ----------------------------------------------------------------------------
|
|
586 |
// CCalenCmdLineLauncher::SetExitOnDialogclose
|
|
587 |
// (other items were commented in a header).
|
|
588 |
// ----------------------------------------------------------------------------
|
|
589 |
//
|
|
590 |
void CCalenCmdLineLauncher::SetExitOnDialogclose( TBool aIsExitOnDlgClose )
|
|
591 |
{
|
|
592 |
iIsExitOnDlgClose = aIsExitOnDlgClose;
|
|
593 |
}
|
|
594 |
|
|
595 |
// ----------------------------------------------------------------------------
|
|
596 |
// CCalenCmdLineLauncher::GetExitOnDialogStatus
|
|
597 |
// (other items were commented in a header).
|
|
598 |
// ----------------------------------------------------------------------------
|
|
599 |
//
|
|
600 |
TBool CCalenCmdLineLauncher::GetExitOnDialogStatus()
|
|
601 |
{
|
|
602 |
return iIsExitOnDlgClose;
|
|
603 |
}
|
|
604 |
|
|
605 |
// ----------------------------------------------------------------------------
|
|
606 |
// CCalenCmdLineLauncher::SetContextBeforeLaunchL
|
|
607 |
// Set context using local uid before lauching Event view or Editor.
|
|
608 |
// (other items were commented in a header).
|
|
609 |
// ----------------------------------------------------------------------------
|
|
610 |
//
|
|
611 |
void CCalenCmdLineLauncher::SetContextBeforeLaunchL()
|
|
612 |
{
|
|
613 |
TRACE_ENTRY_POINT;
|
|
614 |
|
|
615 |
TCalLocalUid uid( iCmdParameters.iLocalUid );
|
|
616 |
TCalCollectionId collectionId = iGlobalData->CalSessionL( iCmdParameters.iCalenFileName ).CollectionIdL();
|
|
617 |
CCalEntry* entry = iGlobalData->EntryViewL( collectionId )->FetchL( uid );
|
|
618 |
|
|
619 |
// if entry is found we will open it, otherwise we just exit.
|
|
620 |
User::LeaveIfNull( entry );
|
|
621 |
|
|
622 |
CleanupStack::PushL( entry );
|
|
623 |
|
|
624 |
TTime instanceTime;
|
|
625 |
TCalTime inscaltime;
|
|
626 |
|
|
627 |
instanceTime = CalenAgendaUtils::EntryTimeL( *entry );
|
|
628 |
inscaltime.SetTimeLocalL( instanceTime );
|
|
629 |
|
|
630 |
|
|
631 |
// No editing of repeating todos or day notes. Always use the viewer for these.
|
|
632 |
|
|
633 |
|
|
634 |
#ifdef RD_NO_EDIT_REPEATING_TODO_DAYNOTE
|
|
635 |
|
|
636 |
CCalEntry::TType type = entry->EntryTypeL();
|
|
637 |
if( type == CCalEntry::ETodo || type == CCalEntry::EEvent )
|
|
638 |
{
|
|
639 |
TCalRRule rrule;
|
|
640 |
if( entry->GetRRuleL( rrule ) )
|
|
641 |
{
|
|
642 |
iForceUseViewer = ETrue;
|
|
643 |
}
|
|
644 |
else
|
|
645 |
{
|
|
646 |
// Also repeating if has rdates.
|
|
647 |
RArray<TCalTime> rdates;
|
|
648 |
CleanupClosePushL( rdates );
|
|
649 |
entry->GetRDatesL( rdates );
|
|
650 |
if( rdates.Count() )
|
|
651 |
{
|
|
652 |
iForceUseViewer = ETrue;
|
|
653 |
}
|
|
654 |
CleanupStack::PopAndDestroy( &rdates );
|
|
655 |
}
|
|
656 |
}
|
|
657 |
#endif // RD_NO_EDIT_REPEATING_TODO_DAYNOTE
|
|
658 |
|
|
659 |
MCalenContext &context = iGlobalData->Context();
|
|
660 |
TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime );
|
|
661 |
id.iColId = collectionId;
|
|
662 |
context.SetInstanceIdL( id, TVwsViewId( KUidCalendar, KUidCalenEventView ) );
|
|
663 |
|
|
664 |
CleanupStack::PopAndDestroy( entry );
|
|
665 |
|
|
666 |
TRACE_EXIT_POINT;
|
|
667 |
}
|
|
668 |
|
|
669 |
// ----------------------------------------------------------------------------
|
|
670 |
// CCalenCmdLineLauncher::AppUi
|
|
671 |
// Get reference of CAknViewAppUi
|
|
672 |
// (other items were commented in a header).
|
|
673 |
// ----------------------------------------------------------------------------
|
|
674 |
//
|
|
675 |
CAknViewAppUi& CCalenCmdLineLauncher::AppUi()
|
|
676 |
{
|
|
677 |
TRACE_ENTRY_POINT;
|
|
678 |
|
|
679 |
return iAppUi;
|
|
680 |
|
|
681 |
TRACE_EXIT_POINT;
|
|
682 |
}
|
|
683 |
|
|
684 |
// End of File
|