calendarui/views/src/calendayview.cpp
changeset 0 f979ecb2b13e
child 11 0f07cd1b5772
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002-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:   Declares view class of View architecture for Day view.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <aknnavide.h>
       
    20 #include <bldvariant.hrh> // For FeatureIds (lint warns without)
       
    21 #include <eikmenup.h>
       
    22 #include <eikspane.h>
       
    23 #include <featmgr.h>
       
    24 #include <Sendnorm.rsg>
       
    25 #include <eikbtgpc.h>
       
    26 #include <eikmenub.h>
       
    27 #include <StringLoader.h>
       
    28 #include <aknappui.h>
       
    29 #include <calinstance.h>
       
    30 #include <calendateutils.h>
       
    31 #include <Calendar.rsg>
       
    32 #include <calencommonui.rsg>
       
    33 #include <CalenStatusPaneUtils.h>
       
    34 #include <calencommands.hrh>            // Calendar commands
       
    35 #include <calencontext.h>
       
    36 #include <calenservices.h>
       
    37 #include <calenviewutils.h>
       
    38 #include <calentoolbar.h>
       
    39 #include <calentry.h>
       
    40 #include <calentryview.h>
       
    41 #include "calendarui_debug.h"
       
    42 #include "calendayview.h"
       
    43 #include "calencontainer.h"
       
    44 #include "calendaycontainer.h"
       
    45 #include "calensend.h"
       
    46 #include "calentitlepane.h"
       
    47 #include "calenlocationutil.h"
       
    48 #include <CalenInterimUtils2.h>
       
    49 #include "calendar.hrh"
       
    50 #include "CalenUid.h"
       
    51 #include "multicaluidialog.h"
       
    52 
       
    53 //  LOCAL CONSTANTS AND MACROS
       
    54 #define iDayContainer static_cast<CCalenDayContainer*>(iContainer)
       
    55 
       
    56 // Button position of the MSK CBA button
       
    57 const TInt KSK2CBAPosition = 2;
       
    58 
       
    59 
       
    60 // ================= MEMBER FUNCTIONS =======================
       
    61 
       
    62 // ----------------------------------------------------------------------------
       
    63 // CCalenDayView::NewLC
       
    64 // Two-phased constructor.
       
    65 // (other items were commented in a header).
       
    66 // ----------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C CCalenDayView* CCalenDayView::NewL( MCalenServices& aServices )
       
    69     {
       
    70     TRACE_ENTRY_POINT;
       
    71 
       
    72     CCalenDayView* self = new(ELeave) CCalenDayView( aServices );
       
    73     CleanupStack::PushL( self );
       
    74     self->ConstructL();
       
    75     CleanupStack::Pop( self );
       
    76 
       
    77     TRACE_EXIT_POINT;
       
    78     return self;
       
    79     }
       
    80 
       
    81 // ----------------------------------------------------------------------------
       
    82 // CCalenDayView::~CCalenDayView
       
    83 // Destructor
       
    84 // (other items were commented in a header).
       
    85 // ----------------------------------------------------------------------------
       
    86 //
       
    87 CCalenDayView::~CCalenDayView()
       
    88     {
       
    89     TRACE_ENTRY_POINT;
       
    90     TRACE_EXIT_POINT;
       
    91     }
       
    92 
       
    93 // ----------------------------------------------------------------------------
       
    94 // CCalenDayView::CCalenDayView
       
    95 // C++ constructor can NOT contain any code, that might leave.
       
    96 // (other items were commented in a header).
       
    97 // ----------------------------------------------------------------------------
       
    98 //
       
    99 CCalenDayView::CCalenDayView( MCalenServices& aServices )
       
   100     : CCalenNativeView( aServices ),
       
   101       iPopulationStep( ENothingDone )
       
   102     {
       
   103     TRACE_ENTRY_POINT;
       
   104     TRACE_EXIT_POINT;
       
   105     }
       
   106 
       
   107 // ----------------------------------------------------------------------------
       
   108 // CCalenDayView::SetStatusPaneFromActiveContextL
       
   109 // Set a date text to StatusPane
       
   110 // (other items were commented in a header).
       
   111 // ----------------------------------------------------------------------------
       
   112 //
       
   113 void CCalenDayView::SetStatusPaneFromActiveContextL()
       
   114     {
       
   115     TRACE_ENTRY_POINT;
       
   116     
       
   117     TTime activeDay = CCalenContainer::DateFromContextL( iServices.Context() );
       
   118     // title pane
       
   119     if ( CalenDateUtils::IsOnToday( activeDay ) )
       
   120         {
       
   121         iSPUtils->UnderLineTitleText( ETrue );
       
   122         }
       
   123     else
       
   124         {
       
   125         iSPUtils->UnderLineTitleText( EFalse );
       
   126         }
       
   127     TBuf<KMaxDayName> title;
       
   128     iSPUtils->DayNameByActiveTime( title, activeDay );
       
   129     iSPUtils->SetTitleTextL( title );
       
   130     
       
   131     // navi pane
       
   132     CAknNavigationDecorator* naviLabel = iSPUtils->ShowNaviPaneL( activeDay );
       
   133     ShowValidScrollButtons( *naviLabel,
       
   134                             activeDay -TTimeIntervalDays( 1 ),
       
   135                             activeDay +TTimeIntervalDays( 1 ) );
       
   136 
       
   137     iSPUtils->RefreshStatusPane();
       
   138     TRACE_EXIT_POINT;
       
   139     }
       
   140 
       
   141 // ---------------------------------------------------------
       
   142 // CCalenDayView::ConstructL
       
   143 // Symbian OS default constructor
       
   144 // (other items were commented in a header).
       
   145 // ---------------------------------------------------------
       
   146 //
       
   147 void CCalenDayView::ConstructL()
       
   148     {
       
   149     TRACE_ENTRY_POINT;
       
   150 
       
   151     CommonConstructL( R_CALEN_DAYVIEW_INFO );
       
   152 
       
   153     TRACE_EXIT_POINT;
       
   154     }
       
   155 
       
   156 // ---------------------------------------------------------
       
   157 // CCalenDayView::DoActivateImplL
       
   158 // Second phase DoActivateL
       
   159 // (other items were commented in a header).
       
   160 // ---------------------------------------------------------
       
   161 //
       
   162 void CCalenDayView::DoActivateImplL( const TVwsViewId& aPrevViewId,
       
   163                                      TUid aCustomMessageId,
       
   164                                      const TDesC8& /*aCustomMessage*/ )
       
   165     {
       
   166     TRACE_ENTRY_POINT;
       
   167     // When day view is activated, we store the previous view id so that when
       
   168     // "back" softkey is avaible and pressed, we can go back to previous view.
       
   169     // Whether or the "Back" softkey should be available is determined by the flag
       
   170     // iShowBackButtonOnCba, which is set/unset based on aCustomMessageId.
       
   171     //    
       
   172     // When day view is switched from Calendar's internal view, the flag and
       
   173     // the previous view id are updated.
       
   174     // When day view is switched from Other application's view, the flag and
       
   175     // the previous view id are NOT updated 
       
   176     //  
       
   177     if( aPrevViewId.iAppUid == KUidCalendar )    // switch from internal view
       
   178         {
       
   179         iPreviousViewId = aPrevViewId;
       
   180 
       
   181         iShowBackButtonOnCba =
       
   182             ( aCustomMessageId == KUidCalenShowBackCba ? ETrue : EFalse );
       
   183         }
       
   184     else
       
   185         {
       
   186         iShowBackButtonOnCba = EFalse;
       
   187         }
       
   188     iDayContainer->UpdateContainerL();
       
   189     //UpdateCbaL();
       
   190 
       
   191     iEventViewCommandHandled = EFalse;
       
   192     TRACE_EXIT_POINT;
       
   193     }
       
   194 
       
   195 // ---------------------------------------------------------
       
   196 // CCalenDayView::DoDeactivateImpl
       
   197 // Second phase DoDeactivate
       
   198 // (other items were commented in a header).
       
   199 // ---------------------------------------------------------
       
   200 //
       
   201 void CCalenDayView::DoDeactivateImpl()
       
   202     {
       
   203     TRACE_ENTRY_POINT;
       
   204 
       
   205     if (!iAvkonAppUi->IsDisplayingMenuOrDialog())
       
   206         {
       
   207         iSPUtils->HideNaviPane();
       
   208         }
       
   209 
       
   210     TRACE_EXIT_POINT;
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------
       
   214 // CCalenDayView::OnLocaleChangedL
       
   215 // Called when locale was changed and Time was crossovered
       
   216 // (other items were commented in a header).
       
   217 // ---------------------------------------------------------
       
   218 //
       
   219 void CCalenDayView::OnLocaleChangedL(TInt aReason)
       
   220     {
       
   221     TRACE_ENTRY_POINT;
       
   222 
       
   223     if(!iContainer)
       
   224         {
       
   225         return;
       
   226         }
       
   227 
       
   228     if (IsContainerFocused())
       
   229         {
       
   230         if (!iContainer->IsFocused())
       
   231             {
       
   232             iLocChangeReason = EChangesLocale;
       
   233             }
       
   234         else
       
   235             {
       
   236             if (aReason & EChangesLocale)
       
   237                 {
       
   238                 iDayContainer->UpdateTimeFormat();
       
   239                 iDayContainer->UpdateContainerL();
       
   240                 }
       
   241             if (aReason & EChangesSystemTime)
       
   242                 {
       
   243                 RedrawStatusPaneL();
       
   244                 }
       
   245             }
       
   246         }
       
   247     else
       
   248         {
       
   249         iLocChangeReason = EChangesLocale;
       
   250         }
       
   251 
       
   252     TRACE_EXIT_POINT;
       
   253     }
       
   254 
       
   255 
       
   256 
       
   257 // ---------------------------------------------------------
       
   258 // CCalenDayView::CreateContainerImplL
       
   259 // Creates container control for DayView
       
   260 // (other items were commented in a header).
       
   261 // ---------------------------------------------------------
       
   262 //
       
   263 CCalenContainer* CCalenDayView::CreateContainerImplL()
       
   264     {
       
   265     TRACE_ENTRY_POINT;
       
   266 
       
   267     TRACE_EXIT_POINT;
       
   268     return new( ELeave )CCalenDayContainer( this,
       
   269                                             iDate,
       
   270                                             iHighlightedRowNumber,
       
   271                                             iFirstEntryOnScreenIndex,
       
   272                                             iServices );
       
   273     }
       
   274 
       
   275 // ---------------------------------------------------------
       
   276 // CCalenDayView::RedrawStatusPaneL
       
   277 // Redraw status pane when Form is closed
       
   278 // (other items were commented in a header).
       
   279 // ---------------------------------------------------------
       
   280 //
       
   281 void CCalenDayView::RedrawStatusPaneL()
       
   282     {
       
   283     TRACE_ENTRY_POINT;
       
   284 
       
   285     SetStatusPaneFromActiveContextL();
       
   286 
       
   287     TRACE_EXIT_POINT;
       
   288     }
       
   289 
       
   290 // ---------------------------------------------------------
       
   291 // CCalenDayView::DynInitMenuPaneL
       
   292 // Changes MenuPane dynamically
       
   293 // (other items were commented in a header).
       
   294 // ---------------------------------------------------------
       
   295 //
       
   296 void CCalenDayView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   297     {
       
   298     TRACE_ENTRY_POINT;
       
   299 
       
   300     CCalenNativeView::DynInitMenuPaneL(aResourceId, aMenuPane);
       
   301 
       
   302     switch (aResourceId)
       
   303         {
       
   304         case R_CALENDAR_DAY_MENUPANE:
       
   305             {
       
   306 
       
   307 #ifdef RD_CALEN_EXTERNAL_CAL
       
   308             TBool isit=ExtCalendarAvailableL();
       
   309             if (!isit)
       
   310                 {
       
   311                 //ECalenExtAiwCommandId
       
   312                 ReleaseServiceHandler();
       
   313                 TInt dummy;
       
   314                 if (aMenuPane->MenuItemExists(ECalenExtAiwCommandId,dummy))
       
   315                     {
       
   316                     aMenuPane->DeleteMenuItem(ECalenExtAiwCommandId);
       
   317                     }
       
   318                 }
       
   319 #endif //RD_CALEN_EXTERNAL_CAL
       
   320 
       
   321 
       
   322             if ( ! FeatureManager::FeatureSupported(KFeatureIdHelp) )
       
   323                 {
       
   324                 aMenuPane->DeleteMenuItem(EAknCmdHelp);
       
   325                 }
       
   326 
       
   327             TBool emptyList = iDayContainer->IsEmptyView();
       
   328             if ( emptyList )
       
   329                 {
       
   330                 aMenuPane->DeleteMenuItem( ECalenViewCurrentEntry );
       
   331                 aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry );
       
   332                 aMenuPane->DeleteMenuItem( ECalenCompleteTodo );
       
   333                 aMenuPane->DeleteMenuItem( ECalenSend );
       
   334                 //TODO: will be uncommented with copy to cal functionality.
       
   335                 aMenuPane->DeleteMenuItem(ECalenCopyToCalendars);
       
   336                 }
       
   337             else
       
   338                 {
       
   339                 // "Mark completed" item
       
   340                 TCalenInstanceId instId = iServices.Context().InstanceId();
       
   341                 TBool isTodoFocused; // true when instId is not null and instId type == todo
       
   342                 isTodoFocused = !(instId == TCalenInstanceId::NullInstanceId()) &&
       
   343                                 instId.iType == CCalEntry::ETodo;
       
   344 
       
   345                 if ( ! isTodoFocused )
       
   346                     {
       
   347                     aMenuPane->DeleteMenuItem( ECalenCompleteTodo );
       
   348                     }
       
   349                 }
       
   350             if(!iDayContainer->IsEmptyView() && CCalenLocationUtil::IsMapProviderAvailableL())
       
   351             	{
       
   352 	            if(iDayContainer->IsEventHasMapLocationL() || iDayContainer->IsEventHasNoLocationTextL())
       
   353 		            {
       
   354 		            aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
       
   355 		            }
       
   356 		        if(!iDayContainer->IsEventHasMapLocationL())
       
   357 			        {
       
   358 			        aMenuPane->DeleteMenuItem( ECalenShowLocation );
       
   359 			        }
       
   360             	}
       
   361             else // No map provider available, remove both option items
       
   362 	            {
       
   363 	            aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
       
   364 	            aMenuPane->DeleteMenuItem( ECalenShowLocation );	
       
   365 	            }
       
   366             
       
   367             if( !iServices.InterimUtilsL().MRViewersEnabledL( ETrue ) )
       
   368                 {
       
   369                 aMenuPane->DeleteMenuItem( ECalenNewMeetingRequest );
       
   370                 }
       
   371             // Offer the menu pane to the services for customisation by the
       
   372             // the view manager/plugins
       
   373             iServices.OfferMenuPaneL( aResourceId, aMenuPane );
       
   374             
       
   375 			// Single click integration 
       
   376             TInt menuIndex( 0 );
       
   377             if ( aMenuPane->MenuItemExists( ECalenSend, menuIndex ) )
       
   378                 {
       
   379                 aMenuPane->SetItemSpecific( ECalenSend, ETrue );
       
   380                 }
       
   381             break;
       
   382             }
       
   383 
       
   384         default:
       
   385             break;
       
   386         }
       
   387 
       
   388     TRACE_EXIT_POINT;
       
   389     }
       
   390 
       
   391 // ---------------------------------------------------------
       
   392 // CCalenDayView::HandleCommandL
       
   393 // Command handling for Day view.
       
   394 // This is needed for MSK. Check wheter Open or Context menu
       
   395 // events are triggered. By default call CCalenNativeView's
       
   396 // HandleCommand.
       
   397 // (other items were commented in a header).
       
   398 // ---------------------------------------------------------
       
   399 //
       
   400 void CCalenDayView::HandleCommandL(TInt aCommand)
       
   401     {
       
   402     TRACE_ENTRY_POINT;
       
   403 
       
   404     switch (aCommand)
       
   405         {
       
   406         case EAknSoftkeyOpen:
       
   407         case ECalenViewCurrentEntry:
       
   408             {
       
   409             if(!iEventViewCommandHandled)
       
   410                 {
       
   411                 if(iDayContainer->IsValidEntryL()&&!iDayContainer->IsEmptyView())
       
   412                     {
       
   413                     // Set the context when performing an action
       
   414                     iDayContainer->SetContextFromHighlightL();
       
   415                     
       
   416                     CCalenNativeView::HandleCommandL( ECalenEventView );
       
   417                     iEventViewCommandHandled = ETrue;
       
   418                     }
       
   419                 }
       
   420             }
       
   421             break;
       
   422          // TODO:will be uncommented with copy to cal functionality.   
       
   423         case ECalenCopyToCalendars:
       
   424             {
       
   425             CopyToCalendarsL();
       
   426             }
       
   427             break;
       
   428             
       
   429         case ECalenDeleteCurrentEntry:
       
   430             iDayContainer->NotifyDeleteItemL();
       
   431             CCalenNativeView::HandleCommandL( ECalenDeleteCurrentEntry );
       
   432             break;
       
   433 #ifdef RD_CALEN_ENHANCED_MSK            
       
   434         	case ECalenCmdOpenMskDialog:
       
   435         	CCalenNativeView::HandleCommandL( ECalenNewMeeting );
       
   436         	break;
       
   437 #else
       
   438         case EAknSoftkeyContextOptions:
       
   439             MenuBar()->TryDisplayContextMenuBarL();
       
   440             break;
       
   441 #endif //RD_CALEN_ENHANCED_MSK
       
   442 
       
   443         case EAknSoftkeyBack:
       
   444             //iServices.RequestActivationL( iPreviousViewId );
       
   445             SetCbaL( R_CALEN_DEFAULT_DAY_VIEW_CBA );
       
   446             iHighlightedRowNumber = KErrNotFound;
       
   447             iServices.IssueNotificationL(ECalenNotifyDayViewClosed);
       
   448             break;
       
   449 
       
   450         default:
       
   451             CCalenNativeView::HandleCommandL(aCommand);
       
   452             break;
       
   453         }
       
   454 
       
   455     TRACE_EXIT_POINT;
       
   456     }
       
   457 
       
   458 
       
   459 // ---------------------------------------------------------
       
   460 // CCalenDayView::UpdateCbaL
       
   461 // Set context menubar and also CBA button depending wheter
       
   462 // we have empty view or not.
       
   463 // (other items were commented in a header).
       
   464 // ---------------------------------------------------------
       
   465 //
       
   466 void CCalenDayView::UpdateCbaL()
       
   467     {
       
   468     TRACE_ENTRY_POINT;
       
   469 
       
   470     MenuBar()->SetContextMenuTitleResourceId( R_CALENDAR_DAY_CASE_MENUBAR );
       
   471 
       
   472     // if the view is empty then we use context menu CBA
       
   473     if( iDayContainer->IsEmptyView() )
       
   474         {
       
   475         SetCbaL( R_CALEN_DAY_AND_TODO_VIEW_CONTEXT_MENU_CBA );
       
   476         }
       
   477     else // set normal CBA
       
   478         {
       
   479         SetCbaL( R_CALEN_DAY_AND_TODO_VIEW_NORMAL_CBA );
       
   480         }
       
   481 
       
   482     if( iShowBackButtonOnCba )
       
   483         {
       
   484         CEikButtonGroupContainer*  cba = Cba();
       
   485         cba->SetCommandL( KSK2CBAPosition, R_CALEN_BACK_CBA_BUTTON);
       
   486         cba->DrawNow();
       
   487         }
       
   488  
       
   489     TRACE_EXIT_POINT;
       
   490     }
       
   491 
       
   492 // ----------------------------------------------------------------------------
       
   493 // CCalenDayView::Id
       
   494 // From CAknView
       
   495 // Return the UID of the day view
       
   496 // (other items were commented in a header)
       
   497 // ----------------------------------------------------------------------------
       
   498 //
       
   499 TUid CCalenDayView::Id() const
       
   500     {
       
   501     TRACE_ENTRY_POINT;
       
   502 
       
   503     TRACE_EXIT_POINT;
       
   504     return KUidCalenDayView;
       
   505     }
       
   506 
       
   507 // ----------------------------------------------------------------------------
       
   508 // CCalenDayView::CopytoCalendarsL
       
   509 // From CAknView
       
   510 // Return the UID of the day view
       
   511 // (other items were commented in a header)
       
   512 // ----------------------------------------------------------------------------
       
   513 //
       
   514 void CCalenDayView::CopyToCalendarsL()
       
   515     {
       
   516 
       
   517     // Hide the toolbar before we display settings menu
       
   518     MCalenToolbar* toolbar = iServices.ToolbarOrNull();
       
   519     if(toolbar)
       
   520         {
       
   521         toolbar->SetToolbarVisibilityL(EFalse);  
       
   522         }
       
   523     iSPUtils->UnderLineTitleText( EFalse );
       
   524     MCalenContext& context = iServices.Context();
       
   525     TCalLocalUid instanceId = context.InstanceId().iEntryLocalUid;
       
   526             
       
   527     CCalEntry* entry = iServices.EntryViewL(context.InstanceId().iColId)->FetchL(instanceId);
       
   528     CleanupStack::PushL(entry);
       
   529     
       
   530     RPointerArray<CCalEntry> calentryArray;
       
   531     calentryArray.Append( entry );
       
   532     
       
   533     // Launch the Calendar List Dialiog.
       
   534     CMultiCalUiDialog* calenDbListDialog = CMultiCalUiDialog::NewLC(calentryArray, ETrue);
       
   535     TInt err = KErrNone;
       
   536     // Execute.
       
   537     TRAP( err,calenDbListDialog->LaunchL() );
       
   538     CleanupStack::PopAndDestroy( calenDbListDialog );
       
   539     
       
   540     iSPUtils->UnderLineTitleText( EFalse );
       
   541     // Unhide the toolbar when settings is closed
       
   542     if(toolbar)
       
   543         {
       
   544         toolbar->SetToolbarVisibilityL(ETrue); 
       
   545         }
       
   546     CleanupStack::Pop(entry);
       
   547     calentryArray.ResetAndDestroy();    
       
   548     
       
   549     BeginRepopulationL();
       
   550     }
       
   551 
       
   552 // ----------------------------------------------------------------------------
       
   553 // CCalenDayView::ClearViewSpecificDataL
       
   554 // Clears any cached data for the specific view, e.g. currently
       
   555 // highlighted row, column, etc.
       
   556 // (other items were commented in a header)
       
   557 // ----------------------------------------------------------------------------
       
   558 //
       
   559 void CCalenDayView::ClearViewSpecificDataL()
       
   560     {
       
   561     TRACE_ENTRY_POINT;
       
   562 
       
   563     iDate = Time::NullTTime();
       
   564     //iHighlightedRowNumber = KErrNotFound;
       
   565     //iFirstEntryOnScreenIndex = KErrNotFound;
       
   566 
       
   567     TRACE_EXIT_POINT;
       
   568     }
       
   569 
       
   570 // ----------------------------------------------------------------------------
       
   571 // CCalenDayView::IsViewSpecificDataNullL
       
   572 // From CCalenNativeView
       
   573 // Returns ETrue if the view specific data is null, EFalse otherwise.
       
   574 // (other items were commented in a header)
       
   575 // ----------------------------------------------------------------------------
       
   576 //
       
   577 TBool CCalenDayView::IsViewSpecificDataNullL()
       
   578     {
       
   579     TRACE_ENTRY_POINT;
       
   580     TRACE_EXIT_POINT;
       
   581     return ( iDate == Time::NullTTime() ) &&
       
   582            ( iHighlightedRowNumber == KErrNotFound ) &&
       
   583            ( iFirstEntryOnScreenIndex == KErrNotFound );
       
   584     }
       
   585 
       
   586 // ----------------------------------------------------------------------------
       
   587 // CCalenDayView::ActiveStepL
       
   588 // From CCalenView
       
   589 // (other items were commented in a header)
       
   590 // ----------------------------------------------------------------------------
       
   591 //
       
   592 CCalenView::TNextPopulationStep CCalenDayView::ActiveStepL()
       
   593     {
       
   594     TRACE_ENTRY_POINT;
       
   595 
       
   596     CCalenView::TNextPopulationStep nextStep = CCalenView::EDone;
       
   597     switch( iPopulationStep )
       
   598         {
       
   599         case ENothingDone:
       
   600             {
       
   601             RArray<TInt> colIdArray;
       
   602             CCalenNativeView::GetActiveCollectionidsL( iServices, colIdArray );
       
   603             
       
   604             if(colIdArray.Count() > 0)
       
   605                 {
       
   606                 if( !iServices.InstanceViewL(colIdArray) )
       
   607                     {
       
   608                     nextStep =  CCalenView::EWaitForInstanceView;
       
   609                     break;
       
   610                     }
       
   611                 }
       
   612             else
       
   613                 {
       
   614                 if( !iServices.InstanceViewL() )
       
   615                     {
       
   616                     nextStep =  CCalenView::EWaitForInstanceView;
       
   617                     break;
       
   618                     }
       
   619                 }
       
   620             colIdArray.Reset();
       
   621             }
       
   622             
       
   623             // else fall through...
       
   624         //lint -fallthrough
       
   625         case ERequestedInstanceView:
       
   626             {
       
   627             iDayContainer->GetInstanceListL();
       
   628             iPopulationStep = ESizedChanged;
       
   629             nextStep = CCalenView::EKeepGoing;
       
   630             }
       
   631             break;
       
   632         case ESizedChanged:
       
   633            {
       
   634            iDayContainer->UpdateSize();
       
   635            iPopulationStep = ECreateSlotTableNext;
       
   636            nextStep = CCalenView::EKeepGoing;
       
   637            }
       
   638            break;
       
   639         case ECreateSlotTableNext:
       
   640             {
       
   641             iDayContainer->CreateSlotTableL();
       
   642             iPopulationStep = ECreateListBoxDataNext;
       
   643             nextStep = CCalenView::EKeepGoing;
       
   644             }
       
   645             break;
       
   646         case ECreateListBoxDataNext:
       
   647         default:
       
   648             {
       
   649             iDayContainer->CompletePopulationL();
       
   650             iPopulationStep = EPopulationDone;
       
   651             nextStep = CCalenView::EDone;
       
   652             }
       
   653             break;
       
   654         }
       
   655       
       
   656     TRACE_EXIT_POINT;  
       
   657     return nextStep;
       
   658     }
       
   659 
       
   660 // ----------------------------------------------------------------------------
       
   661 // CCalenDayView::CancelPopulation
       
   662 // From CCalenView
       
   663 // (other items were commented in a header)
       
   664 // ----------------------------------------------------------------------------
       
   665 //
       
   666 void CCalenDayView::CancelPopulation()
       
   667     {
       
   668     TRACE_ENTRY_POINT;
       
   669 
       
   670     iPopulationStep = ENothingDone;
       
   671 
       
   672     TRACE_EXIT_POINT;
       
   673     }
       
   674 
       
   675 // ----------------------------------------------------------------------------
       
   676 // CCalenDayView::CyclePosition
       
   677 // From CCalenView
       
   678 // (other items were commented in a header)
       
   679 // ----------------------------------------------------------------------------
       
   680 //
       
   681 CCalenView::TCyclePosition CCalenDayView::CyclePosition() const
       
   682     {
       
   683     TRACE_ENTRY_POINT;
       
   684     TRACE_EXIT_POINT;
       
   685     return CCalenView::EReplaceDayView;
       
   686     }
       
   687 
       
   688 // ----------------------------------------------------------------------------
       
   689 // CCalenDayView::LocalisedViewNameL
       
   690 // From CCalenView
       
   691 // (other items were commented in a header)
       
   692 // ----------------------------------------------------------------------------
       
   693 //
       
   694 const TDesC& CCalenDayView::LocalisedViewNameL( CCalenView::TViewName aViewName )
       
   695     {
       
   696     TRACE_ENTRY_POINT;
       
   697     
       
   698     HBufC* ret = NULL;
       
   699 
       
   700     switch ( aViewName )
       
   701         {
       
   702         case CCalenView::EMenuName:
       
   703             if ( !iMenuName )
       
   704                 {
       
   705                 iMenuName = StringLoader::LoadL( R_CALEN_VIEW_DAY, iCoeEnv );
       
   706                 }
       
   707             ret = iMenuName;
       
   708             break;
       
   709         case CCalenView::ESettingsName:
       
   710             if ( !iSettingsName )
       
   711                 {
       
   712                 iSettingsName = StringLoader::LoadL( R_CALEN_QTN_DEFAULT_DAY_VIEW,
       
   713                                                      iCoeEnv );
       
   714                 }
       
   715             ret = iSettingsName;
       
   716             break;
       
   717         default:
       
   718             ASSERT( EFalse );
       
   719             break;
       
   720         }
       
   721 
       
   722     TRACE_EXIT_POINT;
       
   723     return *ret;
       
   724     }
       
   725 
       
   726 // ----------------------------------------------------------------------------
       
   727 // CCalenDayView::ViewIconL
       
   728 // From CCalenView
       
   729 // (other items were commented in a header)
       
   730 // ----------------------------------------------------------------------------
       
   731 //
       
   732 CGulIcon* CCalenDayView::ViewIconL() const
       
   733     {
       
   734     TRACE_ENTRY_POINT;
       
   735     TRACE_EXIT_POINT;
       
   736     return iServices.GetIconL( MCalenServices::ECalenDayViewIcon );
       
   737     }
       
   738 
       
   739 // ----------------------------------------------------------------------------
       
   740 // CCalenDayView::UpdateDateFromContextL
       
   741 // Update date form context when entry is saved 
       
   742 // (other items were commented in a header)
       
   743 // ----------------------------------------------------------------------------
       
   744 //
       
   745 void CCalenDayView::UpdateDateFromContextL()
       
   746     {
       
   747     TRACE_ENTRY_POINT;
       
   748     
       
   749     iDate = CCalenContainer::DateFromContextL( iServices.Context() );  
       
   750     
       
   751     TRACE_EXIT_POINT;
       
   752     }
       
   753 
       
   754 // End of File