calendarui/views/src/calennativeview.cpp
changeset 0 f979ecb2b13e
child 5 42814f902fe6
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  This class is the base class of all Calendar views.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include <calenconstants.h>
       
    21 #include <calenagendautils.h>
       
    22 #include <calendateutils.h>
       
    23 #include <calentoolbar.h>
       
    24 #include <Calendar.rsg>
       
    25 #include <CalenStatusPaneUtils.h>
       
    26 #include <calencontext.h>
       
    27 #include <caltime.h>
       
    28 #include <calinstance.h>
       
    29 #include <calinstanceview.h>
       
    30 #include <calentry.h>
       
    31 #include <aknlists.h>
       
    32 #include <aknnavide.h>
       
    33 #include <aknnotewrappers.h>
       
    34 #include <AknWaitDialog.h>
       
    35 #include <eikbtgpc.h>
       
    36 #include <centralrepository.h>
       
    37 #include <StringLoader.h>
       
    38 #include <sysutil.h>
       
    39 #include <hlplch.h>
       
    40 #include <akntoolbar.h>
       
    41 #include <calencommands.hrh>
       
    42 #include <calenservices.h>
       
    43 #include <calsession.h>
       
    44 #include <calenviewutils.h>
       
    45 #include <calcalendarinfo.h>
       
    46 
       
    47 #include "calendarui_debug.h"           // Debug.
       
    48 #include "CalendarVariant.hrh"
       
    49 #include "calennativeview.h"
       
    50 #include "calencontainer.h"
       
    51 #include "CalenInterimUtils2.h"
       
    52 #include "calensend.h"
       
    53 #include "calentitlepane.h"
       
    54 #include "CleanupResetAndDestroy.h"
       
    55 #include "CalenPaths.h"
       
    56 #include "calendar.hrh"
       
    57 #include "CalenUid.h"
       
    58 #include "CalendarPrivateCRKeys.h"
       
    59 
       
    60 const TInt KAbbreviatedWeekNames[] =
       
    61     {
       
    62     R_QTN_WEEK_TWO_CHARS_MO,
       
    63     R_QTN_WEEK_TWO_CHARS_TU,
       
    64     R_QTN_WEEK_TWO_CHARS_WE,
       
    65     R_QTN_WEEK_TWO_CHARS_TH,
       
    66     R_QTN_WEEK_TWO_CHARS_FR,
       
    67     R_QTN_WEEK_TWO_CHARS_SA,
       
    68     R_QTN_WEEK_TWO_CHARS_SU
       
    69     };
       
    70 
       
    71 
       
    72 #ifdef RD_CALEN_EXTERNAL_CAL
       
    73 #include  <aiwservicehandler.h>
       
    74 
       
    75 // MIME types
       
    76 _LIT8(KContentTypeCalendar, "text/calendar");
       
    77 
       
    78 #endif //RD_CALEN_EXTERNAL_CAL
       
    79 
       
    80 
       
    81 #include <aknnavilabel.h>
       
    82 #include <calennavilabel.h>
       
    83 
       
    84 
       
    85 // ================= MEMBER FUNCTIONS =======================
       
    86 
       
    87 // ----------------------------------------------------------------------------
       
    88 // CCalenNativeView::~CCalenNativeView
       
    89 // Destructor
       
    90 // (other items were commented in a header).
       
    91 // ----------------------------------------------------------------------------
       
    92 //
       
    93 CCalenNativeView::~CCalenNativeView()
       
    94     {
       
    95     TRACE_ENTRY_POINT;
       
    96 
       
    97     CCoeAppUi* appui = CEikonEnv::Static()->AppUi();
       
    98     appui->RemoveFromStack( iContainer );
       
    99 
       
   100     delete iContainer;
       
   101 
       
   102     iServices.CancelNotifications( this );
       
   103 
       
   104     delete iAbbreviatedDayArray;
       
   105 
       
   106 #ifdef RD_CALEN_EXTERNAL_CAL
       
   107     //delete AIW iServiceHandler;
       
   108     ReleaseServiceHandler();
       
   109 #endif //RD_CALEN_EXTERNAL_CAL
       
   110 
       
   111     delete iMenuName;
       
   112     delete iSettingsName;
       
   113     
       
   114     delete iSPUtils;
       
   115 
       
   116     TRACE_EXIT_POINT;
       
   117     }
       
   118 
       
   119 // ----------------------------------------------------------------------------
       
   120 // CCalenNativeView::SetStatusPaneFromActiveContextL(
       
   121 // This function sets the status pane based upon the context
       
   122 // (other items were commented in a header).
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 void CCalenNativeView::SetStatusPaneFromActiveContextL()
       
   126     {
       
   127     TRACE_ENTRY_POINT;
       
   128     iSPUtils->RefreshStatusPane();
       
   129     TRACE_EXIT_POINT;
       
   130     }
       
   131 
       
   132 // ----------------------------------------------------------------------------
       
   133 // CCalenNativeView::Container
       
   134 // Return container control pointer.
       
   135 // (other items were commented in a header).
       
   136 // ----------------------------------------------------------------------------
       
   137 //
       
   138 CCalenContainer* CCalenNativeView::Container()
       
   139     {
       
   140     TRACE_ENTRY_POINT;
       
   141 
       
   142     TRACE_EXIT_POINT;
       
   143     return iContainer;
       
   144     }
       
   145 
       
   146 // ----------------------------------------------------------------------------
       
   147 // CCalenNativeView::OnCmdGotoDateL
       
   148 // Handling command "Go to day"
       
   149 // (other items were commented in a header).
       
   150 // ----------------------------------------------------------------------------
       
   151 //
       
   152 void CCalenNativeView::OnCmdGotoDateL()
       
   153     {
       
   154     TRACE_ENTRY_POINT;
       
   155 
       
   156     TTime date = CalenDateUtils::Today();
       
   157 	
       
   158     TInt buttonId = CalenViewUtils::DateQueryL( date, 0 );
       
   159 	
       
   160 		//test
       
   161 	TDateTime dateTime = date.DateTime();
       
   162 	
       
   163     if (buttonId == EAknSoftkeyOk || buttonId == EEikBidOk)
       
   164         {
       
   165         MCalenContext& context = iServices.Context();
       
   166         TCalTime dateCalTime;
       
   167         dateCalTime.SetTimeLocalL( date );
       
   168         context.SetFocusDateAndTimeL( dateCalTime, context.ViewId() );
       
   169         iContainer->NotifyChangeDateL();
       
   170         }
       
   171 
       
   172     TRACE_EXIT_POINT;
       
   173     }
       
   174 
       
   175 // ----------------------------------------------------------------------------
       
   176 // CCalenNativeView::OnCmdGotoTodayL
       
   177 // Handling command "Today". # key is pressed.
       
   178 // (other items were commented in a header).
       
   179 // ----------------------------------------------------------------------------
       
   180 //
       
   181 void CCalenNativeView::OnCmdGotoTodayL()
       
   182     {
       
   183     TRACE_ENTRY_POINT;
       
   184 
       
   185     TTime today = CalenDateUtils::Today();
       
   186 
       
   187     MCalenContext& context = iServices.Context();
       
   188     TCalTime todayCalTime;
       
   189     todayCalTime.SetTimeLocalL( today );
       
   190     context.SetFocusDateAndTimeL( todayCalTime, context.ViewId() );
       
   191 
       
   192     iContainer->NotifyChangeDateL();
       
   193 
       
   194     TRACE_EXIT_POINT;
       
   195     }
       
   196 
       
   197 // ----------------------------------------------------------------------------
       
   198 // CCalenNativeView::NotifyFocusChanged
       
   199 // Notified that the focus of Container changes.
       
   200 // (other items were commented in a header).
       
   201 // ----------------------------------------------------------------------------
       
   202 //
       
   203 void CCalenNativeView::NotifyFocusChanged()
       
   204     {
       
   205     TRACE_ENTRY_POINT;
       
   206 
       
   207     // FIXME: iLocChangeReason doesn't seem to serve any purpose.
       
   208     // Debug how it is used.
       
   209     if (iContainer && iNeedsRefresh)
       
   210         {
       
   211         if (IsForeground() && IsContainerFocused())
       
   212             {
       
   213             //The database was changed while calendar was running as a
       
   214             //background task or the editor was open.  We need to refresh.
       
   215             TRAP_IGNORE(BeginRepopulationL());
       
   216             iNeedsRefresh = EFalse;
       
   217             }
       
   218         }
       
   219     if (iLocChangeReason && IsContainerFocused())
       
   220         {
       
   221         PIM_TRAPD_HANDLE( OnLocaleChangedL( iLocChangeReason ) );
       
   222         }
       
   223     iLocChangeReason = 0;
       
   224 
       
   225     TRACE_EXIT_POINT;
       
   226     }
       
   227 
       
   228 // ----------------------------------------------------------------------------
       
   229 // CCalenNativeView::IsContainerFocused
       
   230 // Is container focused?
       
   231 // (other items were commented in a header).
       
   232 // ----------------------------------------------------------------------------
       
   233 //
       
   234 TBool CCalenNativeView::IsContainerFocused()
       
   235     {
       
   236     TRACE_ENTRY_POINT;
       
   237 
       
   238     TRACE_EXIT_POINT;
       
   239     return (iContainer && iContainer->IsVisible());
       
   240     }
       
   241 
       
   242 // ----------------------------------------------------------------------------
       
   243 // CCalenNativeView::ShowValidScrollButtons
       
   244 // (other items were commented in a header).
       
   245 // ----------------------------------------------------------------------------
       
   246 //
       
   247 void CCalenNativeView::ShowValidScrollButtons(CAknNavigationDecorator& aNaviLabel,
       
   248                                         const TTime& aBeforeRange,
       
   249                                         const TTime& aAfterRange)
       
   250     {
       
   251     TRACE_ENTRY_POINT;
       
   252 
       
   253     aNaviLabel.MakeScrollButtonVisible(ETrue);
       
   254 
       
   255     // FIXME can be written more simply.
       
   256     TBool mirrored(AknLayoutUtils::LayoutMirrored());
       
   257     if (mirrored)
       
   258         {
       
   259         TBool validDay(CalenDateUtils::IsValidDay(aBeforeRange));
       
   260         aNaviLabel.SetScrollButtonDimmed(
       
   261             CAknNavigationDecorator::ERightButton, !validDay);
       
   262         validDay = CalenDateUtils::IsValidDay(TTime(aAfterRange));
       
   263         aNaviLabel.SetScrollButtonDimmed(
       
   264             CAknNavigationDecorator::ELeftButton, !validDay);
       
   265         }
       
   266     else
       
   267         {
       
   268         TBool validDay(CalenDateUtils::IsValidDay(aBeforeRange));
       
   269         aNaviLabel.SetScrollButtonDimmed(
       
   270             CAknNavigationDecorator::ELeftButton, !validDay);
       
   271         validDay = CalenDateUtils::IsValidDay(aAfterRange);
       
   272         aNaviLabel.SetScrollButtonDimmed(
       
   273             CAknNavigationDecorator::ERightButton, !validDay);
       
   274         }
       
   275 
       
   276 
       
   277     if(iContainer && AknLayoutUtils::PenEnabled())
       
   278         {
       
   279         aNaviLabel.SetNaviDecoratorObserver(static_cast<MAknNaviDecoratorObserver*>(iContainer));
       
   280         CCoeControl* coeRes = aNaviLabel.DecoratedControl();
       
   281         CCalenNaviLabel *actualLabel = static_cast<CCalenNaviLabel*>(coeRes);
       
   282         actualLabel->SetLabelObserver(static_cast<MCCalenNaviLabelObserver*>(iContainer));
       
   283         }
       
   284 
       
   285 
       
   286     TRACE_EXIT_POINT;
       
   287     }
       
   288 
       
   289 // ----------------------------------------------------------------------------
       
   290 // CCalenNativeView::DynInitMenuPaneL
       
   291 // Initialization of Options menu
       
   292 // (other items were commented in a header).
       
   293 // ----------------------------------------------------------------------------
       
   294 //
       
   295 void CCalenNativeView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
       
   296     {
       
   297     TRACE_ENTRY_POINT;
       
   298 
       
   299     switch (aResourceId)
       
   300         {
       
   301         case R_CALENDAR_NOTETYPE_MENUPANE:
       
   302             {
       
   303             if( !iServices.InterimUtilsL().MRViewersEnabledL( ETrue ) )
       
   304                 {
       
   305                 aMenuPane->DeleteMenuItem( ECalenNewMeetingRequest );
       
   306                 }
       
   307             break;
       
   308             }
       
   309         case R_CALENDAR_CHANGE_VIEW_MENUPANE:
       
   310             {
       
   311             // If we get the cascading view switch menu pane, 
       
   312             // need to offer it to the services, to remove
       
   313             // the current view.
       
   314             iServices.OfferMenuPaneL( aResourceId, aMenuPane );
       
   315             }
       
   316             break;
       
   317         default:
       
   318             {
       
   319 #ifdef RD_CALEN_EXTERNAL_CAL
       
   320             // do we have a service handler, if not create one
       
   321             if (!iServiceHandler)
       
   322                 {
       
   323                 CreateServiceHandlerL(ETrue);
       
   324                 }
       
   325 
       
   326 
       
   327             if (iServiceHandler->HandleSubmenuL(*aMenuPane))
       
   328                 {
       
   329                 return;
       
   330                 }
       
   331 
       
   332             // is the menu item AIW menu item if so, we will initialize our menu item
       
   333             if (iServiceHandler->IsAiwMenu(aResourceId))
       
   334                 {
       
   335                 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL();
       
   336                 TInt extrainfo=0;
       
   337                 TAiwVariant variant(extrainfo);
       
   338                 // No generic param for integer, therefore use EGenericParamError.
       
   339                 TAiwGenericParam param(EGenericParamError, variant);
       
   340                 inParamList.AppendL(param);
       
   341 
       
   342                 iServiceHandler->InitializeMenuPaneL(
       
   343                     *aMenuPane,
       
   344                     aResourceId,
       
   345                     ECalenExtAiwCommandId,
       
   346                     inParamList);
       
   347                 }
       
   348 #endif
       
   349             break;
       
   350             }
       
   351         }
       
   352     TRACE_EXIT_POINT;
       
   353     }
       
   354 
       
   355 // ----------------------------------------------------------------------------
       
   356 // CCalenNativeView::HandleCommandL
       
   357 // Command handling for each view
       
   358 // (other items were commented in a header).
       
   359 // ----------------------------------------------------------------------------
       
   360 //
       
   361 void CCalenNativeView::HandleCommandL(TInt aCommand)
       
   362     {
       
   363     TRACE_ENTRY_POINT;
       
   364 
       
   365      switch (aCommand)
       
   366         {
       
   367         case EAknCmdHelp:
       
   368             HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), iAvkonAppUi->AppHelpContextL() );
       
   369             break;
       
   370 
       
   371         // Context should be 8am on current focused day for these actions.
       
   372         case ECalenNewMeeting:
       
   373         case ECalenNewMeetingRequest:
       
   374         case ECalenNewAnniv:
       
   375         case ECalenNewDayNote:
       
   376         case ECalenNewTodo:
       
   377             {
       
   378             iIsEditorActive = ETrue;
       
   379             MCalenContext& context = iServices.Context();
       
   380             // Set the date on the context. It will set it to be the
       
   381             // default of view (8am) on that day as we don't set the time.
       
   382             TCalTime time;
       
   383             time.SetTimeLocalL( CCalenContainer::DateFromContextL( context ) );
       
   384             context.SetFocusDateL( time,
       
   385                                    TVwsViewId( KUidCalendar, Id() ) );
       
   386             iServices.IssueCommandL( aCommand );
       
   387             }
       
   388             break;
       
   389         case ECalenShowSettings:
       
   390             {
       
   391             iIsEditorActive = ETrue;
       
   392             iServices.IssueCommandL( aCommand );
       
   393             }
       
   394             break;
       
   395         case ECalenMonthView:
       
   396         case ECalenWeekView:
       
   397         case ECalenDayView:
       
   398         case ECalenTodoView:
       
   399             {
       
   400             MCalenContext& context = iServices.Context();
       
   401             // Set the date on the context. It will set it to be the
       
   402             // default of view (8am) on that day as we don't set the time.
       
   403             TCalTime time;
       
   404             time.SetTimeLocalL( CCalenContainer::DateFromContextL( context ) );
       
   405             context.SetFocusDateL( time,
       
   406                                    TVwsViewId( KUidCalendar, Id() ) );
       
   407             iServices.IssueCommandL( aCommand );
       
   408             }
       
   409             break;
       
   410 
       
   411         // The context should remain the same for these actions.
       
   412         case ECalenEventView:
       
   413         case ECalenForwardsToDayView:
       
   414         case ECalenNextView:
       
   415         case ECalenPrevView:
       
   416         case ECalenSwitchView:
       
   417         case ECalenViewCurrentEntry:
       
   418         case ECalenEditCurrentEntry: 
       
   419         case ECalenCompleteTodo:
       
   420         case ECalenRestoreTodo:
       
   421         case ECalenDeleteAllEntries:
       
   422         case ECalenDeleteCurrentEntry:
       
   423         case ECalenDeleteEntriesBeforeDate:
       
   424         //case ECalenGlobalSendAsCmdId:
       
   425         case ECalenSend:
       
   426             
       
   427             if( aCommand != ECalenSwitchView )
       
   428                 {
       
   429                 // Mark the flag telling that the command is being handled
       
   430                 SetCommandHandlingInProgress( ETrue );
       
   431                 }
       
   432 
       
   433             iServices.IssueCommandL( aCommand );
       
   434             break;
       
   435 
       
   436         case ECalenGotoDate:
       
   437             OnCmdGotoDateL();
       
   438             break;
       
   439 
       
   440         case ECalenGotoToday:
       
   441             OnCmdGotoTodayL();
       
   442             break;
       
   443 
       
   444         default:
       
   445             {
       
   446 #ifdef RD_CALEN_EXTERNAL_CAL
       
   447             // by default we will check also AIW commands
       
   448             if (!iServiceHandler)
       
   449                 {
       
   450                 CreateServiceHandlerL(ETrue);
       
   451                 }
       
   452 
       
   453 
       
   454             TInt aiwCmd = iServiceHandler->ServiceCmdByMenuCmd(aCommand);
       
   455 
       
   456             // if we have right one, handle it
       
   457             if(aiwCmd)
       
   458                 {
       
   459                 // add current focused date to param list
       
   460                 MCalenContext& context = iServices.Context();
       
   461                 TTime time = context.FocusTime().TimeLocalL();
       
   462 
       
   463                 CAiwGenericParamList& inparams=iServiceHandler->InParamListL();
       
   464                 TAiwGenericParam date(EGenericParamDateTime);
       
   465                 date.Value().Set(time);
       
   466                 inparams.AppendL(date);
       
   467 
       
   468                 // Execute AIW menu service command.
       
   469                 PIM_TRAPD_HANDLE(
       
   470                 iServiceHandler->ExecuteMenuCmdL(
       
   471                     aCommand,                           // The service command
       
   472                     inparams,    // pass our date
       
   473                     iServiceHandler->OutParamListL(),   // No output parameters needed
       
   474                     KAiwOptASyncronous,                  // we are using async version
       
   475                     this ));                             // and we want to call us back
       
   476                 }
       
   477             // if not then let ui framwork handle it
       
   478 
       
   479             else
       
   480                 {
       
   481 #endif
       
   482                 iServices.IssueCommandL( aCommand );
       
   483 
       
   484 #ifdef RD_CALEN_EXTERNAL_CAL
       
   485                 }
       
   486 #endif // RD_CALEN_EXTERNAL_CAL
       
   487 
       
   488             break;
       
   489 
       
   490             }
       
   491 
       
   492         }
       
   493 
       
   494     TRACE_EXIT_POINT;
       
   495     }
       
   496 
       
   497 // ----------------------------------------------------------------------------
       
   498 // CCalenNativeView::DynInitMenuBarL
       
   499 // other details are commented in the header
       
   500 // ----------------------------------------------------------------------------
       
   501 //
       
   502 void CCalenNativeView::DynInitMenuBarL( TInt /*aResourceId*/, CEikMenuBar* aMenuBar )
       
   503     {
       
   504     TRACE_ENTRY_POINT;
       
   505     
       
   506     if( aMenuBar && IsCommandHandlingInProgress() )
       
   507         {
       
   508         aMenuBar->StopDisplayingMenuBar();
       
   509         }
       
   510     
       
   511     TRACE_EXIT_POINT;
       
   512     }
       
   513 
       
   514 // ----------------------------------------------------------------------------
       
   515 // C++ constructor can NOT contain any code, that
       
   516 // might leave.
       
   517 // ----------------------------------------------------------------------------
       
   518 //
       
   519 CCalenNativeView::CCalenNativeView( MCalenServices& aServices )
       
   520     : iServices( aServices )
       
   521     {
       
   522     TRACE_ENTRY_POINT;
       
   523     TRACE_EXIT_POINT;
       
   524     }
       
   525 
       
   526 // ----------------------------------------------------------------------------
       
   527 // CCalenNativeView::ConstructL
       
   528 // Symbian OS default constructor
       
   529 // (other items were commented in a header).
       
   530 // ----------------------------------------------------------------------------
       
   531 //
       
   532 void CCalenNativeView::CommonConstructL( TInt aViewResource )
       
   533     {
       
   534     TRACE_ENTRY_POINT;
       
   535 
       
   536     BaseConstructL( aViewResource );
       
   537     
       
   538     // Initialize CCalenStatusPaneUtils
       
   539     CEikStatusPane* sp = StatusPane();
       
   540     iSPUtils = CCalenStatusPaneUtils::NewL( sp );
       
   541 
       
   542     ClearViewSpecificDataL(); // Reset vsd.
       
   543 
       
   544     // Create services API and register for notifications
       
   545     RArray<TCalenNotification> notificationArray;
       
   546     notificationArray.Append(ECalenNotifySystemTimeChanged);
       
   547     notificationArray.Append(ECalenNotifyMarkedEntryDeleted);
       
   548     notificationArray.Append(ECalenNotifyContextChanged);
       
   549     notificationArray.Append(ECalenNotifyDialogClosed);
       
   550     notificationArray.Append(ECalenNotifyEntrySent);    
       
   551     notificationArray.Append(ECalenNotifyEntryClosed);
       
   552     notificationArray.Append(ECalenNotifySystemLocaleChanged);
       
   553     notificationArray.Append(ECalenNotifyAppForegrounded);
       
   554     notificationArray.Append(ECalenNotifyAppBackgrounded);
       
   555     notificationArray.Append(ECalenNotifyEntrySaved);
       
   556     notificationArray.Append(ECalenNotifyInstanceSaved);
       
   557     notificationArray.Append(ECalenNotifySettingsClosed);
       
   558     notificationArray.Append(ECalenNotifySettingsChanged);
       
   559     notificationArray.Append(ECalenNotifyMarkedEntryCompleted);
       
   560     notificationArray.Append(ECalenNotifyDeleteInstanceView);
       
   561     notificationArray.Append(ECalenNotifyStopAlarm);
       
   562 	notificationArray.Append(ECalenNotifyDeleteFailed);
       
   563 	notificationArray.Append(ECalenNotifyEntryDeleted);
       
   564 	
       
   565     iServices.RegisterForNotificationsL( this,notificationArray);
       
   566     
       
   567     notificationArray.Reset();
       
   568     
       
   569     iCommandProcessing = EFalse;
       
   570 
       
   571     TRACE_EXIT_POINT;
       
   572     }
       
   573 
       
   574 // ----------------------------------------------------------------------------
       
   575 // CCalenNativeView::CreateContainerL
       
   576 // A container control is created.
       
   577 // (other items were commented in a header).
       
   578 // ----------------------------------------------------------------------------
       
   579 //
       
   580 void CCalenNativeView::CreateContainerL()
       
   581     {
       
   582     TRACE_ENTRY_POINT;
       
   583 
       
   584     if (!iContainer)
       
   585         {
       
   586         CCalenContainer* container = CreateContainerImplL();
       
   587         CleanupStack::PushL(container);
       
   588         container->SetMopParent(this);
       
   589         container->ConstructL();
       
   590         CleanupStack::Pop(); // container
       
   591 
       
   592         iContainer = container;
       
   593         iContainer->SetRect( ClientRect() );
       
   594         iContainer->ActivateL();
       
   595         }
       
   596     else
       
   597         {
       
   598         iContainer->MakeVisible(ETrue);
       
   599         }
       
   600 
       
   601     TRACE_EXIT_POINT;
       
   602     }
       
   603 
       
   604 // ----------------------------------------------------------------------------
       
   605 // CCalenNativeView::AbbreviatedDayArrayL
       
   606 // Returns an array of descriptors of abbreviated days (e.g. MO, TU). This
       
   607 // will only get called by the month and week views.
       
   608 // (other items were commented in a header).
       
   609 // ----------------------------------------------------------------------------
       
   610 //
       
   611 const CDesCArrayFlat& CCalenNativeView::AbbreviatedDayArrayL()
       
   612     {
       
   613     TRACE_ENTRY_POINT;
       
   614 
       
   615     if( !iAbbreviatedDayArray )
       
   616         {
       
   617         iAbbreviatedDayArray = new( ELeave )CDesCArrayFlat( 7 );
       
   618         HBufC* dayAbb;
       
   619 
       
   620         for ( TInt i(0); i<7; ++i )
       
   621             {
       
   622             dayAbb = StringLoader::LoadLC( KAbbreviatedWeekNames[i] );
       
   623             iAbbreviatedDayArray->AppendL( *dayAbb );
       
   624             CleanupStack::PopAndDestroy( dayAbb );
       
   625             }
       
   626         }
       
   627 
       
   628     TRACE_EXIT_POINT;
       
   629     return *iAbbreviatedDayArray;
       
   630     }
       
   631 
       
   632 // ----------------------------------------------------------------------------
       
   633 // CCalenNativeView::DoActivateL
       
   634 // View activation handler
       
   635 // (other items were commented in a header).
       
   636 // ----------------------------------------------------------------------------
       
   637 //
       
   638 void CCalenNativeView::DoActivateL( const TVwsViewId& aPrevViewId,
       
   639                                     TUid aCustomMessageId,
       
   640                                     const TDesC8& aCustomMessage)
       
   641     {
       
   642     TRACE_ENTRY_POINT;
       
   643 
       
   644     iLocChangeReason = 0;
       
   645 
       
   646     if( KCalenHideInBackGround.iUid == aCustomMessageId.iUid )
       
   647 	    {
       
   648 	    SetFasterAppActive(ETrue);
       
   649 	    DoDeactivate();	
       
   650 	    }
       
   651 
       
   652     if (!iNaviContainer)
       
   653         {
       
   654         CEikStatusPane* sp = StatusPane();
       
   655         iNaviContainer =
       
   656             static_cast<CAknNavigationControlContainer*>(
       
   657                         sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
       
   658         }
       
   659 
       
   660     iNaviContainer->Pop();
       
   661 
       
   662     if( AknLayoutUtils::PenEnabled() )
       
   663         {
       
   664         MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
       
   665         if(toolbarImpl)
       
   666             {
       
   667             CAknToolbar& toolbar = toolbarImpl->Toolbar();
       
   668             toolbar.SetToolbarVisibility(ETrue);
       
   669             }
       
   670         }
       
   671 
       
   672     if ( Toolbar() )
       
   673         {
       
   674         ShowToolbarOnViewActivation( ETrue );
       
   675         }
       
   676 
       
   677     CreateContainerL();
       
   678 
       
   679     DoActivateImplL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   680 
       
   681     TRACE_EXIT_POINT;
       
   682     }
       
   683 
       
   684 // ----------------------------------------------------------------------------
       
   685 // CCalenNativeView::DoDeactivate
       
   686 // View deactivation handler
       
   687 // (other items were commented in a header).
       
   688 // ----------------------------------------------------------------------------
       
   689 //
       
   690 void CCalenNativeView::DoDeactivate()
       
   691     {
       
   692     TRACE_ENTRY_POINT;
       
   693 #ifdef RD_CALEN_EXTERNAL_CAL
       
   694     //delete AIW iServiceHandler;
       
   695     ReleaseServiceHandler();
       
   696 #endif //RD_CALEN_EXTERNAL_CAL
       
   697 
       
   698     if (iContainer)
       
   699         {
       
   700         iContainer->RemoveFromStackAndMakeInvisible();
       
   701         DoDeactivateImpl();
       
   702         delete iContainer;
       
   703         iContainer = NULL;
       
   704         }
       
   705     TRACE_EXIT_POINT;
       
   706     }
       
   707 
       
   708 // ----------------------------------------------------------------------------
       
   709 // CCalenNativeView::HandleDBChangeL
       
   710 // Called from CCalenGlobalData when the agenda database
       
   711 // is modified from an external session.
       
   712 // ----------------------------------------------------------------------------
       
   713 //
       
   714 void CCalenNativeView::HandleDBChangeL()
       
   715     {
       
   716     TRACE_ENTRY_POINT;
       
   717 
       
   718     // If iContainer is NULL then this is not the active view, so do nothing.
       
   719     // The view will be refreshed when the container is constructed.
       
   720     if ( iContainer )
       
   721         {
       
   722         if (IsForeground() && Container()->ComponentControl(0)->IsFocused())
       
   723             {
       
   724             // Application is in the foreground and the container is visible
       
   725             // on screen.  We know that the editor is not open as the
       
   726             // containers first component control currently has keyboard focus.
       
   727             // The first component control will either be a listbox or grid
       
   728             // depending on the viewtype.  Refresh the container.
       
   729             BeginRepopulationL();
       
   730             iNeedsRefresh = EFalse;
       
   731             }
       
   732         else
       
   733             {
       
   734             // This is the active view, but we are in one of two states:
       
   735             // 1: The application is in the background
       
   736             // 2: The editor is open and currently has keyboard focus.
       
   737             // When we recieve a focus change notification we will need to
       
   738             // refresh the view.  This happens in CCalenNativeView::NotifyFocusChanged
       
   739             iNeedsRefresh = ETrue;
       
   740             }
       
   741         }
       
   742 
       
   743     TRACE_EXIT_POINT;
       
   744     }
       
   745 
       
   746 // ----------------------------------------------------------------------------
       
   747 // CCalenNativeView::SetCbaL()
       
   748 // Set CBA and change button from Back to Exit if necessary
       
   749 // (other items were commented in a header).
       
   750 // ----------------------------------------------------------------------------
       
   751 //
       
   752 void CCalenNativeView::SetCbaL(TInt aCbaResourceId)
       
   753     {
       
   754 	TRACE_ENTRY_POINT;
       
   755 
       
   756     CEikButtonGroupContainer*  cba = Cba();
       
   757     cba->SetCommandSetL(aCbaResourceId);
       
   758     cba->DrawNow();
       
   759 
       
   760     TRACE_EXIT_POINT;
       
   761     }
       
   762 
       
   763 
       
   764 #ifdef RD_CALEN_EXTERNAL_CAL
       
   765 
       
   766 // ----------------------------------------------------------------------------
       
   767 // CCalenNativeView::CreateServiceHandlerL()
       
   768 // Create new AIW service handler and attach to menu services if needed
       
   769 // (other items were commented in a header).
       
   770 // ----------------------------------------------------------------------------
       
   771 //
       
   772 void CCalenNativeView::CreateServiceHandlerL(TBool aAttachMenu)
       
   773     {
       
   774     TRACE_ENTRY_POINT;
       
   775 
       
   776 
       
   777     if ((iServiceHandler!=NULL) && (aAttachMenu==EFalse))
       
   778         {
       
   779         TRACE_EXIT_POINT;
       
   780         return;
       
   781         }
       
   782 
       
   783         // Create service handler instance.
       
   784     if (!iServiceHandler)
       
   785         {
       
   786         iServiceHandler = CAiwServiceHandler::NewL();
       
   787         }
       
   788     if (aAttachMenu)
       
   789         {
       
   790     // Attach menu service interest to AIW framework. We will add
       
   791     // menus to all the views
       
   792     PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_DAY_MENUPANE,
       
   793         R_EXTERNAL_CALENDAR_AIW_INTEREST) );
       
   794 
       
   795         PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_MONTH_MENUPANE,
       
   796         R_EXTERNAL_CALENDAR_AIW_INTEREST) );
       
   797 
       
   798 
       
   799         PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_WEEK_MENUPANE,
       
   800         R_EXTERNAL_CALENDAR_AIW_INTEREST) );
       
   801 
       
   802         PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_TODO_LIST_MENUPANE,
       
   803         R_EXTERNAL_CALENDAR_AIW_INTEREST) );
       
   804         }
       
   805 
       
   806 
       
   807     TRACE_EXIT_POINT;
       
   808     }
       
   809 
       
   810 #endif //RD_CALEN_EXTERNAL_CAL
       
   811 
       
   812 
       
   813 
       
   814 
       
   815 #ifdef RD_CALEN_EXTERNAL_CAL
       
   816 // ----------------------------------------------------------------------------
       
   817 // CCalenNativeView::ReleaseServiceHandler()
       
   818 // Release service handler and unload provider
       
   819 // (other items were commented in a header).
       
   820 // ----------------------------------------------------------------------------
       
   821 //
       
   822 void CCalenNativeView::ReleaseServiceHandler()
       
   823     {
       
   824     TRACE_ENTRY_POINT;
       
   825     if (iServiceHandler)
       
   826         {
       
   827         iServiceHandler->Reset();
       
   828         delete iServiceHandler;
       
   829         iServiceHandler=NULL;
       
   830         }
       
   831     TRACE_EXIT_POINT;
       
   832     }
       
   833 #endif //RD_CALEN_EXTERNAL_CAL
       
   834 
       
   835 
       
   836 #ifdef RD_CALEN_EXTERNAL_CAL
       
   837 // ----------------------------------------------------------------------------
       
   838 // CCalenNativeView::ServiceHandler()
       
   839 // Return pointer to service handler
       
   840 // (other items were commented in a header).
       
   841 // ----------------------------------------------------------------------------
       
   842 //
       
   843 CAiwServiceHandler* CCalenNativeView::ServiceHandler()
       
   844     {
       
   845     TRACE_ENTRY_POINT;
       
   846     return iServiceHandler;
       
   847     TRACE_EXIT_POINT;
       
   848     }
       
   849 #endif //RD_CALEN_EXTERNAL_CAL
       
   850 
       
   851 
       
   852 
       
   853 
       
   854 
       
   855 #ifdef RD_CALEN_EXTERNAL_CAL
       
   856 
       
   857 // ----------------------------------------------------------------------------
       
   858 //* Handles notifications caused by an asynchronous Execute*CmdL call
       
   859 //* or an event.
       
   860 //*
       
   861 //* @param aCmdId The service command associated to the event.
       
   862 //* @param aEventId Occured event, see AiwCommon.hrh.
       
   863 //* @param aEventParamList Event parameters, if any, as defined per
       
   864 //*        each event.
       
   865 //* @param aInParamList Input parameters, if any, given in the
       
   866 //*        related HandleCommmandL.
       
   867 //* @return Error code for the callback.
       
   868 // ----------------------------------------------------------------------------
       
   869 //
       
   870 TInt CCalenNativeView::HandleNotifyL(TInt /*aCmdId*/,TInt /*aEventId*/,CAiwGenericParamList& aEventParamList,const CAiwGenericParamList& /*aInParamList*/)
       
   871     {
       
   872     TRACE_ENTRY_POINT;
       
   873     TInt count=aEventParamList.Count();
       
   874     TInt index=0;
       
   875     TTime date(0);
       
   876 
       
   877     // find first TTime parameter
       
   878     const TAiwGenericParam* param = aEventParamList.FindFirst(index, EGenericParamDateTime);
       
   879     if (index >= 0)
       
   880         {
       
   881         // get date value from it
       
   882         const TAiwVariant& val = param->Value();
       
   883         val.Get(date);
       
   884         }
       
   885     else
       
   886         {
       
   887         TRACE_EXIT_POINT;
       
   888         return KErrNone;
       
   889         }
       
   890 
       
   891     // use date got from provider and set it to calendar
       
   892     MCalenContext& context = iServices.Context();
       
   893     TCalTime focusTime;
       
   894     focusTime.SetTimeLocalL( date + TCalenContext::DefaultTimeForViews() );
       
   895     context.SetFocusTime( focusTime , context.ViewId() );
       
   896     iContainer->NotifyChangeDateL();
       
   897     TRACE_EXIT_POINT;
       
   898     return KErrNone;
       
   899     }
       
   900 
       
   901 #endif //RD_CALEN_EXTERNAL_CAL
       
   902 
       
   903 // ----------------------------------------------------------------------------
       
   904 // CCalenNativeView::HandleNotification
       
   905 // From MCalenNotificationHandler
       
   906 // Handles a notification of a calendar event that this
       
   907 // MCalenNotificationHandler has registered for
       
   908 // ----------------------------------------------------------------------------
       
   909 //
       
   910 void CCalenNativeView::HandleNotification(const TCalenNotification aNotification )
       
   911     {
       
   912     TRACE_ENTRY_POINT;
       
   913 
       
   914     switch ( aNotification )
       
   915         {
       
   916         case ECalenNotifyContextChanged:
       
   917             {
       
   918             // If we're not on screen, clear VSD.
       
   919             if ( !iContainer )
       
   920                 {
       
   921                 PIM_TRAPD_HANDLE( ClearViewSpecificDataL() );
       
   922                 }
       
   923             }
       
   924             break;
       
   925         case ECalenNotifyMarkedEntryDeleted: // Todo view specific notification
       
   926             {
       
   927             PIM_TRAPD_HANDLE( NotifyMarkedEntryDeletedL() );
       
   928             }
       
   929             break; 
       
   930         case ECalenNotifyMarkedEntryCompleted: // Todo view specific notification
       
   931             {
       
   932             PIM_TRAPD_HANDLE( NotifyMarkedEntryCompletedL() );
       
   933             }
       
   934             break;    
       
   935         case ECalenNotifySystemTimeChanged:
       
   936             {
       
   937             PIM_TRAPD_HANDLE( OnLocaleChangedL( EChangesSystemTime ) );
       
   938             }
       
   939             break;
       
   940         case ECalenNotifyEntryClosed:
       
   941             {
       
   942             // The editor/ viewer is changed
       
   943             PIM_TRAPD_HANDLE( OnEditorClosedL() );
       
   944             }
       
   945             break;
       
   946         case ECalenNotifyDialogClosed:
       
   947         case ECalenNotifySettingsClosed:
       
   948         case ECalenNotifySettingsChanged:
       
   949         case ECalenNotifyEntrySent:    
       
   950             {
       
   951             iIsEditorActive = EFalse;
       
   952             iCommandProcessing = EFalse;
       
   953             }
       
   954             break;
       
   955         case ECalenNotifyEntrySaved:
       
   956         case ECalenNotifyInstanceSaved:         
       
   957             {
       
   958             iIsEditorActive = EFalse;
       
   959             if( Container() )
       
   960 	            {
       
   961 	            PIM_TRAPD_HANDLE(UpdateDateFromContextL());	
       
   962 	            }
       
   963             }
       
   964             break;        
       
   965         case ECalenNotifySystemLocaleChanged:
       
   966             {
       
   967         	PIM_TRAPD_HANDLE( OnLocaleChangedL( EChangesLocale ) );
       
   968             }
       
   969         	break;
       
   970         case ECalenNotifyAppForegrounded:
       
   971             {
       
   972             iIsBackgrounded = EFalse;
       
   973             // Updates the previewpane/preview popup in month view/week view
       
   974             if(iFasterAppActive)
       
   975                 {
       
   976                 iFasterAppActive = EFalse;
       
   977                 if(iIsEditorActive)
       
   978                     {
       
   979                     iIsEditorActive = EFalse;
       
   980                     }
       
   981                 }
       
   982             PIM_TRAPD_HANDLE(UpdatePreviewPaneL());
       
   983             }
       
   984             break;
       
   985         case ECalenNotifyAppBackgrounded:
       
   986             {
       
   987             iIsBackgrounded = ETrue;
       
   988             // Hides previewpane/preview popup in month view/week view when
       
   989             // application goes to background or whenever fake exit is done
       
   990             PIM_TRAPD_HANDLE(HidePreviewPane());
       
   991             }
       
   992             break;
       
   993         case ECalenNotifyEntryDeleted:
       
   994         case ECalenNotifyMultipleEntriesDeleted:
       
   995         case ECalenNotifyInstanceDeleted:
       
   996         case ECalenNotifyCancelDelete:
       
   997 		case ECalenNotifyDeleteInstanceView:
       
   998             {
       
   999 			// Called when user does not delete an entry.
       
  1000             if( IsCommandHandlingInProgress() )
       
  1001                 {
       
  1002                 SetCommandHandlingInProgress( EFalse );
       
  1003                 }
       
  1004 				
       
  1005             if(iContainer)
       
  1006                 {
       
  1007                 iContainer->CleanupInstances();
       
  1008                 }
       
  1009 			}	
       
  1010             break;
       
  1011 		case ECalenNotifyDeleteFailed:
       
  1012 		    {
       
  1013 		    // Called when user does not delete an entry.
       
  1014             if( IsCommandHandlingInProgress() )
       
  1015                 {
       
  1016                 SetCommandHandlingInProgress( EFalse );
       
  1017                 }
       
  1018 		    
       
  1019 		    }
       
  1020 		break;    
       
  1021 		case ECalenNotifyStopAlarm:
       
  1022             {
       
  1023             if(iContainer)
       
  1024                 {
       
  1025                 PIM_TRAPD_HANDLE(iContainer->HandleStopCommandL());
       
  1026                 }
       
  1027             }
       
  1028             break;
       
  1029         default:
       
  1030             ASSERT( 0 ); // should never get here
       
  1031             break;
       
  1032         }
       
  1033 
       
  1034     TRACE_EXIT_POINT;
       
  1035     }
       
  1036 
       
  1037 #ifdef RD_CALEN_EXTERNAL_CAL
       
  1038 // ----------------------------------------------------------------------------
       
  1039 // ?classname::?member_function
       
  1040 // ?implementation_description
       
  1041 // (other items were commented in a header).
       
  1042 // ----------------------------------------------------------------------------
       
  1043 //
       
  1044 TBool CCalenNativeView::ExtCalendarAvailableL()
       
  1045     {
       
  1046     TRACE_ENTRY_POINT;
       
  1047 
       
  1048 
       
  1049     TBool res=EFalse;
       
  1050 
       
  1051 
       
  1052     TInt enabled( 0 );
       
  1053     CRepository* repository = NULL;
       
  1054 
       
  1055     // first we check central repository if it has our external calendar enabled.
       
  1056     PIM_TRAPD_HANDLE( (repository = CRepository::NewL( KCRUidCalenUIExtensions )) );
       
  1057     if( repository )
       
  1058         {
       
  1059         TInt err = repository->Get( KCalenExternalCalendarEnabled, enabled );
       
  1060         delete repository;
       
  1061         }
       
  1062     // if setting says it is not enabled there is no point of loading provider at all, improves performance.
       
  1063     if (!enabled)
       
  1064         {
       
  1065         TRACE_EXIT_POINT;
       
  1066         return EFalse;
       
  1067         }
       
  1068 
       
  1069     // if setting was enabled we should also find out if there is a service provider.
       
  1070     CreateServiceHandlerL(EFalse);
       
  1071     CAiwCriteriaItem* crit = CAiwCriteriaItem::NewLC(ECalenExtAiwCommandId, KAiwCmdView, KContentTypeCalendar);
       
  1072     // we will connect to base service which is currently just empty. This is needed just for finding out if
       
  1073     // there are any providers available. This will change in the future in AIW framework as it is a bug.
       
  1074     crit->SetServiceClass(TUid::Uid(KAiwClassBase));
       
  1075     crit->SetMaxProviders(1);
       
  1076     RCriteriaArray array;
       
  1077     array.Append(crit);
       
  1078 
       
  1079     // attach to base service.
       
  1080     // ownership of array is not transferred.
       
  1081     iServiceHandler->AttachL(array);
       
  1082 
       
  1083     // get number of matching providers.
       
  1084     TInt num=iServiceHandler->NbrOfProviders(crit);
       
  1085 
       
  1086 
       
  1087     array.ResetAndDestroy();
       
  1088     CleanupStack::Pop(crit);
       
  1089 
       
  1090     // ok if we have provider and setting was also enabled then we should show menu items.
       
  1091     if ((num>0)&&(enabled))
       
  1092         {
       
  1093         res=ETrue;
       
  1094         }
       
  1095     TRACE_EXIT_POINT;
       
  1096     return res;
       
  1097     }
       
  1098 #endif //RD_CALEN_EXTERNAL_CAL
       
  1099 
       
  1100 // ----------------------------------------------------------------------------
       
  1101 // CCalenNativeView::BeginRepopulationL
       
  1102 // Starts population again.
       
  1103 // (other items were commented in a header).
       
  1104 // ----------------------------------------------------------------------------
       
  1105 //
       
  1106 void CCalenNativeView::BeginRepopulationL()
       
  1107     {
       
  1108     TRACE_ENTRY_POINT;
       
  1109 
       
  1110     CancelPopulation();
       
  1111     iServices.IssueCommandL( ECalenStartActiveStep );
       
  1112 
       
  1113     TRACE_EXIT_POINT;
       
  1114     }
       
  1115 
       
  1116 // ----------------------------------------------------------------------------
       
  1117 // CCalenNativeView::RemoveViewsFromCycle
       
  1118 // From CCalenView. Does nothing.
       
  1119 // (other items were commented in a header).
       
  1120 // ----------------------------------------------------------------------------
       
  1121 //
       
  1122 void CCalenNativeView::RemoveViewsFromCycle( RArray<TInt>& /*aViews*/ )
       
  1123     {
       
  1124     TRACE_ENTRY_POINT;
       
  1125     TRACE_EXIT_POINT;
       
  1126     }
       
  1127 
       
  1128 // ----------------------------------------------------------------------------
       
  1129 // CCalenNativeView::GetHelpContext
       
  1130 // From CCalenView. Does nothing.
       
  1131 // (other items were commented in a header).
       
  1132 // ----------------------------------------------------------------------------
       
  1133 //
       
  1134 void CCalenNativeView::GetHelpContext( TCoeHelpContext& /*aHelpContext*/ )
       
  1135     {
       
  1136     TRACE_ENTRY_POINT;
       
  1137     TRACE_EXIT_POINT;
       
  1138     }
       
  1139 
       
  1140 // ----------------------------------------------------------------------------
       
  1141 // CCalenNativeView::CalenViewExtensionL
       
  1142 // From CCalenView. Does nothing.
       
  1143 // (other items were commented in a header).
       
  1144 // ----------------------------------------------------------------------------
       
  1145 //
       
  1146 TAny* CCalenNativeView::CalenViewExtensionL( TUid /*aExtensionId*/ )
       
  1147     {
       
  1148     TRACE_ENTRY_POINT;
       
  1149     TRACE_EXIT_POINT;
       
  1150     return NULL;
       
  1151     }
       
  1152 
       
  1153 // ----------------------------------------------------------------------------
       
  1154 // CCalenNativeView::OnEditorClosedL
       
  1155 // Called when editor/viewer is closed
       
  1156 // (other items were commented in a header).
       
  1157 // ----------------------------------------------------------------------------
       
  1158 //
       
  1159 void CCalenNativeView::OnEditorClosedL()
       
  1160     {
       
  1161     TRACE_ENTRY_POINT;
       
  1162     // If the view is active, then update status pane
       
  1163     if( Container() )
       
  1164         {
       
  1165         RedrawStatusPaneL();
       
  1166         iIsEditorActive = EFalse;
       
  1167         }
       
  1168     TRACE_EXIT_POINT;
       
  1169     }
       
  1170 
       
  1171 // ----------------------------------------------------------------------------
       
  1172 // CCalenNativeView::SetEditorActive
       
  1173 // Set the flag iIsEditorActive whenever new event editor is launched from any
       
  1174 // native view.This is to prevent the preview popup display
       
  1175 // (other items were commented in a header).
       
  1176 // ----------------------------------------------------------------------------
       
  1177 // 
       
  1178 void CCalenNativeView::SetEditorActive(TBool aEditorActive)
       
  1179     {
       
  1180     TRACE_ENTRY_POINT;
       
  1181     
       
  1182     iIsEditorActive = aEditorActive;
       
  1183     
       
  1184     TRACE_EXIT_POINT;
       
  1185     }
       
  1186 	
       
  1187 // ----------------------------------------------------------------------------
       
  1188 // CCalenNativeView::IsCommandHandlingInProgress
       
  1189 // other details are commented in the header
       
  1190 // ----------------------------------------------------------------------------
       
  1191 // 
       
  1192 TBool CCalenNativeView::IsCommandHandlingInProgress()
       
  1193     {
       
  1194     TRACE_ENTRY_POINT;
       
  1195     
       
  1196     return iCommandProcessing;
       
  1197     
       
  1198     TRACE_EXIT_POINT;
       
  1199     }
       
  1200 
       
  1201 // ----------------------------------------------------------------------------
       
  1202 // CCalenNativeView::SetCommandHandlingProgress
       
  1203 // other details are commented in the header
       
  1204 // ----------------------------------------------------------------------------
       
  1205 // 
       
  1206 void CCalenNativeView::SetCommandHandlingInProgress( TBool aInProgress )
       
  1207     {
       
  1208     TRACE_ENTRY_POINT;
       
  1209     
       
  1210     iCommandProcessing = aInProgress;
       
  1211     
       
  1212     TRACE_EXIT_POINT;
       
  1213     }
       
  1214 	
       
  1215 
       
  1216 // ----------------------------------------------------------------------------
       
  1217 // CCalenNativeView::SetEditorActive
       
  1218 // Returns an array of active collection ids.
       
  1219 // (other items were commented in a header).
       
  1220 // ----------------------------------------------------------------------------
       
  1221 // 
       
  1222 void CCalenNativeView::GetActiveCollectionidsL( 
       
  1223         MCalenServices& aServices, 
       
  1224         RArray< TInt >& aCollectionIds )
       
  1225     {
       
  1226     TRACE_ENTRY_POINT;
       
  1227     RPointerArray<CCalCalendarInfo> calendarInfoList;
       
  1228     CleanupClosePushL(calendarInfoList);
       
  1229     aServices.GetAllCalendarInfoL(calendarInfoList);
       
  1230     
       
  1231     for(TInt index=0;index<calendarInfoList.Count();index++)
       
  1232         {
       
  1233         if(calendarInfoList[index]->Enabled())
       
  1234             {
       
  1235             aCollectionIds.Append( aServices.SessionL( 
       
  1236                         calendarInfoList[index]->FileNameL() ).CollectionIdL() );
       
  1237             }
       
  1238         }
       
  1239     
       
  1240     CleanupStack::PopAndDestroy(&calendarInfoList);
       
  1241     TRACE_EXIT_POINT;
       
  1242     }
       
  1243 
       
  1244 // ----------------------------------------------------------------------------
       
  1245 // CCalenNativeView::SetFasterAppActive
       
  1246 // Set the flag 'iFasterApp' to ETrue if application is fake exited
       
  1247 // and to EFalse once the application comes to foreground.
       
  1248 // (other items were commented in a header).
       
  1249 // ----------------------------------------------------------------------------
       
  1250 void CCalenNativeView::SetFasterAppActive( TBool aFlag )
       
  1251     {
       
  1252     TRACE_ENTRY_POINT;
       
  1253     TRACE_EXIT_POINT;
       
  1254     iFasterAppActive = aFlag;
       
  1255     }
       
  1256 
       
  1257 // ----------------------------------------------------------------------------
       
  1258 // CCalenNativeView::IsEditorActiveOrFasterAppExit
       
  1259 // Returns ETrue whenever editor is active or whenever fake exit is active
       
  1260 // (other items were commented in a header).
       
  1261 // ----------------------------------------------------------------------------
       
  1262 //
       
  1263 TBool CCalenNativeView::IsEditorActiveOrFasterAppExit()
       
  1264     {
       
  1265     TRACE_ENTRY_POINT;
       
  1266     
       
  1267     if( iIsEditorActive || iFasterAppActive || iIsBackgrounded )
       
  1268         {
       
  1269         TRACE_EXIT_POINT;
       
  1270         return ETrue;
       
  1271         }
       
  1272     else
       
  1273         {
       
  1274         TRACE_EXIT_POINT;
       
  1275         return EFalse;
       
  1276         }
       
  1277     }
       
  1278 
       
  1279 // End of File