calendarui/views/src/calennativeview.cpp
branchRCL_3
changeset 66 bd7edf625bdd
parent 65 12af337248b1
child 74 97232defd20e
equal deleted inserted replaced
65:12af337248b1 66:bd7edf625bdd
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  This class is the base class of all Calendar views.
    14 * Description:  This class is the base class of all Calendar views.
    15  *
    15 *
    16  */
    16 */
    17 
    17 
    18 // system includes
    18 
    19 #include <QtGui>
    19 // INCLUDES
    20 #include <hbwidget.h>
    20 #include <calenconstants.h>
    21 #include <hblabel.h>
    21 #include <calenagendautils.h>
    22 #include <hbaction.h>
    22 #include <calendateutils.h>
    23 #include <hbdialog.h>
    23 #include <calentoolbar.h>
    24 #include <hbmainwindow.h>
    24 #include <Calendar.rsg>
    25 #include <hbdatetimepicker.h>
    25 #include <CalenStatusPaneUtils.h>
    26 #include <vwsdef.h>
    26 #include <calencontext.h>
    27 #include <hbactivitymanager.h> //Activity Manager
    27 #include <caltime.h>
    28 #include <hbapplication.h> //hbapplication
    28 #include <calinstance.h>
    29 
    29 #include <calinstanceview.h>
    30 //user includes
    30 #include <calentry.h>
    31 #include <CalenUid.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 #include <caleninstanceid.h>            // TCalenInstanceId
       
    47 
       
    48 
       
    49 #include "calendarui_debug.h"           // Debug.
       
    50 #include "CalendarVariant.hrh"
    32 #include "calennativeview.h"
    51 #include "calennativeview.h"
    33 #include "calenservices.h"
    52 #include "calencontainer.h"
    34 #include "calencontext.h"
    53 #include "CalenInterimUtils2.h"
    35 #include "calensettingsview.h"
    54 #include "calensend.h"
    36 #include "calendateutils.h"
    55 #include "calentitlepane.h"
    37 #include "calenconstants.h"
    56 #include "CleanupResetAndDestroy.h"
    38 #include "OstTraceDefinitions.h"
    57 #include "CalenPaths.h"
    39 #ifdef OST_TRACE_COMPILER_IN_USE
    58 #include "calendar.hrh"
    40 #include "calennativeviewTraces.h"
    59 #include "CalenUid.h"
       
    60 #include "CalendarPrivateCRKeys.h"
       
    61 #include "multicaluidialog.h"
       
    62 
       
    63 const TInt KAbbreviatedWeekNames[] =
       
    64     {
       
    65     R_QTN_WEEK_TWO_CHARS_MO,
       
    66     R_QTN_WEEK_TWO_CHARS_TU,
       
    67     R_QTN_WEEK_TWO_CHARS_WE,
       
    68     R_QTN_WEEK_TWO_CHARS_TH,
       
    69     R_QTN_WEEK_TWO_CHARS_FR,
       
    70     R_QTN_WEEK_TWO_CHARS_SA,
       
    71     R_QTN_WEEK_TWO_CHARS_SU
       
    72     };
       
    73 
       
    74 
       
    75 #ifdef RD_CALEN_EXTERNAL_CAL
       
    76 #include  <aiwservicehandler.h>
       
    77 
       
    78 // MIME types
       
    79 _LIT8(KContentTypeCalendar, "text/calendar");
       
    80 
       
    81 #endif //RD_CALEN_EXTERNAL_CAL
       
    82 
       
    83 
       
    84 #include <aknnavilabel.h>
       
    85 #include <calennavilabel.h>
       
    86 
       
    87 
       
    88 // ================= MEMBER FUNCTIONS =======================
       
    89 
       
    90 // ----------------------------------------------------------------------------
       
    91 // CCalenNativeView::~CCalenNativeView
       
    92 // Destructor
       
    93 // (other items were commented in a header).
       
    94 // ----------------------------------------------------------------------------
       
    95 //
       
    96 CCalenNativeView::~CCalenNativeView()
       
    97     {
       
    98     TRACE_ENTRY_POINT;
       
    99 
       
   100     CCoeAppUi* appui = CEikonEnv::Static()->AppUi();
       
   101     appui->RemoveFromStack( iContainer );
       
   102 
       
   103     delete iContainer;
       
   104 
       
   105     iServices.CancelNotifications( this );
       
   106 
       
   107     delete iAbbreviatedDayArray;
       
   108 
       
   109 #ifdef RD_CALEN_EXTERNAL_CAL
       
   110     //delete AIW iServiceHandler;
       
   111     ReleaseServiceHandler();
       
   112 #endif //RD_CALEN_EXTERNAL_CAL
       
   113 
       
   114     delete iMenuName;
       
   115     delete iSettingsName;
       
   116     
       
   117     delete iSPUtils;
       
   118 
       
   119     if( iAsyncCallback )
       
   120         {
       
   121         iAsyncCallback->Cancel();
       
   122         delete iAsyncCallback;
       
   123         iAsyncCallback = NULL;
       
   124         }
       
   125     
       
   126     TRACE_EXIT_POINT;
       
   127     }
       
   128 
       
   129 // ----------------------------------------------------------------------------
       
   130 // CCalenNativeView::SetStatusPaneFromActiveContextL(
       
   131 // This function sets the status pane based upon the context
       
   132 // (other items were commented in a header).
       
   133 // ----------------------------------------------------------------------------
       
   134 //
       
   135 void CCalenNativeView::SetStatusPaneFromActiveContextL()
       
   136     {
       
   137     TRACE_ENTRY_POINT;
       
   138     iSPUtils->RefreshStatusPane();
       
   139     TRACE_EXIT_POINT;
       
   140     }
       
   141 
       
   142 // ----------------------------------------------------------------------------
       
   143 // CCalenNativeView::Container
       
   144 // Return container control pointer.
       
   145 // (other items were commented in a header).
       
   146 // ----------------------------------------------------------------------------
       
   147 //
       
   148 CCalenContainer* CCalenNativeView::Container()
       
   149     {
       
   150     TRACE_ENTRY_POINT;
       
   151 
       
   152     TRACE_EXIT_POINT;
       
   153     return iContainer;
       
   154     }
       
   155 
       
   156 // ----------------------------------------------------------------------------
       
   157 // CCalenNativeView::OnCmdGotoDateL
       
   158 // Handling command "Go to day"
       
   159 // (other items were commented in a header).
       
   160 // ----------------------------------------------------------------------------
       
   161 //
       
   162 void CCalenNativeView::OnCmdGotoDateL()
       
   163     {
       
   164     TRACE_ENTRY_POINT;
       
   165 
       
   166     TTime date = CalenDateUtils::Today();
       
   167 	
       
   168     TInt buttonId = CalenViewUtils::DateQueryL( date, 0 );
       
   169 	
       
   170 		//test
       
   171 	TDateTime dateTime = date.DateTime();
       
   172 	
       
   173     if (buttonId == EAknSoftkeyOk || buttonId == EEikBidOk)
       
   174         {
       
   175         MCalenContext& context = iServices.Context();
       
   176         TCalTime dateCalTime;
       
   177         dateCalTime.SetTimeLocalL( date );
       
   178         context.SetFocusDateAndTimeL( dateCalTime, context.ViewId() );
       
   179         iContainer->NotifyChangeDateL();
       
   180         }
       
   181 
       
   182     TRACE_EXIT_POINT;
       
   183     }
       
   184 
       
   185 // ----------------------------------------------------------------------------
       
   186 // CCalenNativeView::OnCmdGotoTodayL
       
   187 // Handling command "Today". # key is pressed.
       
   188 // (other items were commented in a header).
       
   189 // ----------------------------------------------------------------------------
       
   190 //
       
   191 void CCalenNativeView::OnCmdGotoTodayL()
       
   192     {
       
   193     TRACE_ENTRY_POINT;
       
   194 
       
   195     TTime today = CalenDateUtils::Today();
       
   196 
       
   197     MCalenContext& context = iServices.Context();
       
   198     TCalTime todayCalTime;
       
   199     todayCalTime.SetTimeLocalL( today );
       
   200     context.SetFocusDateAndTimeL( todayCalTime, context.ViewId() );
       
   201 
       
   202     iContainer->NotifyChangeDateL();
       
   203 
       
   204     TRACE_EXIT_POINT;
       
   205     }
       
   206 
       
   207 // ----------------------------------------------------------------------------
       
   208 // CCalenNativeView::NotifyFocusChanged
       
   209 // Notified that the focus of Container changes.
       
   210 // (other items were commented in a header).
       
   211 // ----------------------------------------------------------------------------
       
   212 //
       
   213 void CCalenNativeView::NotifyFocusChanged()
       
   214     {
       
   215     TRACE_ENTRY_POINT;
       
   216 
       
   217     // FIXME: iLocChangeReason doesn't seem to serve any purpose.
       
   218     // Debug how it is used.
       
   219     if (iContainer && iNeedsRefresh)
       
   220         {
       
   221         if (IsForeground() && IsContainerFocused())
       
   222             {
       
   223             //The database was changed while calendar was running as a
       
   224             //background task or the editor was open.  We need to refresh.
       
   225             TRAP_IGNORE(BeginRepopulationL());
       
   226             iNeedsRefresh = EFalse;
       
   227             }
       
   228         }
       
   229     if (iLocChangeReason && IsContainerFocused())
       
   230         {
       
   231         PIM_TRAPD_HANDLE( OnLocaleChangedL( iLocChangeReason ) );
       
   232         }
       
   233     iLocChangeReason = 0;
       
   234 
       
   235     TRACE_EXIT_POINT;
       
   236     }
       
   237 
       
   238 // ----------------------------------------------------------------------------
       
   239 // CCalenNativeView::IsContainerFocused
       
   240 // Is container focused?
       
   241 // (other items were commented in a header).
       
   242 // ----------------------------------------------------------------------------
       
   243 //
       
   244 TBool CCalenNativeView::IsContainerFocused()
       
   245     {
       
   246     TRACE_ENTRY_POINT;
       
   247 
       
   248     TRACE_EXIT_POINT;
       
   249     return (iContainer && iContainer->IsVisible());
       
   250     }
       
   251 
       
   252 // ----------------------------------------------------------------------------
       
   253 // CCalenNativeView::ShowValidScrollButtons
       
   254 // (other items were commented in a header).
       
   255 // ----------------------------------------------------------------------------
       
   256 //
       
   257 void CCalenNativeView::ShowValidScrollButtons(CAknNavigationDecorator& aNaviLabel,
       
   258                                         const TTime& aBeforeRange,
       
   259                                         const TTime& aAfterRange)
       
   260     {
       
   261     TRACE_ENTRY_POINT;
       
   262 
       
   263     aNaviLabel.MakeScrollButtonVisible(ETrue);
       
   264 
       
   265     // FIXME can be written more simply.
       
   266     TBool mirrored(AknLayoutUtils::LayoutMirrored());
       
   267     if (mirrored)
       
   268         {
       
   269         TBool validDay(CalenDateUtils::IsValidDay(aBeforeRange));
       
   270         aNaviLabel.SetScrollButtonDimmed(
       
   271             CAknNavigationDecorator::ERightButton, !validDay);
       
   272         validDay = CalenDateUtils::IsValidDay(TTime(aAfterRange));
       
   273         aNaviLabel.SetScrollButtonDimmed(
       
   274             CAknNavigationDecorator::ELeftButton, !validDay);
       
   275         }
       
   276     else
       
   277         {
       
   278         TBool validDay(CalenDateUtils::IsValidDay(aBeforeRange));
       
   279         aNaviLabel.SetScrollButtonDimmed(
       
   280             CAknNavigationDecorator::ELeftButton, !validDay);
       
   281         validDay = CalenDateUtils::IsValidDay(aAfterRange);
       
   282         aNaviLabel.SetScrollButtonDimmed(
       
   283             CAknNavigationDecorator::ERightButton, !validDay);
       
   284         }
       
   285 
       
   286 
       
   287     if(iContainer && AknLayoutUtils::PenEnabled())
       
   288         {
       
   289         aNaviLabel.SetNaviDecoratorObserver(static_cast<MAknNaviDecoratorObserver*>(iContainer));
       
   290         CCoeControl* coeRes = aNaviLabel.DecoratedControl();
       
   291         CCalenNaviLabel *actualLabel = static_cast<CCalenNaviLabel*>(coeRes);
       
   292         actualLabel->SetLabelObserver(static_cast<MCCalenNaviLabelObserver*>(iContainer));
       
   293         }
       
   294 
       
   295 
       
   296     TRACE_EXIT_POINT;
       
   297     }
       
   298 
       
   299 // ----------------------------------------------------------------------------
       
   300 // CCalenNativeView::DynInitMenuPaneL
       
   301 // Initialization of Options menu
       
   302 // (other items were commented in a header).
       
   303 // ----------------------------------------------------------------------------
       
   304 //
       
   305 void CCalenNativeView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
       
   306     {
       
   307     TRACE_ENTRY_POINT;
       
   308 
       
   309     switch (aResourceId)
       
   310         {
       
   311         case R_CALENDAR_NOTETYPE_MENUPANE:
       
   312             {
       
   313             if( !iServices.InterimUtilsL().MRViewersEnabledL( ETrue ) )
       
   314                 {
       
   315                 aMenuPane->DeleteMenuItem( ECalenNewMeetingRequest );
       
   316                 }
       
   317             break;
       
   318             }
       
   319         case R_CALENDAR_CHANGE_VIEW_MENUPANE:
       
   320             {
       
   321             // If we get the cascading view switch menu pane, 
       
   322             // need to offer it to the services, to remove
       
   323             // the current view.
       
   324             iServices.OfferMenuPaneL( aResourceId, aMenuPane );
       
   325             }
       
   326             break;
       
   327         default:
       
   328             {
       
   329 #ifdef RD_CALEN_EXTERNAL_CAL
       
   330             // do we have a service handler, if not create one
       
   331             if (!iServiceHandler)
       
   332                 {
       
   333                 CreateServiceHandlerL(ETrue);
       
   334                 }
       
   335 
       
   336 
       
   337             if (iServiceHandler->HandleSubmenuL(*aMenuPane))
       
   338                 {
       
   339                 return;
       
   340                 }
       
   341 
       
   342             // is the menu item AIW menu item if so, we will initialize our menu item
       
   343             if (iServiceHandler->IsAiwMenu(aResourceId))
       
   344                 {
       
   345                 CAiwGenericParamList& inParamList = iServiceHandler->InParamListL();
       
   346                 TInt extrainfo=0;
       
   347                 TAiwVariant variant(extrainfo);
       
   348                 // No generic param for integer, therefore use EGenericParamError.
       
   349                 TAiwGenericParam param(EGenericParamError, variant);
       
   350                 inParamList.AppendL(param);
       
   351 
       
   352                 iServiceHandler->InitializeMenuPaneL(
       
   353                     *aMenuPane,
       
   354                     aResourceId,
       
   355                     ECalenExtAiwCommandId,
       
   356                     inParamList);
       
   357                 }
    41 #endif
   358 #endif
    42 
   359             break;
    43 
   360             }
    44 /*!
   361         }
    45  \class CalenNativeView
   362     TRACE_EXIT_POINT;
    46  Base class for all calendar views
   363     }
    47  */
   364 
    48 
   365 // ----------------------------------------------------------------------------
    49 /*!
   366 // CCalenNativeView::HandleCommandL
    50  Default constructor.
   367 // Command handling for each view
    51  */
   368 // (other items were commented in a header).
    52 CalenNativeView::CalenNativeView(MCalenServices &services) :
   369 // ----------------------------------------------------------------------------
    53 	mServices(services),
   370 //
    54 	mEntriesInDataBase(false),
   371 void CCalenNativeView::HandleCommandL(TInt aCommand)
    55 	mIsCapturedScreenShotValid(false)
   372     {
    56 {
   373     TRACE_ENTRY_POINT;
    57     OstTraceFunctionEntry0( CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY );
   374 
    58     
   375      switch (aCommand)
    59 	setTitle(hbTrId("txt_calendar_title_calendar"));
   376         {
    60 
   377         case EAknCmdHelp:
    61 	// Create services API and register for notifications
   378             HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), iAvkonAppUi->AppHelpContextL() );
    62 	RArray<TCalenNotification> notificationArray;
   379             break;
    63 	CleanupClosePushL(notificationArray);
   380 
    64 
   381         // Context should be 8am on current focused day for these actions.
    65 	notificationArray.Append(ECalenNotifySystemTimeChanged);
   382         case ECalenNewMeeting:
    66 	notificationArray.Append(ECalenNotifySystemLocaleChanged);
   383         case ECalenNewMeetingRequest:
    67 	notificationArray.Append(ECalenNotifyContextChanged);
   384         case ECalenNewAnniv:
    68 
   385         case ECalenNewDayNote:
    69 	mServices.RegisterForNotificationsL(this, notificationArray);
   386         case ECalenNewTodo:
    70 
   387             {
    71 	CleanupStack::PopAndDestroy(&notificationArray);
   388             iIsEditorActive = ETrue;
       
   389             MCalenContext& context = iServices.Context();
       
   390             // Set the date on the context. It will set it to be the
       
   391             // default of view (8am) on that day as we don't set the time.
       
   392             TCalTime time;
       
   393             time.SetTimeLocalL( CCalenContainer::DateFromContextL( context ) );
       
   394             context.SetFocusDateL( time,
       
   395                                    TVwsViewId( KUidCalendar, Id() ) );
       
   396             iServices.IssueCommandL( aCommand );
       
   397             }
       
   398             break;
       
   399         case ECalenShowSettings:
       
   400             {
       
   401             iIsEditorActive = ETrue;
       
   402             iServices.IssueCommandL( aCommand );
       
   403             }
       
   404             break;
       
   405         case ECalenMonthView:
       
   406         case ECalenWeekView:
       
   407         case ECalenDayView:
       
   408         case ECalenTodoView:
       
   409             {
       
   410             MCalenContext& context = iServices.Context();
       
   411             // Set the date on the context. It will set it to be the
       
   412             // default of view (8am) on that day as we don't set the time.
       
   413             TCalTime time;
       
   414             time.SetTimeLocalL( CCalenContainer::DateFromContextL( context ) );
       
   415             context.SetFocusDateL( time,
       
   416                                    TVwsViewId( KUidCalendar, Id() ) );
       
   417             iServices.IssueCommandL( aCommand );
       
   418             }
       
   419             break;
       
   420 
       
   421         // The context should remain the same for these actions.
       
   422         case ECalenForwardsToDayView:
       
   423         case ECalenNextView:
       
   424         case ECalenPrevView:
       
   425         case ECalenViewCurrentEntry:
       
   426         case ECalenEditCurrentEntry: 
       
   427         case ECalenCompleteTodo:
       
   428         case ECalenRestoreTodo:
       
   429         case ECalenDeleteAllEntries:
       
   430         case ECalenDeleteCurrentEntry:
       
   431         case ECalenDeleteEntriesBeforeDate:
       
   432         //case ECalenGlobalSendAsCmdId:
       
   433         
       
   434             
       
   435                 SetCommandHandlingInProgress( ETrue );
       
   436                 iServices.IssueCommandL( aCommand );
       
   437             break;
       
   438             
       
   439         case ECalenEventView:
       
   440         case ECalenSwitchView:  
       
   441 		case ECalenSend:
       
   442             iServices.IssueCommandL( aCommand );
       
   443             break;
       
   444 
       
   445         case ECalenGotoDate:
       
   446             OnCmdGotoDateL();
       
   447             break;
       
   448 
       
   449         case ECalenGotoToday:
       
   450             OnCmdGotoTodayL();
       
   451             break;
       
   452 
       
   453         default:
       
   454             {
       
   455 #ifdef RD_CALEN_EXTERNAL_CAL
       
   456             // by default we will check also AIW commands
       
   457             if (!iServiceHandler)
       
   458                 {
       
   459                 CreateServiceHandlerL(ETrue);
       
   460                 }
       
   461 
       
   462 
       
   463             TInt aiwCmd = iServiceHandler->ServiceCmdByMenuCmd(aCommand);
       
   464 
       
   465             // if we have right one, handle it
       
   466             if(aiwCmd)
       
   467                 {
       
   468                 // add current focused date to param list
       
   469                 MCalenContext& context = iServices.Context();
       
   470                 TTime time = context.FocusTime().TimeLocalL();
       
   471 
       
   472                 CAiwGenericParamList& inparams=iServiceHandler->InParamListL();
       
   473                 TAiwGenericParam date(EGenericParamDateTime);
       
   474                 date.Value().Set(time);
       
   475                 inparams.AppendL(date);
       
   476 
       
   477                 // Execute AIW menu service command.
       
   478                 PIM_TRAPD_HANDLE(
       
   479                 iServiceHandler->ExecuteMenuCmdL(
       
   480                     aCommand,                           // The service command
       
   481                     inparams,    // pass our date
       
   482                     iServiceHandler->OutParamListL(),   // No output parameters needed
       
   483                     KAiwOptASyncronous,                  // we are using async version
       
   484                     this ));                             // and we want to call us back
       
   485                 }
       
   486             // if not then let ui framwork handle it
       
   487 
       
   488             else
       
   489                 {
       
   490 #endif
       
   491                 iServices.IssueCommandL( aCommand );
       
   492 
       
   493 #ifdef RD_CALEN_EXTERNAL_CAL
       
   494                 }
       
   495 #endif // RD_CALEN_EXTERNAL_CAL
       
   496 
       
   497             break;
       
   498 
       
   499             }
       
   500 
       
   501         }
       
   502 
       
   503     TRACE_EXIT_POINT;
       
   504     }
       
   505 
       
   506 // ----------------------------------------------------------------------------
       
   507 // CCalenNativeView::DynInitMenuBarL
       
   508 // other details are commented in the header
       
   509 // ----------------------------------------------------------------------------
       
   510 //
       
   511 void CCalenNativeView::DynInitMenuBarL( TInt /*aResourceId*/, CEikMenuBar* aMenuBar )
       
   512     {
       
   513     TRACE_ENTRY_POINT;
       
   514     
       
   515     if( aMenuBar && IsCommandHandlingInProgress() )
       
   516         {
       
   517         aMenuBar->StopDisplayingMenuBar();
       
   518         }
       
   519     
       
   520     TRACE_EXIT_POINT;
       
   521     }
       
   522 
       
   523 // ----------------------------------------------------------------------------
       
   524 // CCalenNativeView::CopytoCalendarsL
       
   525 // From CAknView
       
   526 // Return the UID of the day view
       
   527 // (other items were commented in a header)
       
   528 // ----------------------------------------------------------------------------
       
   529 //
       
   530 void CCalenNativeView::CopyToCalendarsL()
       
   531     {
       
   532     TRACE_ENTRY_POINT;
       
   533     
       
   534     iAsyncCallback->CallBack();
       
   535     
       
   536     TRACE_EXIT_POINT;
       
   537     }
       
   538 
       
   539 // ----------------------------------------------------------------------------
       
   540 // CCalenNativeView::AsyncCopyToCalendarsL
       
   541 // From CAknView
       
   542 // Return the UID of the day view
       
   543 // (other items were commented in a header)
       
   544 // ----------------------------------------------------------------------------
       
   545 //
       
   546 TInt CCalenNativeView::AsyncCopyToCalendarsL( TAny* aThisPtr )
       
   547     {
       
   548     TRACE_ENTRY_POINT;
       
   549     
       
   550     static_cast<CCalenNativeView*>(aThisPtr)->CopyEntryToCalendarsL();
       
   551     
       
   552     TRACE_EXIT_POINT;
       
   553     return 0;
       
   554 
       
   555     }
       
   556 
       
   557 // ----------------------------------------------------------------------------
       
   558 // CCalenNativeView::CopyEntryToCalendarsL
       
   559 // From CAknView
       
   560 // Return the UID of the day view
       
   561 // (other items were commented in a header)
       
   562 // ----------------------------------------------------------------------------
       
   563 //
       
   564 void CCalenNativeView::CopyEntryToCalendarsL()
       
   565     {
       
   566     TRACE_ENTRY_POINT;
       
   567     
       
   568     // Create settings own titlepane and navipane, and swap with existing ones
       
   569     CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane();
       
   570 
       
   571     // Hide the toolbar before we display settings menu
       
   572     MCalenToolbar* toolbar = iServices.ToolbarOrNull();
       
   573     if(toolbar)
       
   574         {
       
   575         toolbar->SetToolbarVisibilityL(EFalse);  
       
   576         }
       
   577     iSPUtils->UnderLineTitleText( EFalse );
       
   578 
       
   579     // Titlepane
       
   580     CAknTitlePane* newtp = new( ELeave ) CAknTitlePane();
       
   581     CleanupStack::PushL( newtp );
       
   582     CCoeControl* oldtp = sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), newtp );
       
   583     CleanupStack::Pop( newtp ); // ownership is passed to statuspane
       
   584     TRect oldRect( 0, 0, 0, 0 );
       
   585     if( oldtp )
       
   586         {
       
   587         CleanupStack::PushL( oldtp );
       
   588         oldRect = oldtp->Rect();
       
   589         CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidTitle ));
       
   590         newtp->SetContainerWindowL( *ctrl );
       
   591         newtp->ConstructL();
       
   592         newtp->SetRect(oldRect);
       
   593         newtp->ActivateL();
       
   594         }        
       
   595 
       
   596     // NaviPane
       
   597     CAknNavigationControlContainer* newnp = new( ELeave )CAknNavigationControlContainer();
       
   598     CleanupStack::PushL( newnp );
       
   599     CCoeControl* oldnp = sp->SwapControlL( TUid::Uid( EEikStatusPaneUidNavi ), newnp );
       
   600     CleanupStack::Pop( newnp ); // ownership is passed to statuspane
       
   601     if( oldnp )
       
   602         {
       
   603         CleanupStack::PushL( oldnp );
       
   604         oldRect = oldnp->Rect();
       
   605         CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
       
   606         newnp->SetContainerWindowL( *ctrl );
       
   607         newnp->ConstructL();
       
   608         newnp->SetRect( oldRect );
       
   609         newnp->PushDefaultL();
       
   610         newnp->ActivateL();
       
   611         }
       
   612 
       
   613     MCalenContext& context = iServices.Context();
       
   614     TCalLocalUid instanceId = context.InstanceId().iEntryLocalUid;
       
   615 
       
   616     CCalEntry* entry = iServices.EntryViewL(context.InstanceId().iColId)->FetchL(instanceId);
       
   617     CleanupStack::PushL(entry);
       
   618 
       
   619     RPointerArray<CCalEntry> calentryArray;
       
   620     calentryArray.Append( entry );
       
   621 
       
   622     // Launch the Calendar List Dialiog.
       
   623     CMultiCalUiDialog* calenDbListDialog = CMultiCalUiDialog::NewLC(calentryArray, EFalse);
       
   624     TInt err = KErrNone;
       
   625     // Execute.
       
   626     TRAP( err,calenDbListDialog->LaunchL() );
       
   627     CleanupStack::PopAndDestroy( calenDbListDialog );
       
   628 
       
   629     iSPUtils->UnderLineTitleText( EFalse );
       
   630     // Unhide the toolbar when settings is closed
       
   631     if(toolbar)
       
   632         {
       
   633         toolbar->SetToolbarVisibilityL(ETrue); 
       
   634         }
       
   635     
       
   636     CleanupStack::Pop(entry);
       
   637     calentryArray.ResetAndDestroy(); 
       
   638     
       
   639     // When setting is closed, swap back old titlepane and navipane
       
   640     if( oldnp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidNavi), oldnp ) )
       
   641         {
       
   642         CleanupStack::Pop( oldnp );
       
   643         delete newnp;
       
   644         oldnp->ActivateL();
       
   645         }
       
   646 
       
   647     if( oldtp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), oldtp ) )
       
   648         {
       
   649         CleanupStack::Pop( oldtp );
       
   650         delete newtp;
       
   651         oldtp->ActivateL();
       
   652         }
       
   653     
       
   654     BeginRepopulationL();
       
   655     
       
   656     TRACE_EXIT_POINT;
       
   657     
       
   658     }
       
   659 
       
   660 // ----------------------------------------------------------------------------
       
   661 // C++ constructor can NOT contain any code, that
       
   662 // might leave.
       
   663 // ----------------------------------------------------------------------------
       
   664 //
       
   665 CCalenNativeView::CCalenNativeView( MCalenServices& aServices )
       
   666     : iServices( aServices )
       
   667     {
       
   668     TRACE_ENTRY_POINT;
       
   669     TRACE_EXIT_POINT;
       
   670     }
       
   671 
       
   672 // ----------------------------------------------------------------------------
       
   673 // CCalenNativeView::ConstructL
       
   674 // Symbian OS default constructor
       
   675 // (other items were commented in a header).
       
   676 // ----------------------------------------------------------------------------
       
   677 //
       
   678 void CCalenNativeView::CommonConstructL( TInt aViewResource )
       
   679     {
       
   680     TRACE_ENTRY_POINT;
       
   681 
       
   682     BaseConstructL( aViewResource );
       
   683     
       
   684     // Initialize CCalenStatusPaneUtils
       
   685     CEikStatusPane* sp = StatusPane();
       
   686     iSPUtils = CCalenStatusPaneUtils::NewL( sp );
       
   687 
       
   688     ClearViewSpecificDataL(); // Reset vsd.
       
   689 
       
   690     // Create services API and register for notifications
       
   691     RArray<TCalenNotification> notificationArray;
       
   692     notificationArray.Append(ECalenNotifySystemTimeChanged);
       
   693     notificationArray.Append(ECalenNotifyMarkedEntryDeleted);
       
   694     notificationArray.Append(ECalenNotifyContextChanged);
       
   695     notificationArray.Append(ECalenNotifyDialogClosed);
       
   696     notificationArray.Append(ECalenNotifyEntrySent);    
       
   697     notificationArray.Append(ECalenNotifyEntryClosed);
       
   698     notificationArray.Append(ECalenNotifySystemLocaleChanged);
       
   699     notificationArray.Append(ECalenNotifyAppForegrounded);
       
   700     notificationArray.Append(ECalenNotifyAppBackgrounded);
       
   701     notificationArray.Append(ECalenNotifyEntrySaved);
       
   702     notificationArray.Append(ECalenNotifyInstanceSaved);
       
   703     notificationArray.Append(ECalenNotifySettingsClosed);
       
   704     notificationArray.Append(ECalenNotifySettingsChanged);
       
   705     notificationArray.Append(ECalenNotifyMarkedEntryCompleted);
       
   706     notificationArray.Append(ECalenNotifyDeleteInstanceView);
       
   707     notificationArray.Append(ECalenNotifyStopAlarm);
       
   708 	notificationArray.Append(ECalenNotifyDeleteFailed);
       
   709 	notificationArray.Append(ECalenNotifyEntryDeleted);
       
   710 	notificationArray.Append(ECalenNotifyResourceChanged);
       
   711 	notificationArray.Append(ECalenNotifyEventViewLaunchedFromAlarm);
    72 	
   712 	
    73 	OstTraceFunctionExit0( CALENNATIVEVIEW_CALENNATIVEVIEW_EXIT );
   713     iServices.RegisterForNotificationsL( this,notificationArray);
    74 }
   714     
    75 
   715     notificationArray.Reset();
    76 /*!
   716     
    77  Destructor
   717     iIgnoreTap = EFalse;
    78  */
   718     
    79 CalenNativeView::~CalenNativeView()
   719     iCommandProcessing = EFalse;
    80 {
   720     TCallBack callback(CCalenNativeView::AsyncCopyToCalendarsL,this);
    81     OstTraceFunctionEntry0( DUP1_CALENNATIVEVIEW_CALENNATIVEVIEW_ENTRY );
   721     iAsyncCallback = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard);
    82     
   722 
    83     OstTraceFunctionExit0( DUP1_CALENNATIVEVIEW_CALENNATIVEVIEW_EXIT );
   723     TRACE_EXIT_POINT;
    84 }
   724     }
    85 
   725 
    86 /*!
   726 // ----------------------------------------------------------------------------
    87  Issues populcaiton complete to the framework
   727 // CCalenNativeView::CreateContainerL
    88  */
   728 // A container control is created.
    89 void CalenNativeView::populationComplete()
   729 // (other items were commented in a header).
    90 {
   730 // ----------------------------------------------------------------------------
    91     OstTraceFunctionEntry0( CALENNATIVEVIEW_POPULATIONCOMPLETE_ENTRY );
   731 //
    92     
   732 void CCalenNativeView::CreateContainerL()
    93 	// Population is complete, issue the notification
   733     {
    94 	mServices.IssueNotificationL(ECalenNotifyViewPopulationComplete);
   734     TRACE_ENTRY_POINT;
       
   735 
       
   736     if (!iContainer)
       
   737         {
       
   738         CCalenContainer* container = CreateContainerImplL();
       
   739         CleanupStack::PushL(container);
       
   740         container->SetMopParent(this);
       
   741         container->ConstructL();
       
   742         CleanupStack::Pop(); // container
       
   743 
       
   744         iContainer = container;
       
   745         iContainer->SetRect( ClientRect() );
       
   746         iContainer->ActivateL();
       
   747         }
       
   748     else
       
   749         {
       
   750         iContainer->MakeVisible(ETrue);
       
   751         }
       
   752 
       
   753     TRACE_EXIT_POINT;
       
   754     }
       
   755 
       
   756 // ----------------------------------------------------------------------------
       
   757 // CCalenNativeView::AbbreviatedDayArrayL
       
   758 // Returns an array of descriptors of abbreviated days (e.g. MO, TU). This
       
   759 // will only get called by the month and week views.
       
   760 // (other items were commented in a header).
       
   761 // ----------------------------------------------------------------------------
       
   762 //
       
   763 const CDesCArrayFlat& CCalenNativeView::AbbreviatedDayArrayL()
       
   764     {
       
   765     TRACE_ENTRY_POINT;
       
   766 
       
   767     if( !iAbbreviatedDayArray )
       
   768         {
       
   769         iAbbreviatedDayArray = new( ELeave )CDesCArrayFlat( 7 );
       
   770         HBufC* dayAbb;
       
   771 
       
   772         for ( TInt i(0); i<7; ++i )
       
   773             {
       
   774             dayAbb = StringLoader::LoadLC( KAbbreviatedWeekNames[i] );
       
   775             iAbbreviatedDayArray->AppendL( *dayAbb );
       
   776             CleanupStack::PopAndDestroy( dayAbb );
       
   777             }
       
   778         }
       
   779 
       
   780     TRACE_EXIT_POINT;
       
   781     return *iAbbreviatedDayArray;
       
   782     }
       
   783 
       
   784 // ----------------------------------------------------------------------------
       
   785 // CCalenNativeView::DoActivateL
       
   786 // View activation handler
       
   787 // (other items were commented in a header).
       
   788 // ----------------------------------------------------------------------------
       
   789 //
       
   790 void CCalenNativeView::DoActivateL( const TVwsViewId& aPrevViewId,
       
   791                                     TUid aCustomMessageId,
       
   792                                     const TDesC8& aCustomMessage)
       
   793     {
       
   794     TRACE_ENTRY_POINT;
       
   795 
       
   796     iLocChangeReason = 0;
       
   797 
       
   798     if( KCalenHideInBackGround.iUid == aCustomMessageId.iUid )
       
   799 	    {
       
   800 	    SetFasterAppActive(ETrue);
       
   801 	    DoDeactivate();	
       
   802 	    }
       
   803 
       
   804      if( AknLayoutUtils::PenEnabled() )
       
   805         {
       
   806         MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
       
   807         if(toolbarImpl)
       
   808             {
       
   809             CAknToolbar& toolbar = toolbarImpl->Toolbar();
       
   810             toolbar.SetToolbarVisibility(ETrue);
       
   811             }
       
   812         }
       
   813 
       
   814     if ( Toolbar() )
       
   815         {
       
   816         ShowToolbarOnViewActivation( ETrue );
       
   817         }
       
   818 
       
   819     CreateContainerL();
       
   820 
       
   821     DoActivateImplL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   822 
       
   823     TRACE_EXIT_POINT;
       
   824     }
       
   825 
       
   826 // ----------------------------------------------------------------------------
       
   827 // CCalenNativeView::DoDeactivate
       
   828 // View deactivation handler
       
   829 // (other items were commented in a header).
       
   830 // ----------------------------------------------------------------------------
       
   831 //
       
   832 void CCalenNativeView::DoDeactivate()
       
   833     {
       
   834     TRACE_ENTRY_POINT;
       
   835 #ifdef RD_CALEN_EXTERNAL_CAL
       
   836     //delete AIW iServiceHandler;
       
   837     ReleaseServiceHandler();
       
   838 #endif //RD_CALEN_EXTERNAL_CAL
       
   839 
       
   840     if (iContainer)
       
   841         {
       
   842         iContainer->RemoveFromStackAndMakeInvisible();
       
   843         DoDeactivateImpl();
       
   844         delete iContainer;
       
   845         iContainer = NULL;
       
   846         }
       
   847     TRACE_EXIT_POINT;
       
   848     }
       
   849 
       
   850 // ----------------------------------------------------------------------------
       
   851 // CCalenNativeView::HandleDBChangeL
       
   852 // Called from CCalenGlobalData when the agenda database
       
   853 // is modified from an external session.
       
   854 // ----------------------------------------------------------------------------
       
   855 //
       
   856 void CCalenNativeView::HandleDBChangeL()
       
   857     {
       
   858     TRACE_ENTRY_POINT;
       
   859 
       
   860     // If iContainer is NULL then this is not the active view, so do nothing.
       
   861     // The view will be refreshed when the container is constructed.
       
   862     if ( iContainer )
       
   863         {
       
   864         if (IsForeground() && Container()->ComponentControl(0)->IsFocused())
       
   865             {
       
   866             // Application is in the foreground and the container is visible
       
   867             // on screen.  We know that the editor is not open as the
       
   868             // containers first component control currently has keyboard focus.
       
   869             // The first component control will either be a listbox or grid
       
   870             // depending on the viewtype.  Refresh the container.
       
   871             BeginRepopulationL();
       
   872             iNeedsRefresh = EFalse;
       
   873             }
       
   874         else
       
   875             {
       
   876             // This is the active view, but we are in one of two states:
       
   877             // 1: The application is in the background
       
   878             // 2: The editor is open and currently has keyboard focus.
       
   879             // When we recieve a focus change notification we will need to
       
   880             // refresh the view.  This happens in CCalenNativeView::NotifyFocusChanged
       
   881             iNeedsRefresh = ETrue;
       
   882             }
       
   883         }
       
   884 
       
   885     TRACE_EXIT_POINT;
       
   886     }
       
   887 
       
   888 // ----------------------------------------------------------------------------
       
   889 // CCalenNativeView::SetCbaL()
       
   890 // Set CBA and change button from Back to Exit if necessary
       
   891 // (other items were commented in a header).
       
   892 // ----------------------------------------------------------------------------
       
   893 //
       
   894 void CCalenNativeView::SetCbaL(TInt aCbaResourceId)
       
   895     {
       
   896 	TRACE_ENTRY_POINT;
       
   897 
       
   898     CEikButtonGroupContainer*  cba = Cba();
       
   899     cba->SetCommandSetL(aCbaResourceId);
       
   900     cba->DrawNow();
       
   901 
       
   902     TRACE_EXIT_POINT;
       
   903     }
       
   904 
       
   905 
       
   906 #ifdef RD_CALEN_EXTERNAL_CAL
       
   907 
       
   908 // ----------------------------------------------------------------------------
       
   909 // CCalenNativeView::CreateServiceHandlerL()
       
   910 // Create new AIW service handler and attach to menu services if needed
       
   911 // (other items were commented in a header).
       
   912 // ----------------------------------------------------------------------------
       
   913 //
       
   914 void CCalenNativeView::CreateServiceHandlerL(TBool aAttachMenu)
       
   915     {
       
   916     TRACE_ENTRY_POINT;
       
   917 
       
   918 
       
   919     if ((iServiceHandler!=NULL) && (aAttachMenu==EFalse))
       
   920         {
       
   921         TRACE_EXIT_POINT;
       
   922         return;
       
   923         }
       
   924 
       
   925         // Create service handler instance.
       
   926     if (!iServiceHandler)
       
   927         {
       
   928         iServiceHandler = CAiwServiceHandler::NewL();
       
   929         }
       
   930     if (aAttachMenu)
       
   931         {
       
   932     // Attach menu service interest to AIW framework. We will add
       
   933     // menus to all the views
       
   934     PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_DAY_MENUPANE,
       
   935         R_EXTERNAL_CALENDAR_AIW_INTEREST) );
       
   936 
       
   937         PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_MONTH_MENUPANE,
       
   938         R_EXTERNAL_CALENDAR_AIW_INTEREST) );
       
   939 
       
   940 
       
   941         PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_CALENDAR_WEEK_MENUPANE,
       
   942         R_EXTERNAL_CALENDAR_AIW_INTEREST) );
       
   943 
       
   944         PIM_TRAPD_HANDLE( iServiceHandler->AttachMenuL(R_TODO_LIST_MENUPANE,
       
   945         R_EXTERNAL_CALENDAR_AIW_INTEREST) );
       
   946         }
       
   947 
       
   948 
       
   949     TRACE_EXIT_POINT;
       
   950     }
       
   951 
       
   952 #endif //RD_CALEN_EXTERNAL_CAL
       
   953 
       
   954 
       
   955 
       
   956 
       
   957 #ifdef RD_CALEN_EXTERNAL_CAL
       
   958 // ----------------------------------------------------------------------------
       
   959 // CCalenNativeView::ReleaseServiceHandler()
       
   960 // Release service handler and unload provider
       
   961 // (other items were commented in a header).
       
   962 // ----------------------------------------------------------------------------
       
   963 //
       
   964 void CCalenNativeView::ReleaseServiceHandler()
       
   965     {
       
   966     TRACE_ENTRY_POINT;
       
   967     if (iServiceHandler)
       
   968         {
       
   969         iServiceHandler->Reset();
       
   970         delete iServiceHandler;
       
   971         iServiceHandler=NULL;
       
   972         }
       
   973     TRACE_EXIT_POINT;
       
   974     }
       
   975 #endif //RD_CALEN_EXTERNAL_CAL
       
   976 
       
   977 
       
   978 #ifdef RD_CALEN_EXTERNAL_CAL
       
   979 // ----------------------------------------------------------------------------
       
   980 // CCalenNativeView::ServiceHandler()
       
   981 // Return pointer to service handler
       
   982 // (other items were commented in a header).
       
   983 // ----------------------------------------------------------------------------
       
   984 //
       
   985 CAiwServiceHandler* CCalenNativeView::ServiceHandler()
       
   986     {
       
   987     TRACE_ENTRY_POINT;
       
   988     return iServiceHandler;
       
   989     TRACE_EXIT_POINT;
       
   990     }
       
   991 #endif //RD_CALEN_EXTERNAL_CAL
       
   992 
       
   993 
       
   994 
       
   995 
       
   996 
       
   997 #ifdef RD_CALEN_EXTERNAL_CAL
       
   998 
       
   999 // ----------------------------------------------------------------------------
       
  1000 //* Handles notifications caused by an asynchronous Execute*CmdL call
       
  1001 //* or an event.
       
  1002 //*
       
  1003 //* @param aCmdId The service command associated to the event.
       
  1004 //* @param aEventId Occured event, see AiwCommon.hrh.
       
  1005 //* @param aEventParamList Event parameters, if any, as defined per
       
  1006 //*        each event.
       
  1007 //* @param aInParamList Input parameters, if any, given in the
       
  1008 //*        related HandleCommmandL.
       
  1009 //* @return Error code for the callback.
       
  1010 // ----------------------------------------------------------------------------
       
  1011 //
       
  1012 TInt CCalenNativeView::HandleNotifyL(TInt /*aCmdId*/,TInt /*aEventId*/,CAiwGenericParamList& aEventParamList,const CAiwGenericParamList& /*aInParamList*/)
       
  1013     {
       
  1014     TRACE_ENTRY_POINT;
       
  1015     TInt count=aEventParamList.Count();
       
  1016     TInt index=0;
       
  1017     TTime date(0);
       
  1018 
       
  1019     // find first TTime parameter
       
  1020     const TAiwGenericParam* param = aEventParamList.FindFirst(index, EGenericParamDateTime);
       
  1021     if (index >= 0)
       
  1022         {
       
  1023         // get date value from it
       
  1024         const TAiwVariant& val = param->Value();
       
  1025         val.Get(date);
       
  1026         }
       
  1027     else
       
  1028         {
       
  1029         TRACE_EXIT_POINT;
       
  1030         return KErrNone;
       
  1031         }
       
  1032 
       
  1033     // use date got from provider and set it to calendar
       
  1034     MCalenContext& context = iServices.Context();
       
  1035     TCalTime focusTime;
       
  1036     focusTime.SetTimeLocalL( date + TCalenContext::DefaultTimeForViews() );
       
  1037     context.SetFocusTime( focusTime , context.ViewId() );
       
  1038     iContainer->NotifyChangeDateL();
       
  1039     TRACE_EXIT_POINT;
       
  1040     return KErrNone;
       
  1041     }
       
  1042 
       
  1043 #endif //RD_CALEN_EXTERNAL_CAL
       
  1044 
       
  1045 // ----------------------------------------------------------------------------
       
  1046 // CCalenNativeView::HandleNotification
       
  1047 // From MCalenNotificationHandler
       
  1048 // Handles a notification of a calendar event that this
       
  1049 // MCalenNotificationHandler has registered for
       
  1050 // ----------------------------------------------------------------------------
       
  1051 //
       
  1052 void CCalenNativeView::HandleNotification(const TCalenNotification aNotification )
       
  1053     {
       
  1054     TRACE_ENTRY_POINT;
       
  1055 
       
  1056     switch ( aNotification )
       
  1057         {
       
  1058         case ECalenNotifyContextChanged:
       
  1059             {
       
  1060             // If we're not on screen, clear VSD.
       
  1061             if ( !iContainer )
       
  1062                 {
       
  1063                 PIM_TRAPD_HANDLE( ClearViewSpecificDataL() );
       
  1064                 }
       
  1065             }
       
  1066             break;
       
  1067         case ECalenNotifyMarkedEntryDeleted: // Todo view specific notification
       
  1068             {
       
  1069             PIM_TRAPD_HANDLE( NotifyMarkedEntryDeletedL() );
       
  1070             }
       
  1071             break; 
       
  1072         case ECalenNotifyMarkedEntryCompleted: // Todo view specific notification
       
  1073             {
       
  1074             PIM_TRAPD_HANDLE( NotifyMarkedEntryCompletedL() );
       
  1075             }
       
  1076             break;    
       
  1077         case ECalenNotifySystemTimeChanged:
       
  1078             {
       
  1079             PIM_TRAPD_HANDLE( OnLocaleChangedL( EChangesSystemTime ) );
       
  1080             }
       
  1081             break;
       
  1082         case ECalenNotifyEventViewLaunchedFromAlarm:
       
  1083             {
       
  1084             SetTapIgnore(ETrue);
       
  1085             }
       
  1086             break;
       
  1087         case ECalenNotifyEntryClosed:
       
  1088             {
       
  1089             // The editor/ viewer is changed
       
  1090             PIM_TRAPD_HANDLE( OnEditorClosedL() );
       
  1091             }
       
  1092             break;
       
  1093         case ECalenNotifyDialogClosed:
       
  1094         case ECalenNotifySettingsClosed:
       
  1095         case ECalenNotifySettingsChanged:
       
  1096         case ECalenNotifyEntrySent:    
       
  1097             {
       
  1098             iIsEditorActive = EFalse;
       
  1099             iCommandProcessing = EFalse;
       
  1100             }
       
  1101             break;
       
  1102         case ECalenNotifyEntrySaved:
       
  1103         case ECalenNotifyInstanceSaved:         
       
  1104             {
       
  1105             iIsEditorActive = EFalse;
       
  1106             if( Container() )
       
  1107 	            {
       
  1108 	            PIM_TRAPD_HANDLE(UpdateDateFromContextL());	
       
  1109 	            }
       
  1110             }
       
  1111             break;        
       
  1112         case ECalenNotifySystemLocaleChanged:
       
  1113             {
       
  1114         	PIM_TRAPD_HANDLE( OnLocaleChangedL( EChangesLocale ) );
       
  1115             }
       
  1116         	break;
       
  1117         case ECalenNotifyAppForegrounded:
       
  1118             {
       
  1119             iIsBackgrounded = EFalse;
       
  1120             // Updates the previewpane/preview popup in month view/week view
       
  1121             if(iFasterAppActive)
       
  1122                 {
       
  1123                 iFasterAppActive = EFalse;
       
  1124                 if(iIsEditorActive)
       
  1125                     {
       
  1126                     iIsEditorActive = EFalse;
       
  1127                     }
       
  1128                 }
       
  1129             PIM_TRAPD_HANDLE(UpdatePreviewPaneL());
       
  1130             }
       
  1131             break;
       
  1132         case ECalenNotifyAppBackgrounded:
       
  1133             {
       
  1134             iIsBackgrounded = ETrue;
       
  1135             // Hides previewpane/preview popup in month view/week view when
       
  1136             // application goes to background or whenever fake exit is done
       
  1137             PIM_TRAPD_HANDLE(HidePreviewPane());
       
  1138             }
       
  1139             break;
       
  1140         case ECalenNotifyEntryDeleted:
       
  1141         case ECalenNotifyMultipleEntriesDeleted:
       
  1142         case ECalenNotifyInstanceDeleted:
       
  1143         case ECalenNotifyCancelDelete:
       
  1144 		case ECalenNotifyDeleteInstanceView:
       
  1145             {
       
  1146 			// Called when user does not delete an entry.
       
  1147             if( IsCommandHandlingInProgress() )
       
  1148                 {
       
  1149                 SetCommandHandlingInProgress( EFalse );
       
  1150                 }
       
  1151 				
       
  1152             if(iContainer)
       
  1153                 {
       
  1154                 iContainer->CleanupInstances();
       
  1155                 }
       
  1156 			}	
       
  1157             break;
       
  1158 		case ECalenNotifyDeleteFailed:
       
  1159 		    {
       
  1160 		    // Called when user does not delete an entry.
       
  1161             if( IsCommandHandlingInProgress() )
       
  1162                 {
       
  1163                 SetCommandHandlingInProgress( EFalse );
       
  1164                 }
       
  1165 		    
       
  1166 		    }
       
  1167 		break;    
       
  1168 		case ECalenNotifyStopAlarm:
       
  1169             {
       
  1170             if(iContainer)
       
  1171                 {
       
  1172                 PIM_TRAPD_HANDLE(iContainer->HandleStopCommandL());
       
  1173                 }
       
  1174             }
       
  1175             break;
       
  1176 		case ECalenNotifyResourceChanged:
       
  1177 		    {
       
  1178 		    if(iContainer )
       
  1179 		        {
       
  1180                 CAknAppUi* Appui = (CAknAppUi*)CEikonEnv::Static()->EikAppUi();
       
  1181                 //handle this event when the app is in background
       
  1182                 if(!Appui->IsForeground())
       
  1183                     {
       
  1184                     iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch);
       
  1185                     }
       
  1186 		        }
       
  1187 		    }
       
  1188 		    break;
       
  1189         default:
       
  1190             ASSERT( 0 ); // should never get here
       
  1191             break;
       
  1192         }
       
  1193 
       
  1194     TRACE_EXIT_POINT;
       
  1195     }
       
  1196 
       
  1197 #ifdef RD_CALEN_EXTERNAL_CAL
       
  1198 // ----------------------------------------------------------------------------
       
  1199 // ?classname::?member_function
       
  1200 // ?implementation_description
       
  1201 // (other items were commented in a header).
       
  1202 // ----------------------------------------------------------------------------
       
  1203 //
       
  1204 TBool CCalenNativeView::ExtCalendarAvailableL()
       
  1205     {
       
  1206     TRACE_ENTRY_POINT;
       
  1207 
       
  1208 
       
  1209     TBool res=EFalse;
       
  1210 
       
  1211 
       
  1212     TInt enabled( 0 );
       
  1213     CRepository* repository = NULL;
       
  1214 
       
  1215     // first we check central repository if it has our external calendar enabled.
       
  1216     PIM_TRAPD_HANDLE( (repository = CRepository::NewL( KCRUidCalenUIExtensions )) );
       
  1217     if( repository )
       
  1218         {
       
  1219         TInt err = repository->Get( KCalenExternalCalendarEnabled, enabled );
       
  1220         delete repository;
       
  1221         }
       
  1222     // if setting says it is not enabled there is no point of loading provider at all, improves performance.
       
  1223     if (!enabled)
       
  1224         {
       
  1225         TRACE_EXIT_POINT;
       
  1226         return EFalse;
       
  1227         }
       
  1228 
       
  1229     // if setting was enabled we should also find out if there is a service provider.
       
  1230     CreateServiceHandlerL(EFalse);
       
  1231     CAiwCriteriaItem* crit = CAiwCriteriaItem::NewLC(ECalenExtAiwCommandId, KAiwCmdView, KContentTypeCalendar);
       
  1232     // we will connect to base service which is currently just empty. This is needed just for finding out if
       
  1233     // there are any providers available. This will change in the future in AIW framework as it is a bug.
       
  1234     crit->SetServiceClass(TUid::Uid(KAiwClassBase));
       
  1235     crit->SetMaxProviders(1);
       
  1236     RCriteriaArray array;
       
  1237     array.Append(crit);
       
  1238 
       
  1239     // attach to base service.
       
  1240     // ownership of array is not transferred.
       
  1241     iServiceHandler->AttachL(array);
       
  1242 
       
  1243     // get number of matching providers.
       
  1244     TInt num=iServiceHandler->NbrOfProviders(crit);
       
  1245 
       
  1246 
       
  1247     array.ResetAndDestroy();
       
  1248     CleanupStack::Pop(crit);
       
  1249 
       
  1250     // ok if we have provider and setting was also enabled then we should show menu items.
       
  1251     if ((num>0)&&(enabled))
       
  1252         {
       
  1253         res=ETrue;
       
  1254         }
       
  1255     TRACE_EXIT_POINT;
       
  1256     return res;
       
  1257     }
       
  1258 #endif //RD_CALEN_EXTERNAL_CAL
       
  1259 
       
  1260 // ----------------------------------------------------------------------------
       
  1261 // CCalenNativeView::BeginRepopulationL
       
  1262 // Starts population again.
       
  1263 // (other items were commented in a header).
       
  1264 // ----------------------------------------------------------------------------
       
  1265 //
       
  1266 void CCalenNativeView::BeginRepopulationL()
       
  1267     {
       
  1268     TRACE_ENTRY_POINT;
       
  1269 
       
  1270     CancelPopulation();
       
  1271     iServices.IssueCommandL( ECalenStartActiveStep );
       
  1272 
       
  1273     TRACE_EXIT_POINT;
       
  1274     }
       
  1275 
       
  1276 // ----------------------------------------------------------------------------
       
  1277 // CCalenNativeView::RemoveViewsFromCycle
       
  1278 // From CCalenView. Does nothing.
       
  1279 // (other items were commented in a header).
       
  1280 // ----------------------------------------------------------------------------
       
  1281 //
       
  1282 void CCalenNativeView::RemoveViewsFromCycle( RArray<TInt>& /*aViews*/ )
       
  1283     {
       
  1284     TRACE_ENTRY_POINT;
       
  1285     TRACE_EXIT_POINT;
       
  1286     }
       
  1287 
       
  1288 // ----------------------------------------------------------------------------
       
  1289 // CCalenNativeView::GetHelpContext
       
  1290 // From CCalenView. Does nothing.
       
  1291 // (other items were commented in a header).
       
  1292 // ----------------------------------------------------------------------------
       
  1293 //
       
  1294 void CCalenNativeView::GetHelpContext( TCoeHelpContext& /*aHelpContext*/ )
       
  1295     {
       
  1296     TRACE_ENTRY_POINT;
       
  1297     TRACE_EXIT_POINT;
       
  1298     }
       
  1299 
       
  1300 // ----------------------------------------------------------------------------
       
  1301 // CCalenNativeView::CalenViewExtensionL
       
  1302 // From CCalenView. Does nothing.
       
  1303 // (other items were commented in a header).
       
  1304 // ----------------------------------------------------------------------------
       
  1305 //
       
  1306 TAny* CCalenNativeView::CalenViewExtensionL( TUid /*aExtensionId*/ )
       
  1307     {
       
  1308     TRACE_ENTRY_POINT;
       
  1309     TRACE_EXIT_POINT;
       
  1310     return NULL;
       
  1311     }
       
  1312 
       
  1313 // ----------------------------------------------------------------------------
       
  1314 // CCalenNativeView::OnEditorClosedL
       
  1315 // Called when editor/viewer is closed
       
  1316 // (other items were commented in a header).
       
  1317 // ----------------------------------------------------------------------------
       
  1318 //
       
  1319 void CCalenNativeView::OnEditorClosedL()
       
  1320     {
       
  1321     TRACE_ENTRY_POINT;
       
  1322     
       
  1323     SetTapIgnore(EFalse);
       
  1324     // If the view is active, then update status pane
       
  1325     if( Container() )
       
  1326         {
       
  1327         RedrawStatusPaneL();
       
  1328         iIsEditorActive = EFalse;
       
  1329         }
       
  1330     TRACE_EXIT_POINT;
       
  1331     }
       
  1332 
       
  1333 // ----------------------------------------------------------------------------
       
  1334 // CCalenNativeView::SetEditorActive
       
  1335 // Set the flag iIsEditorActive whenever new event editor is launched from any
       
  1336 // native view.This is to prevent the preview popup display
       
  1337 // (other items were commented in a header).
       
  1338 // ----------------------------------------------------------------------------
       
  1339 // 
       
  1340 void CCalenNativeView::SetEditorActive(TBool aEditorActive)
       
  1341     {
       
  1342     TRACE_ENTRY_POINT;
       
  1343     
       
  1344     iIsEditorActive = aEditorActive;
       
  1345     
       
  1346     TRACE_EXIT_POINT;
       
  1347     }
    95 	
  1348 	
    96 	OstTraceFunctionExit0( CALENNATIVEVIEW_POPULATIONCOMPLETE_EXIT );
  1349 // ----------------------------------------------------------------------------
    97 }
  1350 // CCalenNativeView::IsCommandHandlingInProgress
    98 
  1351 // other details are commented in the header
    99 /*!
  1352 // ----------------------------------------------------------------------------
   100  Slot for delete before date
  1353 // 
   101  */
  1354 TBool CCalenNativeView::IsCommandHandlingInProgress()
   102 void CalenNativeView::deleteBeforeDate()
  1355     {
   103 {
  1356     TRACE_ENTRY_POINT;
   104     OstTraceFunctionEntry0( CALENNATIVEVIEW_DELETEBEFOREDATE_ENTRY );
  1357     
   105     
  1358     return iCommandProcessing;
   106 	mServices.IssueCommandL(ECalenDeleteEntriesBeforeDate);
  1359     
       
  1360     TRACE_EXIT_POINT;
       
  1361     }
       
  1362 
       
  1363 // ----------------------------------------------------------------------------
       
  1364 // CCalenNativeView::IsEventViewLaunchedFromAlarm
       
  1365 // other details are commented in the header
       
  1366 // ----------------------------------------------------------------------------
       
  1367 // 
       
  1368 TBool CCalenNativeView::IsEventViewLaunchedFromAlarm()
       
  1369     {
       
  1370     TRACE_ENTRY_POINT;
       
  1371     return iIgnoreTap;
       
  1372     TRACE_EXIT_POINT;
       
  1373     }
       
  1374 // ----------------------------------------------------------------------------
       
  1375 // CCalenNativeView::SetCommandHandlingProgress
       
  1376 // other details are commented in the header
       
  1377 // ----------------------------------------------------------------------------
       
  1378 // 
       
  1379 void CCalenNativeView::SetCommandHandlingInProgress( TBool aInProgress )
       
  1380     {
       
  1381     TRACE_ENTRY_POINT;
       
  1382     
       
  1383     iCommandProcessing = aInProgress;
       
  1384     
       
  1385     TRACE_EXIT_POINT;
       
  1386     }
   107 	
  1387 	
   108 	OstTraceFunctionExit0( CALENNATIVEVIEW_DELETEBEFOREDATE_EXIT );
  1388 
   109 }
  1389 // ----------------------------------------------------------------------------
   110 
  1390 // CCalenNativeView::SetEditorActive
   111 /*!
  1391 // Returns an array of active collection ids.
   112  Slot for delete all entries
  1392 // (other items were commented in a header).
   113  */
       
   114 void CalenNativeView::deleteAllEntries()
       
   115 {
       
   116     OstTraceFunctionEntry0( CALENNATIVEVIEW_DELETEALLENTRIES_ENTRY );
       
   117     
       
   118 	mServices.IssueCommandL(ECalenDeleteAllEntries);
       
   119 	mEntriesInDataBase = false;
       
   120 	
       
   121 	OstTraceFunctionExit0( CALENNATIVEVIEW_DELETEALLENTRIES_EXIT );
       
   122 }
       
   123 
       
   124 /*!
       
   125  Slot to handle gotodate
       
   126  */
       
   127 void CalenNativeView::goToDate()
       
   128 {
       
   129     OstTraceFunctionEntry0( CALENNATIVEVIEW_GOTODATE_ENTRY );
       
   130     
       
   131 	// Create a popup with datepicker for the user to select date.
       
   132 	HbDialog *popUp = new HbDialog();
       
   133 	popUp->setDismissPolicy(HbDialog::NoDismiss);
       
   134 	popUp->setTimeout(HbDialog::NoTimeout);
       
   135 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
       
   136 	popUp->setHeadingWidget(new HbLabel(hbTrId("txt_calendar_opt_go_to_date")));
       
   137 	
       
   138 	if(mDatePicker) {
       
   139 		mDatePicker = NULL;
       
   140 	}
       
   141 	mDatePicker = new HbDateTimePicker(QDate::currentDate(), popUp);
       
   142 	// Set the date range.
       
   143 	mDatePicker->setMinimumDate(CalenDateUtils::minTime().date());
       
   144 	mDatePicker->setMaximumDate(CalenDateUtils::maxTime().date());
       
   145 	mDatePicker->setDate(QDate::currentDate());
       
   146 	
       
   147 	popUp->setContentWidget(mDatePicker);
       
   148 	HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"));
       
   149 	popUp->addAction(okAction);
       
   150 	connect(okAction, SIGNAL(triggered()), this, SLOT(goToSelectedDate()));
       
   151 	popUp->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popUp));
       
   152 	popUp->open();
       
   153 	
       
   154 	OstTraceFunctionExit0( CALENNATIVEVIEW_GOTODATE_EXIT );
       
   155 }
       
   156 
       
   157 /*
       
   158  Slot to handle date selected on gotodate popup
       
   159  */
       
   160 void CalenNativeView::goToSelectedDate()
       
   161 {
       
   162     OstTraceFunctionEntry0( CALENNATIVEVIEW_GOTOSELECTEDDATE_ENTRY );
       
   163     
       
   164 	QDate selectedDate = mDatePicker->date();
       
   165 
       
   166 	// Check if the selected date is within the range.
       
   167 	if (selectedDate.isValid() &&
       
   168 	        selectedDate >= CalenDateUtils::minTime().date() &&
       
   169 	        selectedDate <= CalenDateUtils::maxTime().date()) {
       
   170 		MCalenContext& context = mServices.Context();
       
   171 		QDateTime contextDate = context.focusDateAndTime();
       
   172 
       
   173 		//Set the selected date to contextDate.
       
   174 		contextDate.setDate(selectedDate);
       
   175 		context.setFocusDateAndTime(contextDate);
       
   176 	}
       
   177 	refreshViewOnGoToDate();
       
   178 	
       
   179 	OstTraceFunctionExit0( CALENNATIVEVIEW_GOTOSELECTEDDATE_EXIT );
       
   180 }
       
   181 
       
   182 /*!
       
   183  Virtual function to refresh the current view upon selecting a date
       
   184  from GoToDate popup
       
   185  */
       
   186 void CalenNativeView::refreshViewOnGoToDate()
       
   187 {
       
   188     OstTraceFunctionEntry0( CALENNATIVEVIEW_REFRESHVIEWONGOTODATE_ENTRY );
       
   189     
       
   190 	mServices.IssueCommandL(ECalenStartActiveStep);
       
   191 	
       
   192 	OstTraceFunctionExit0( CALENNATIVEVIEW_REFRESHVIEWONGOTODATE_EXIT );
       
   193 }
       
   194 
       
   195 /*!
       
   196  Slot to handle setting item in options menu
       
   197  */
       
   198 void CalenNativeView::launchSettingsView()
       
   199 {
       
   200     OstTraceFunctionEntry0( CALENNATIVEVIEW_LAUNCHSETTINGSVIEW_ENTRY );
       
   201     
       
   202 	mServices.IssueCommandL(ECalenShowSettings);
       
   203 	
       
   204 	OstTraceFunctionExit0( CALENNATIVEVIEW_LAUNCHSETTINGSVIEW_EXIT );
       
   205 }
       
   206 
       
   207 /*!
       
   208  Slot to handle to orientation change
       
   209  */
       
   210 void CalenNativeView::changeOrientation(Qt::Orientation orientation)
       
   211 {
       
   212     OstTraceFunctionEntry0( CALENNATIVEVIEW_CHANGEORIENTATION_ENTRY );
       
   213     
       
   214     Q_UNUSED(orientation);
       
   215     // Nothing, derived classes will implement it
       
   216     OstTraceFunctionExit0( CALENNATIVEVIEW_CHANGEORIENTATION_EXIT );
       
   217 }
       
   218 
       
   219 /*!
       
   220  Handles the interested notifications from the calendar framework
       
   221  */
       
   222 void CalenNativeView::HandleNotification(const TCalenNotification notification)
       
   223 {
       
   224     OstTraceFunctionEntry0( CALENNATIVEVIEW_HANDLENOTIFICATION_ENTRY );
       
   225     
       
   226 	switch (notification) {
       
   227 		case ECalenNotifySystemLocaleChanged: {
       
   228 			onLocaleChanged(EChangesLocale);
       
   229 		}
       
   230 		break;
       
   231 		case ECalenNotifySystemTimeChanged: {
       
   232 			onLocaleChanged(EChangesSystemTime);
       
   233 		}
       
   234 		break;
       
   235 		case ECalenNotifyContextChanged: {
       
   236 			onContextChanged();
       
   237 		}
       
   238 		break;
       
   239 		default:
       
   240 			break;
       
   241 	}
       
   242 	
       
   243 	OstTraceFunctionExit0( CALENNATIVEVIEW_HANDLENOTIFICATION_EXIT );
       
   244 }
       
   245 
       
   246 /*!
       
   247  Returns true if plugin is loaded
       
   248  */
       
   249 TBool CalenNativeView::pluginEnabled()
       
   250 {
       
   251     OstTraceFunctionEntry0( CALENNATIVEVIEW_PLUGINENABLED_ENTRY );
       
   252     
       
   253 	QString *pluginInfo = mServices.InfobarTextL();
       
   254 	if (!pluginInfo) {
       
   255 		OstTraceFunctionExit0( CALENNATIVEVIEW_PLUGINENABLED_EXIT );
       
   256 		return false;
       
   257 	} else {
       
   258 		OstTraceFunctionExit0( DUP1_CALENNATIVEVIEW_PLUGINENABLED_EXIT );
       
   259 		return true;
       
   260 	}
       
   261 }
       
   262 
       
   263 QString *CalenNativeView::pluginText()
       
   264 {
       
   265     OstTraceFunctionEntry0( CALENNATIVEVIEW_PLUGINTEXT_ENTRY );
       
   266     
       
   267     OstTraceFunctionExit0( CALENNATIVEVIEW_PLUGINTEXT_EXIT );
       
   268 	return mServices.InfobarTextL();
       
   269 	
       
   270 }
       
   271 
       
   272 // ----------------------------------------------------------------------------
       
   273 // captureScreenshot caltures screen shot for the given viewId
       
   274 // @param viewId view for which screenshot needs to be captured
       
   275 // ----------------------------------------------------------------------------
  1393 // ----------------------------------------------------------------------------
   276 // 
  1394 // 
   277 void CalenNativeView::captureScreenshot(bool captureScreenShot)
  1395 void CCalenNativeView::GetActiveCollectionidsL( 
   278     {
  1396         MCalenServices& aServices, 
   279     OstTraceFunctionEntry0( CALENNATIVEVIEW_CAPTURESCREENSHOT_ENTRY );
  1397         RArray< TInt >& aCollectionIds )
   280     
  1398     {
   281     // get a screenshot for saving to the activity manager. It's done for once
  1399     TRACE_ENTRY_POINT;
   282     // to optimize the performance
  1400     RPointerArray<CCalCalendarInfo> calendarInfoList;
   283     if (captureScreenShot) {
  1401     CleanupClosePushL(calendarInfoList);
   284         mScreenShotMetadata.clear(); // remove any screenshot captured earlier
  1402     aServices.GetAllCalendarInfoL(calendarInfoList);
   285         mScreenShotMetadata.insert("screenshot", QPixmap::grabWidget(mainWindow(), mainWindow()->rect()));
  1403     
   286         }
  1404     for(TInt index=0;index<calendarInfoList.Count();index++)
   287     mIsCapturedScreenShotValid = captureScreenShot; // set the validity of the screenshot captured
  1405         {
   288     
  1406         if(calendarInfoList[index]->Enabled())
   289     OstTraceFunctionExit0( CALENNATIVEVIEW_CAPTURESCREENSHOT_EXIT );
  1407             {
   290     }
  1408             aCollectionIds.Append( aServices.SessionL( 
   291 
  1409                         calendarInfoList[index]->FileNameL() ).CollectionIdL() );
   292 // ----------------------------------------------------------------------------
  1410             }
   293 // saveActivity saves the activity for current view
  1411         }
   294 // ----------------------------------------------------------------------------
  1412     
   295 // 
  1413     CleanupStack::PopAndDestroy(&calendarInfoList);
   296 void CalenNativeView::saveActivity()
  1414     TRACE_EXIT_POINT;
   297  {
  1415     }
   298    OstTraceFunctionEntry0( CALENNATIVEVIEW_SAVEACTIVITY_ENTRY );
  1416 
   299     
  1417 // ----------------------------------------------------------------------------
   300    // Get a pointer to activity manager 
  1418 // CCalenNativeView::SetFasterAppActive
   301    HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();
  1419 // Set the flag 'iFasterApp' to ETrue if application is fake exited
   302  
  1420 // and to EFalse once the application comes to foreground.
   303    // check if alerady a valid screen shot is captured
  1421 // (other items were commented in a header).
   304    if (!mIsCapturedScreenShotValid) {
  1422 // ----------------------------------------------------------------------------
   305        mScreenShotMetadata.clear(); // remove any screenshot captured earlier
  1423 void CCalenNativeView::SetFasterAppActive( TBool aFlag )
   306        mScreenShotMetadata.insert("screenshot", QPixmap::grabWidget(mainWindow(), mainWindow()->rect()));
  1424     {
   307        }
  1425     TRACE_ENTRY_POINT;
   308    
  1426     TRACE_EXIT_POINT;
   309    // Save any data necessary to save the state
  1427     iFasterAppActive = aFlag;
   310    QByteArray serializedActivity;
  1428     }
   311    QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append);
  1429 
   312    stream << mActivityId;
  1430 // ----------------------------------------------------------------------------
   313  
  1431 // CCalenNativeView::IsEditorActiveOrFasterAppExit
   314    bool ok(false);
  1432 // Returns ETrue whenever editor is active or whenever fake exit is active
   315    // Save activity
  1433 // (other items were commented in a header).
   316    ok = activityManager->addActivity(activityName, serializedActivity, mScreenShotMetadata);
  1434 // ----------------------------------------------------------------------------
   317 
  1435 //
   318    // Check is activity saved sucessfully
  1436 TBool CCalenNativeView::IsEditorActiveOrFasterAppExit()
   319    if ( !ok )  {
  1437     {
   320        qFatal("Add failed" ); // Panic is activity is not saved successfully
  1438     TRACE_ENTRY_POINT;
   321        }
  1439     
   322    OstTraceFunctionExit0( CALENNATIVEVIEW_SAVEACTIVITY_EXIT );
  1440     if( iIsEditorActive || iFasterAppActive || iIsBackgrounded )
   323  }
  1441         {
   324 //End Of File
  1442         TRACE_EXIT_POINT;
       
  1443         return ETrue;
       
  1444         }
       
  1445     else
       
  1446         {
       
  1447         TRACE_EXIT_POINT;
       
  1448         return EFalse;
       
  1449         }
       
  1450     }
       
  1451 
       
  1452 // ----------------------------------------------------------------------------
       
  1453 // CCalenNativeView::SetTapIgnore
       
  1454 // Sets flag to ignore tap on any of the views 
       
  1455 // (other items were commented in a header).
       
  1456 // ----------------------------------------------------------------------------
       
  1457 //
       
  1458 void CCalenNativeView::SetTapIgnore(TBool aIgnore)
       
  1459     {
       
  1460     iIgnoreTap = aIgnore;
       
  1461     }
       
  1462 
       
  1463 // End of File