calendarui/views/src/calenmissedalarmsview.cpp
changeset 0 f979ecb2b13e
child 19 1984aceb8774
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 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:   Missed alarms view description   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // System Includes
       
    21 #include <aknlists.h>
       
    22 #include <StringLoader.h>
       
    23 #include <eikmenup.h>
       
    24 #include <hlplch.h>
       
    25 #include <featmgr.h>
       
    26 #include <aknbutton.h>
       
    27 #include <akntoolbar.h>
       
    28 #include <Calendar.rsg>
       
    29 #include <CalenDefaultEditorsData.rsg>
       
    30 #include <calencommands.hrh>            // Calendar commands
       
    31 #include <CalenStatusPaneUtils.h>
       
    32 #include <calennotificationhandler.h>
       
    33 #include <calencontext.h>
       
    34 
       
    35 // User Includes
       
    36 #include "calendarui_debug.h"
       
    37 #include "calenmissedalarmsview.h"
       
    38 #include "calenmissedalarmscontainer.h"
       
    39 #include "calencontainer.h"
       
    40 #include "calentitlepane.h"
       
    41 #include "CalenUid.h"
       
    42 
       
    43 _LIT8( KCommandMissedAlarmsView,"MAV" );
       
    44 const TInt KSK2CBAPosition = 2;
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CCalenMissedAlarmsView::NewLC
       
    48 // Symbian OS 2 phased constructor.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 EXPORT_C CCalenMissedAlarmsView* CCalenMissedAlarmsView::NewL( MCalenServices& aServices )
       
    52     {
       
    53     TRACE_ENTRY_POINT;
       
    54 		
       
    55 	CCalenMissedAlarmsView* self = new( ELeave )CCalenMissedAlarmsView(aServices);
       
    56     CleanupStack::PushL( self );
       
    57     self->ConstructL();
       
    58     CleanupStack::Pop( self );
       
    59     
       
    60     TRACE_EXIT_POINT;
       
    61     return self;
       
    62     }
       
    63     
       
    64 // -----------------------------------------------------------------------------
       
    65 // CCalenMissedAlarmsView::ConstructL
       
    66 // Performs the second phase construction.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 void CCalenMissedAlarmsView::ConstructL()
       
    70     {
       
    71     TRACE_ENTRY_POINT;
       
    72     
       
    73     CommonConstructL( R_MISSED_ALARMS_VIEW );
       
    74     
       
    75     TRACE_EXIT_POINT;
       
    76     }
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // CCalenMissedAlarmsView::CCalenEventView
       
    80 // C++ constructor.
       
    81 // ----------------------------------------------------------------------------
       
    82 //
       
    83 CCalenMissedAlarmsView::CCalenMissedAlarmsView( MCalenServices& aServices )
       
    84     : CCalenNativeView( aServices ),
       
    85     iPopulationStep( ENothingDone )
       
    86     {
       
    87 	TRACE_ENTRY_POINT;
       
    88 	TRACE_EXIT_POINT;
       
    89     }
       
    90  
       
    91 // ----------------------------------------------------------------------------
       
    92 // CCalenMissedAlarmsView::~CCalenMissedAlarmsView
       
    93 // Destructor
       
    94 // ----------------------------------------------------------------------------
       
    95 //
       
    96 CCalenMissedAlarmsView::~CCalenMissedAlarmsView()
       
    97 	{
       
    98 	TRACE_ENTRY_POINT;
       
    99 	TRACE_EXIT_POINT;
       
   100 	}
       
   101 
       
   102 // ----------------------------------------------------------------------------
       
   103 // CCalenMissedAlarmsView::ActiveStepL
       
   104 // From CCalenView:State machine for view population
       
   105 // ----------------------------------------------------------------------------
       
   106 //
       
   107 CCalenView::TNextPopulationStep CCalenMissedAlarmsView::ActiveStepL()
       
   108     {
       
   109     TRACE_ENTRY_POINT;
       
   110 	
       
   111 	CCalenView::TNextPopulationStep nextStep = CCalenView::EDone;
       
   112 		
       
   113      switch( iPopulationStep )
       
   114         {
       
   115         case ENothingDone:
       
   116         	{
       
   117         	iPopulationStep = EPopulationDone;   
       
   118  			nextStep = CCalenView::EKeepGoing;
       
   119 			}
       
   120         	break;
       
   121         case EPopulationDone:
       
   122 	       	{
       
   123 	       	// update missed alarm list
       
   124 	       	Container()->UpdateMissedAlarmsArrayL();
       
   125 
       
   126 	       	// populate with missed alarms
       
   127 	       	Container()->PopulateWithMissedAlarmsL();
       
   128        	    
       
   129        	    // complete population
       
   130        	    Container()->CompletePopulationL();
       
   131        	    RedrawStatusPaneL();
       
   132        	    UpdateCbaL();
       
   133        	    
       
   134        	    // dim clear and clear all buttons
       
   135        	    if(Container()->MissedAlarmsCount()==0)
       
   136        	        {
       
   137        	        DimClearAndClearAllButtons();
       
   138        	        }
       
   139 
       
   140         	nextStep = CCalenView::EDone;
       
   141         	}
       
   142         	break;	
       
   143         }
       
   144     TRACE_EXIT_POINT;  
       
   145     return nextStep;  
       
   146     }
       
   147 
       
   148 // ----------------------------------------------------------------------------
       
   149 // CCalenMissedAlarmsView::CancelPopulation
       
   150 // From CCalenView:Cencel view population
       
   151 // ----------------------------------------------------------------------------
       
   152 //
       
   153 void CCalenMissedAlarmsView::CancelPopulation()
       
   154     {
       
   155     TRACE_ENTRY_POINT;
       
   156     
       
   157     iPopulationStep = ENothingDone;
       
   158 
       
   159     TRACE_EXIT_POINT;
       
   160     }
       
   161 
       
   162 // ----------------------------------------------------------------------------
       
   163 // CCalenMissedAlarmsView::LocalisedViewNameL
       
   164 // From CCalenView:Localised view name
       
   165 // ----------------------------------------------------------------------------
       
   166 //
       
   167 const TDesC& CCalenMissedAlarmsView::LocalisedViewNameL( CCalenView::TViewName aViewName )
       
   168     {
       
   169     TRACE_ENTRY_POINT;
       
   170 	
       
   171     HBufC* ret = NULL;
       
   172 
       
   173     switch ( aViewName )
       
   174         {
       
   175         case CCalenView::EMenuName:
       
   176             if ( !iMenuName )
       
   177                 {
       
   178                 iMenuName = StringLoader::LoadL( R_CALE_TITLE_MISSED_ALARMS, iCoeEnv );
       
   179                 }
       
   180             ret = iMenuName;
       
   181             break;
       
   182         case CCalenView::ESettingsName:
       
   183             if ( !iSettingsName )
       
   184                 {
       
   185                 iSettingsName = StringLoader::LoadL( R_CALE_TITLE_MISSED_ALARMS,
       
   186                                                      iCoeEnv );
       
   187                 }
       
   188             ret = iSettingsName;
       
   189             break;
       
   190         default:
       
   191             ASSERT( EFalse );
       
   192             break;
       
   193         }
       
   194 
       
   195     TRACE_EXIT_POINT;
       
   196     return *ret;
       
   197     }
       
   198 
       
   199 // ----------------------------------------------------------------------------
       
   200 // CCalenMissedAlarmsView::ViewIcon
       
   201 // From CCalenView: Returns view specific icon
       
   202 // ----------------------------------------------------------------------------
       
   203 //
       
   204 CGulIcon* CCalenMissedAlarmsView::ViewIconL() const
       
   205     {
       
   206     TRACE_ENTRY_POINT;
       
   207     TRACE_EXIT_POINT;
       
   208     // using clear all missed alarms icon as view icon
       
   209     return iServices.GetIconL( MCalenServices::ECalenClearAllMissedAlarms );
       
   210     }
       
   211 
       
   212 // -----------------------------------------------------------------------------
       
   213 // CCalenMissedAlarmsView::HandleCommandL
       
   214 // Handles the commands that are passed from softkey generated commands and menus.
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 void CCalenMissedAlarmsView::HandleCommandL(TInt aCommand)
       
   218 	{
       
   219 	TRACE_ENTRY_POINT;
       
   220 	
       
   221 	switch(aCommand)
       
   222 		{
       
   223 		case ECalenMissedEventView:
       
   224 	    case EAknSoftkeyOpen:
       
   225 			{
       
   226 			iHighlightedRowNumber = Container()->CurrentItemIndex();
       
   227 			iServices.IssueCommandL(ECalenMissedEventView);
       
   228 			break;
       
   229 			}
       
   230 		case ECalenCmdClear:
       
   231 		    {
       
   232 		    iHighlightedRowNumber = Container()->CurrentItemIndex();
       
   233 		    iServices.IssueCommandL(aCommand);
       
   234 		    break;
       
   235 		    }
       
   236         case ECalenCmdClearAll:
       
   237         case ECalenCmdGotoCalendar:            
       
   238             {
       
   239             iHighlightedRowNumber = 0;
       
   240             iServices.IssueCommandL(aCommand);
       
   241             }
       
   242             break;
       
   243         case EAknSoftkeyBack:
       
   244         case EAknSoftkeyClose:
       
   245             {
       
   246             iHighlightedRowNumber = 0;
       
   247             iServices.IssueNotificationL(ECalenNotifyMissedAlarmViewClosed);
       
   248             }
       
   249             break;
       
   250         default:
       
   251             CCalenNativeView::HandleCommandL(aCommand);
       
   252             break;
       
   253         	}
       
   254  	
       
   255     TRACE_EXIT_POINT;	
       
   256 	}        
       
   257 
       
   258 // ----------------------------------------------------------------------------
       
   259 // CCalenMissedAlarmsView::DoActivateImplL
       
   260 // Take action before activating the view
       
   261 // ----------------------------------------------------------------------------
       
   262 //
       
   263 void CCalenMissedAlarmsView::DoActivateImplL( const TVwsViewId& aPrevViewId,
       
   264                                       TUid aCustomMessageId ,
       
   265                                       const TDesC8& aCustomMessage )
       
   266     {
       
   267     TRACE_ENTRY_POINT;
       
   268 	
       
   269     // if missed alarms view launched from soft notification/indicator
       
   270     if( (aPrevViewId.iAppUid != KUidCalendar )||
       
   271         (aCustomMessageId == KUidCalenShowCloseCba ) )
       
   272         {
       
   273         iShowCloseButtonOnCba = ETrue;
       
   274         
       
   275         // get the custom view message
       
   276         HBufC8* temp = aCustomMessage.AllocLC();
       
   277         TPtr8 des = temp->Des();
       
   278         des.UpperCase();
       
   279         
       
   280         if( des.Find( KCommandMissedAlarmsView) != KErrNotFound )
       
   281             {
       
   282             iServices.IssueCommandL(ECalenMissedAlarmsViewFromIdle);
       
   283             }
       
   284         CleanupStack::PopAndDestroy( temp );
       
   285         }
       
   286     else
       
   287         {
       
   288         iShowCloseButtonOnCba = EFalse; 
       
   289         }
       
   290     
       
   291     UpdateCbaL();
       
   292     
       
   293     // Draw Missed Alarm toolbar by adding clear, clearall and gotocalendar buttons
       
   294     AddToolbarButtonsL();
       
   295     
       
   296     TRACE_EXIT_POINT;
       
   297     }
       
   298 
       
   299 // ----------------------------------------------------------------------------
       
   300 // CCalenMissedAlarmsView::DoDeactivateImpl
       
   301 // Take action before view deactivation
       
   302 // ----------------------------------------------------------------------------
       
   303 //
       
   304 void CCalenMissedAlarmsView::DoDeactivateImpl()
       
   305     {
       
   306     TRACE_ENTRY_POINT;
       
   307     
       
   308     // Remove the toolbar buttons from Missed Alarm View and
       
   309     // enable native view toolbar buttons
       
   310     TRAP_IGNORE(RemoveToolbarButtonsL());
       
   311     
       
   312     TRACE_EXIT_POINT;
       
   313     }
       
   314 
       
   315 // ----------------------------------------------------------------------------
       
   316 // CCalenMissedAlarmsView::OnLocaleChangedL
       
   317 // Handle locale changes
       
   318 // ----------------------------------------------------------------------------
       
   319 //
       
   320 void CCalenMissedAlarmsView::OnLocaleChangedL(TInt aReason)  
       
   321     {
       
   322     TRACE_ENTRY_POINT;
       
   323     
       
   324     if(iContainer)
       
   325         {
       
   326         if(IsContainerFocused())
       
   327             {
       
   328             if (aReason & EChangesLocale)
       
   329                 {
       
   330                 BeginRepopulationL();
       
   331                 }
       
   332             else
       
   333                 {
       
   334                 RedrawStatusPaneL();
       
   335                 }
       
   336             }
       
   337         else
       
   338             {
       
   339             iLocChangeReason = EChangesLocale;
       
   340             }
       
   341         }
       
   342         
       
   343     TRACE_EXIT_POINT;
       
   344     }
       
   345 
       
   346 // ----------------------------------------------------------------------------
       
   347 // CCalenMissedAlarmsView::RedrawStatusPaneL
       
   348 // Redraw status pane
       
   349 // ----------------------------------------------------------------------------
       
   350 //
       
   351 void CCalenMissedAlarmsView::RedrawStatusPaneL()  
       
   352     {
       
   353     TRACE_ENTRY_POINT;
       
   354 	
       
   355     HBufC* titleText = StringLoader::LoadLC( R_CALE_TITLE_MISSED_ALARMS, iCoeEnv );
       
   356     iSPUtils->UnderLineTitleText( EFalse );
       
   357     iSPUtils->SetTitleText( titleText );    // ownership passed
       
   358     CleanupStack::Pop( titleText );
       
   359     iSPUtils->RefreshStatusPane();
       
   360 
       
   361     TRACE_EXIT_POINT;
       
   362     }
       
   363 
       
   364 // ----------------------------------------------------------------------------
       
   365 // CCalenMissedAlarmsView::ClearViewSpecificDataL
       
   366 // Clear view specific data
       
   367 // ----------------------------------------------------------------------------
       
   368 //
       
   369 void CCalenMissedAlarmsView::ClearViewSpecificDataL()
       
   370 	{
       
   371     TRACE_ENTRY_POINT;
       
   372     TRACE_EXIT_POINT;	
       
   373 	}
       
   374 
       
   375 // ----------------------------------------------------------------------------
       
   376 // CCalenMissedAlarmsView::CyclePosition
       
   377 // Returns view's cycle position
       
   378 // ----------------------------------------------------------------------------
       
   379 //
       
   380 CCalenView::TCyclePosition CCalenMissedAlarmsView::CyclePosition() const
       
   381 	{
       
   382 	TRACE_ENTRY_POINT;
       
   383     TRACE_EXIT_POINT;	
       
   384 
       
   385     return ENoCyclePosition;
       
   386 	}
       
   387 
       
   388 // -----------------------------------------------------------------------------
       
   389 // CCalenMissedAlarmsView::Id
       
   390 // Returns the unique id of the view.
       
   391 // -----------------------------------------------------------------------------
       
   392 //
       
   393  TUid CCalenMissedAlarmsView::Id() const
       
   394  	{
       
   395  	TRACE_ENTRY_POINT;
       
   396 	TRACE_EXIT_POINT;	
       
   397 	
       
   398  	return KUidCalenMissedAlarmsView;
       
   399  	}	
       
   400 
       
   401  // -----------------------------------------------------------------------------
       
   402  // CCalenMissedAlarmsView::DynInitMenuPaneL
       
   403  // Called by the framework for dynamically initializing the menu pane.
       
   404  // -----------------------------------------------------------------------------
       
   405  // 
       
   406 void CCalenMissedAlarmsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
       
   407 	{
       
   408 	TRACE_ENTRY_POINT;
       
   409 	
       
   410 	switch(aResourceId)
       
   411 		{
       
   412 		case R_MISSED_ALARMS_MENUPANE:
       
   413 			{
       
   414 			if(Container()->MissedAlarmsCount() == 0)
       
   415 				{
       
   416 				aMenuPane->DeleteMenuItem(ECalenMissedEventView);
       
   417 				aMenuPane->DeleteMenuItem(ECalenCmdClear);
       
   418 				aMenuPane->DeleteMenuItem(ECalenCmdClearAll);	
       
   419 				}
       
   420 			break;
       
   421 			}
       
   422 		default: 
       
   423 			break;
       
   424 		}
       
   425 			
       
   426     TRACE_EXIT_POINT;	
       
   427 	}
       
   428 
       
   429 // -----------------------------------------------------------------------------
       
   430 // CCalenMissedAlarmsView::UpdateCbaL
       
   431 // Updates the cba for Missed Alarms View
       
   432 // -----------------------------------------------------------------------------
       
   433 //
       
   434 void CCalenMissedAlarmsView::UpdateCbaL()
       
   435 	{
       
   436 	TRACE_ENTRY_POINT;
       
   437 	
       
   438 	CEikButtonGroupContainer*  cba = Cba();
       
   439     cba->SetCommandSetL(R_MISSED_ALARMS_CBA);
       
   440     
       
   441     if(iShowCloseButtonOnCba)
       
   442         {
       
   443         cba->SetCommandL(KSK2CBAPosition,R_CALEN_CLOSE_CBA_BUTTON);
       
   444         }
       
   445 
       
   446     if(Container()->MissedAlarmsCount())
       
   447     	{
       
   448     	// msk "open" is visible if there are missed alarms
       
   449     	cba->MakeCommandVisible( EAknSoftkeyOpen, ETrue );
       
   450     	}
       
   451     else
       
   452     	{
       
   453     	// msk empty if there are no missed alarms
       
   454     	cba->MakeCommandVisible( EAknSoftkeyOpen, EFalse );
       
   455     	}
       
   456     
       
   457     cba->DrawNow();	
       
   458     
       
   459 	TRACE_EXIT_POINT;    	
       
   460 	}
       
   461 	
       
   462 // ----------------------------------------------------------------------------
       
   463 // CCalenMissedAlarmsView::CreateContainerImplL
       
   464 // (other items were commented in a header).
       
   465 // ----------------------------------------------------------------------------
       
   466 //
       
   467 CCalenContainer* CCalenMissedAlarmsView::CreateContainerImplL() 
       
   468 	{
       
   469     TRACE_ENTRY_POINT;
       
   470     TRACE_EXIT_POINT;	
       
   471     return new( ELeave )CCalenMissedAlarmsContainer( this, 
       
   472                                               iServices, iHighlightedRowNumber );
       
   473 	}
       
   474 
       
   475 // ----------------------------------------------------------------------------
       
   476 // CCalenMissedAlarmsView::Container
       
   477 // Return the container pointer.
       
   478 // ----------------------------------------------------------------------------
       
   479 //
       
   480 CCalenMissedAlarmsContainer* CCalenMissedAlarmsView::Container()
       
   481 	{
       
   482 	TRACE_ENTRY_POINT;
       
   483 	TRACE_EXIT_POINT;
       
   484 	
       
   485 	return static_cast<CCalenMissedAlarmsContainer*>( iContainer );
       
   486 	}
       
   487 
       
   488 // ----------------------------------------------------------------------------
       
   489 // CCalenMissedAlarmsView::AddToolbarButtonsL
       
   490 // Adds missed alarms view's toolbar buttons 
       
   491 // ----------------------------------------------------------------------------
       
   492 //
       
   493 void CCalenMissedAlarmsView::AddToolbarButtonsL()
       
   494     {
       
   495     TRACE_ENTRY_POINT;
       
   496     
       
   497     // Get the existing toolbar from MCalenservices
       
   498     MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
       
   499     
       
   500     if(toolbarImpl)  // If toolbar exists
       
   501         {
       
   502         CAknToolbar& toolbar = toolbarImpl->Toolbar();
       
   503         
       
   504         // Create the new buttons for Missed alarm view toolbar
       
   505         // If layout is mirrored the button order is reversed.
       
   506         // For Non mirrored layouts each button is appended to the toolbar
       
   507         // For mirrored layouts each button is inserted at index 0.
       
   508         TBool mirrored( AknLayoutUtils::LayoutMirrored() );
       
   509         
       
   510         CAknButton* button = NULL;
       
   511         CGulIcon* icon = NULL;
       
   512 
       
   513         // First button: Clear
       
   514         icon = iServices.GetIconL( MCalenServices::ECalenClearMissedAlarms );
       
   515         // put icon onto cleanup stack before its 
       
   516         // ownership is transferred to CAknButton
       
   517         button = CreateButtonL( icon, _L(""), R_CALE_MAV_TB_CLEAR, toolbar );
       
   518         if( mirrored )
       
   519             {
       
   520             // Insert the button at index 0
       
   521             toolbar.AddItemL( button, EAknCtButton, ECalenCmdClear, 0, 0 );
       
   522             }
       
   523         else
       
   524             {
       
   525             // Append the button
       
   526             toolbar.AddItemL( button, EAknCtButton, ECalenCmdClear, 0, 0 );
       
   527             }
       
   528         
       
   529         // Second button: Clear All
       
   530         icon = iServices.GetIconL( MCalenServices::ECalenClearAllMissedAlarms );
       
   531         // put icon onto cleanup stack before its
       
   532         // ownership is transferred to CAknButton
       
   533         button = CreateButtonL( icon, _L(""), R_CALE_MAV_TB_CLEARALL, toolbar );
       
   534         if( mirrored )
       
   535             {
       
   536             // Insert the button at index 0
       
   537             toolbar.AddItemL( button, EAknCtButton, ECalenCmdClearAll, 0, 0 );
       
   538             }
       
   539         else
       
   540             {
       
   541             // Append the button
       
   542             toolbar.AddItemL( button, EAknCtButton, ECalenCmdClearAll, 0, 1 );
       
   543             }
       
   544         
       
   545         // Third button: Go To Calendar
       
   546         icon = iServices.GetIconL( MCalenServices::ECalenDayViewIcon );
       
   547         // put icon onto cleanup stack before its
       
   548         // ownership is transferred to CAknButton
       
   549         button = CreateButtonL( icon, _L(""), R_CALE_MAV_TB_GOTO_CALE, toolbar );
       
   550         if( mirrored )
       
   551             {
       
   552             // Insert the button at index 0
       
   553             toolbar.AddItemL( button, EAknCtButton, ECalenCmdGotoCalendar, 0, 0 );
       
   554             }
       
   555         else
       
   556             {
       
   557             // Append the button
       
   558             toolbar.AddItemL( button, EAknCtButton, ECalenCmdGotoCalendar, 0, 2 );
       
   559             }
       
   560         }
       
   561     TRACE_EXIT_POINT;
       
   562     }
       
   563 
       
   564 // ----------------------------------------------------------------------------
       
   565 // CCalenMissedAlarmsView::RemoveToolbarButtonsL
       
   566 // Removes the missed alarm view's toolbar buttons 
       
   567 // ----------------------------------------------------------------------------
       
   568 //
       
   569 void CCalenMissedAlarmsView::RemoveToolbarButtonsL()
       
   570     {
       
   571     TRACE_ENTRY_POINT;
       
   572     
       
   573     MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
       
   574     if(toolbarImpl) // If toolbar exists
       
   575         {
       
   576         CAknToolbar& toolbar = toolbarImpl->Toolbar();
       
   577         if(&toolbar)
       
   578             {
       
   579             // Remove the Missed alarm view's toolbar buttons
       
   580             toolbar.RemoveItem(ECalenCmdClear); // Clear button
       
   581             toolbar.RemoveItem(ECalenCmdClearAll);  // Clear All button
       
   582             toolbar.RemoveItem(ECalenCmdGotoCalendar);  // Go To calendar button
       
   583             }
       
   584         }
       
   585     
       
   586     TRACE_EXIT_POINT;
       
   587     }
       
   588     
       
   589 // ----------------------------------------------------------------------------
       
   590 // CCalenMissedAlarmsView::CreateButtonL
       
   591 // Create missed alarms view toolbar buttons
       
   592 // ----------------------------------------------------------------------------
       
   593 CAknButton* CCalenMissedAlarmsView::CreateButtonL( CGulIcon* aIcon, 
       
   594                                                    const TDesC& aText,
       
   595                                                    TInt aTooltipID,
       
   596                                                    CAknToolbar& aToolbar )
       
   597     {
       
   598     TRACE_ENTRY_POINT;
       
   599 
       
   600     TInt flags = 0;
       
   601     CAknButton* button = NULL;
       
   602     
       
   603     CleanupStack::PushL( aIcon );
       
   604     HBufC* tooltipText = StringLoader::LoadLC( aTooltipID );
       
   605     CleanupStack::Pop( tooltipText );
       
   606     // put icon onto cleanup stack before its ownership is transferred to CAknButton
       
   607     CleanupStack::Pop( aIcon );
       
   608     CleanupStack::PushL( tooltipText );
       
   609     button = CAknButton::NewL( aIcon, NULL, NULL, NULL, aText, 
       
   610                                tooltipText->Des(), flags, 0 );
       
   611     CleanupStack::PopAndDestroy( tooltipText );
       
   612 
       
   613     button->SetIconScaleMode( EAspectRatioNotPreserved );
       
   614     button->SetFocusing( EFalse );
       
   615     button->SetBackground( &aToolbar );
       
   616 
       
   617     TRACE_EXIT_POINT;
       
   618     return button;
       
   619     }    
       
   620 
       
   621 // ----------------------------------------------------------------------------
       
   622 // CCalenMissedAlarmsView::DimClearAndClearAllButtons
       
   623 // Dim clear and clear all toolbar buttons when there are no
       
   624 // missed alarm entries to clear
       
   625 // ----------------------------------------------------------------------------
       
   626 void CCalenMissedAlarmsView::DimClearAndClearAllButtons()
       
   627     {
       
   628     TRACE_ENTRY_POINT;
       
   629     
       
   630     MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
       
   631     if(toolbarImpl) 
       
   632         {
       
   633         CAknToolbar& toolbar = toolbarImpl->Toolbar();
       
   634 
       
   635         // dim clear and clear all toolbar buttons
       
   636         toolbar.SetItemDimmed(ECalenCmdClear,ETrue,ETrue);
       
   637         toolbar.SetItemDimmed(ECalenCmdClearAll,ETrue,ETrue);
       
   638         }
       
   639 
       
   640     TRACE_EXIT_POINT;
       
   641     }
       
   642 
       
   643 // end of file