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