calendarui/views/src/calenmissedeventview.cpp
changeset 0 f979ecb2b13e
child 13 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 Event View implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // system includes
       
    21 #include <StringLoader.h>
       
    22 #include <aknbutton.h>
       
    23 #include <akntoolbar.h>
       
    24 #include <finditem.hrh>
       
    25 #include <finditemmenu.h>
       
    26 #include <Calendar.rsg>
       
    27 #include <missedalarm.h>
       
    28 #include <missedalarmstore.h>
       
    29 #include <calenagendautils.h>
       
    30 #include <calentry.h>
       
    31 #include <calentryview.h>
       
    32 #include <calencommands.hrh>            // Calendar commands
       
    33 #include <calencontext.h>
       
    34 #include <CalenStatusPaneUtils.h>
       
    35 #include <caleninstanceid.h>            // TCalenInstanceId
       
    36 
       
    37 // user includes
       
    38 #include "calenmissedeventview.h"
       
    39 #include "calendarui_debug.h"
       
    40 #include "calenmissedeventcontainer.h"
       
    41 #include <calenview.h>
       
    42 #include "CalenUid.h"
       
    43 #include "calenlocationutil.h"
       
    44 #include "calenentryutil.h"
       
    45 #include "CleanupResetAndDestroy.h"
       
    46 
       
    47 // Button position of the MSK CBA button
       
    48 const TInt KSK2CBAPosition = 2;
       
    49 _LIT8( KCommandMissedEventView,"MEV" );
       
    50 
       
    51 // ----------------------------------------------------------------------------
       
    52 // CCalenMissedEventView::NewL
       
    53 // Two-phased constructor.
       
    54 // ----------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CCalenMissedEventView* CCalenMissedEventView::NewL( MCalenServices& aServices )
       
    57 	{
       
    58 	TRACE_ENTRY_POINT;
       
    59 	
       
    60 	CCalenMissedEventView* self = new( ELeave )CCalenMissedEventView( aServices );
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL();
       
    63     CleanupStack::Pop( self );
       
    64 
       
    65     TRACE_EXIT_POINT;
       
    66     return self;
       
    67 	}
       
    68 
       
    69 // ----------------------------------------------------------------------------
       
    70 // CCalenMissedEventView::ConstructL
       
    71 // Constructor
       
    72 // ----------------------------------------------------------------------------
       
    73 //
       
    74 void CCalenMissedEventView::ConstructL()
       
    75 	{
       
    76 	TRACE_ENTRY_POINT;
       
    77 	
       
    78 	CommonConstructL( R_CALEN_MISSED_EVENT_VIEW );
       
    79 	
       
    80 	TRACE_EXIT_POINT;
       
    81 	}
       
    82 
       
    83 // ----------------------------------------------------------------------------
       
    84 // CCalenMissedEventView::CCalenMissedEventView
       
    85 // C++ constructor.
       
    86 // ----------------------------------------------------------------------------
       
    87 //
       
    88 CCalenMissedEventView::CCalenMissedEventView( MCalenServices& aServices )
       
    89     : CCalenNativeView( aServices ),
       
    90     iPopulationStep( ENothingDone )
       
    91     {
       
    92 	TRACE_ENTRY_POINT;
       
    93 	TRACE_EXIT_POINT;
       
    94     }
       
    95  
       
    96 // ----------------------------------------------------------------------------
       
    97 // CCalenMissedEventView::~CCalenMissedEventView
       
    98 // Destructor
       
    99 // ----------------------------------------------------------------------------
       
   100 //
       
   101 CCalenMissedEventView::~CCalenMissedEventView()
       
   102 	{
       
   103 	TRACE_ENTRY_POINT;
       
   104 	TRACE_EXIT_POINT;
       
   105 	}
       
   106 
       
   107 // ----------------------------------------------------------------------------
       
   108 // CCalenMissedEventView::ActiveStepL
       
   109 // From CCalenView
       
   110 // (other items were commented in a header)
       
   111 // ----------------------------------------------------------------------------
       
   112 //
       
   113 CCalenView::TNextPopulationStep CCalenMissedEventView::ActiveStepL()
       
   114     {
       
   115     TRACE_ENTRY_POINT;
       
   116 	
       
   117 	CCalenView::TNextPopulationStep nextStep = CCalenView::EDone;
       
   118 	CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer );
       
   119 	
       
   120     switch( iPopulationStep )
       
   121         {
       
   122         case ENothingDone:
       
   123         	{
       
   124 			iPopulationStep = EBuildTextEditor;
       
   125 			nextStep = CCalenView::EKeepGoing;
       
   126         	}
       
   127         	break;
       
   128         case EBuildTextEditor:
       
   129         	{
       
   130         	cnt->BuildTextEditorL();
       
   131  			iPopulationStep = ERequestInstanceView;       	
       
   132  			nextStep = CCalenView::EKeepGoing;
       
   133         	}
       
   134         	break;
       
   135         case ERequestInstanceView:
       
   136         	{
       
   137         	cnt->RequestInstanceViewL();
       
   138 			iPopulationStep = EAddField; 
       
   139  			nextStep = CCalenView::EKeepGoing;			       	
       
   140         	}
       
   141         	break;
       
   142         case EAddField:
       
   143         	{
       
   144         	cnt->AddFieldsL();
       
   145 			iPopulationStep = EPopulationDone;   
       
   146  			nextStep = CCalenView::EKeepGoing;			     	
       
   147         	}
       
   148         	break;
       
   149         case EPopulationDone: 
       
   150         default:    
       
   151         	{
       
   152         	cnt->CompletePopulationL();
       
   153         	RedrawStatusPaneL();
       
   154         	nextStep = CCalenView::EDone;
       
   155         	}
       
   156         	break;
       
   157         }
       
   158     TRACE_EXIT_POINT;  
       
   159     return nextStep;  
       
   160     }
       
   161 
       
   162 // ----------------------------------------------------------------------------
       
   163 // CCalenMissedEventView::CancelPopulation
       
   164 // From CCalenView
       
   165 // (other items were commented in a header)
       
   166 // ----------------------------------------------------------------------------
       
   167 //
       
   168 void CCalenMissedEventView::CancelPopulation()
       
   169     {
       
   170     TRACE_ENTRY_POINT;
       
   171     
       
   172     iPopulationStep = ENothingDone;
       
   173 
       
   174     TRACE_EXIT_POINT;
       
   175     }
       
   176 
       
   177 // ----------------------------------------------------------------------------
       
   178 // CCalenMissedEventView::LocalisedViewNameL
       
   179 // From CCalenView
       
   180 // (other items were commented in a header)
       
   181 // ----------------------------------------------------------------------------
       
   182 //
       
   183 const TDesC& CCalenMissedEventView::LocalisedViewNameL( CCalenView::TViewName /*aViewName*/ )
       
   184     {
       
   185     TRACE_ENTRY_POINT;
       
   186     _LIT(KEV,"Missed Event View");
       
   187     TRACE_EXIT_POINT;
       
   188     return KEV;
       
   189     }
       
   190 
       
   191 // ----------------------------------------------------------------------------
       
   192 // CCalenMissedEventView::ViewIcon
       
   193 // From CCalenView
       
   194 // (other items were commented in a header)
       
   195 // ----------------------------------------------------------------------------
       
   196 //
       
   197 CGulIcon* CCalenMissedEventView::ViewIconL() const
       
   198     {
       
   199     TRACE_ENTRY_POINT;
       
   200     TRACE_EXIT_POINT;
       
   201     return NULL;
       
   202     }
       
   203 
       
   204 // ----------------------------------------------------------------------------
       
   205 // CCalenMissedEventView::DoActivateImplL
       
   206 // (other items were commented in a header).
       
   207 // ----------------------------------------------------------------------------
       
   208 //
       
   209 void CCalenMissedEventView::DoActivateImplL( const TVwsViewId& aPrevViewId,
       
   210                                       TUid aCustomMessageId ,
       
   211                                       const TDesC8& aCustomMessage )
       
   212     {
       
   213     TRACE_ENTRY_POINT;
       
   214 	
       
   215     iShowCloseButtonOnCba =
       
   216         ( aCustomMessageId == KUidCalenShowCloseCba ? ETrue : EFalse );
       
   217     
       
   218     // for handling missedeventview activation from sn/indicator
       
   219     // when only one missed alarm is there
       
   220     // issue command ECalenMissedEventViewFromIdle to set the context,
       
   221     // clear the missed alarm before launching missed event view
       
   222     if(aPrevViewId.iAppUid!=KUidCalendar)
       
   223         {
       
   224         // get the custom view message
       
   225         HBufC8* temp = aCustomMessage.AllocLC();
       
   226         TPtr8 des = temp->Des();
       
   227         des.UpperCase();
       
   228         
       
   229         if( des.Find( KCommandMissedEventView) != KErrNotFound )
       
   230             {
       
   231             iServices.IssueCommandL(ECalenMissedEventViewFromIdle);
       
   232             }
       
   233         CleanupStack::PopAndDestroy( temp );
       
   234         }
       
   235     
       
   236     UpdateCbaL();
       
   237     
       
   238     // Draw even viewer toolbar by adding Edit, Delete and Send buttons
       
   239 	AddToolbarButtonsL();
       
   240 	
       
   241     TRACE_EXIT_POINT;
       
   242     }
       
   243 
       
   244 // ----------------------------------------------------------------------------
       
   245 // CCalenMissedEventView::DoDeactivateImpl
       
   246 // Take action before deactivating the view
       
   247 // ----------------------------------------------------------------------------
       
   248 //
       
   249 void CCalenMissedEventView::DoDeactivateImpl()
       
   250     {
       
   251     TRACE_ENTRY_POINT;
       
   252     
       
   253     iPreviousViewId.iViewUid = KNullUid;
       
   254 
       
   255     // Remove the toolbar buttons for event viewer before exiting from event view
       
   256     TRAP_IGNORE(RemoveToolbarButtonsL());
       
   257     
       
   258     TRACE_EXIT_POINT;
       
   259     }
       
   260 
       
   261 // ----------------------------------------------------------------------------
       
   262 // CCalenMissedEventView::OnLocaleChangedL
       
   263 // (other items were commented in a header).
       
   264 // ----------------------------------------------------------------------------
       
   265 //
       
   266 void CCalenMissedEventView::OnLocaleChangedL(TInt /*aReason*/)  
       
   267     {
       
   268     TRACE_ENTRY_POINT;
       
   269 
       
   270     TRACE_EXIT_POINT;
       
   271     }
       
   272     
       
   273 // ----------------------------------------------------------------------------
       
   274 // CCalenMissedEventView::RedrawStatusPaneL
       
   275 // (other items were commented in a header).
       
   276 // ----------------------------------------------------------------------------
       
   277 //
       
   278 void CCalenMissedEventView::RedrawStatusPaneL()  
       
   279     {
       
   280     TRACE_ENTRY_POINT;
       
   281 
       
   282     CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer );
       
   283     HBufC* titleText = StringLoader::LoadLC( cnt->GetTitleTextId(), iCoeEnv );
       
   284     iSPUtils->UnderLineTitleText( EFalse );
       
   285     iSPUtils->SetTitleText( titleText );    // ownership passed
       
   286     CleanupStack::Pop( titleText );
       
   287     iSPUtils->RefreshStatusPane();
       
   288 
       
   289     TRACE_EXIT_POINT;
       
   290     }
       
   291   
       
   292 // ----------------------------------------------------------------------------
       
   293 // CCalenMissedEventView::HandleCommandL
       
   294 // (other items were commented in a header).
       
   295 // ----------------------------------------------------------------------------
       
   296 //
       
   297 void CCalenMissedEventView::HandleCommandL(TInt aCommand)  
       
   298     {
       
   299     TRACE_ENTRY_POINT;
       
   300 
       
   301     CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer );
       
   302 	switch(aCommand)
       
   303 		{
       
   304 		case ECalenCmdPromptThenEdit:
       
   305 			{
       
   306 			iServices.IssueCommandL(ECalenEditCurrentEntry);
       
   307 			break;	
       
   308 			}
       
   309         case ECalenCompleteTodo:
       
   310         case ECalenRestoreTodo:            
       
   311         	{        
       
   312             CCalenNativeView::HandleCommandL(aCommand);         
       
   313         	}
       
   314             break;
       
   315         case EAknSoftkeyClose:   
       
   316         case EAknSoftkeyBack:
       
   317 			{
       
   318 	        iServices.IssueNotificationL(ECalenNotifyMissedEventViewClosed);
       
   319 			break;
       
   320 			}
       
   321         default:
       
   322             if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand))
       
   323                 {
       
   324                 cnt->GetFindItemMenu()->HandleItemFinderCommandL(aCommand);
       
   325                 return;
       
   326                 }
       
   327             CCalenNativeView::HandleCommandL(aCommand);
       
   328             break;
       
   329         }
       
   330 
       
   331     TRACE_EXIT_POINT;
       
   332     }  
       
   333 
       
   334 // ----------------------------------------------------------------------------
       
   335 // CCalenMissedEventView::DynInitMenuPaneL
       
   336 // (other items were commented in a header).
       
   337 // ----------------------------------------------------------------------------
       
   338 //
       
   339 void CCalenMissedEventView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
       
   340 	{
       
   341     TRACE_ENTRY_POINT;
       
   342     CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer );
       
   343     switch(aResourceId)
       
   344     	{
       
   345 	    case R_CALEN_EVENT_VIEW_MENUPANE:
       
   346         case R_CALEN_EVENT_VIEW_LONGTAP_MENUPANE:
       
   347 	    	{
       
   348 	    	CCalenEntryUtil* eventViewData = cnt->GetEventViewData();
       
   349             if(eventViewData)
       
   350                 {
       
   351                 if(eventViewData->EntryType() == CCalEntry::ETodo)
       
   352                       {
       
   353                       if(eventViewData->Status() == CCalEntry::ETodoCompleted)
       
   354                           {
       
   355                           aMenuPane->DeleteMenuItem(ECalenCompleteTodo);
       
   356                           }
       
   357                       else
       
   358                           {
       
   359                           aMenuPane->DeleteMenuItem(ECalenRestoreTodo);
       
   360                           }
       
   361                       }             
       
   362                   else
       
   363                       {
       
   364                       aMenuPane->DeleteMenuItem(ECalenCompleteTodo);
       
   365                       aMenuPane->DeleteMenuItem(ECalenRestoreTodo);
       
   366                       }
       
   367                 }
       
   368             
       
   369 		  	cnt->GetFindItemMenu()->AddItemFindMenuL(cnt->GetItemFinder(),aMenuPane,EFindItemMenuPlaceHolder,KNullDesC);
       
   370 		  	 
       
   371 		  	 if(CCalenLocationUtil::IsMapProviderAvailableL())
       
   372             	{
       
   373 	            if(cnt->IsEventHasMapLocationL() || cnt->IsEventHasNoLocationTextL())
       
   374 		            {
       
   375 		            aMenuPane->DeleteMenuItem( ECalenGetLocationAndSave );
       
   376 		            }
       
   377 		        if(!cnt->IsEventHasMapLocationL())
       
   378 			        {
       
   379 			        aMenuPane->DeleteMenuItem( ECalenShowLocation );	
       
   380 			        }	
       
   381             	}
       
   382             else // No map provider available, remove both option items
       
   383 	            {
       
   384 	            aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
       
   385 	            aMenuPane->DeleteMenuItem( ECalenShowLocation );	
       
   386 	            }
       
   387 		    break;
       
   388 		  	}
       
   389 		 default:
       
   390 		    {
       
   391 		      cnt->GetFindItemMenu()->UpdateItemFinderMenuL(aResourceId,aMenuPane); 
       
   392 		    }
       
   393 			break;
       
   394 		}
       
   395     
       
   396     TRACE_EXIT_POINT;	
       
   397 	}
       
   398 	
       
   399 // ----------------------------------------------------------------------------
       
   400 // CCalenMissedEventView::Id
       
   401 // Returns unique view id
       
   402 // ----------------------------------------------------------------------------
       
   403 //
       
   404 TUid CCalenMissedEventView::Id() const
       
   405 	{
       
   406     TRACE_ENTRY_POINT;
       
   407     TRACE_EXIT_POINT;	
       
   408     return KUidCalenMissedEventView;
       
   409 	}
       
   410 
       
   411 // ----------------------------------------------------------------------------
       
   412 // CCalenMissedEventView::CreateContainerImplL
       
   413 // create container
       
   414 // ----------------------------------------------------------------------------
       
   415 //
       
   416 CCalenContainer* CCalenMissedEventView::CreateContainerImplL() 
       
   417 	{
       
   418     TRACE_ENTRY_POINT;
       
   419     TRACE_EXIT_POINT;	
       
   420     return new( ELeave )CCalenMissedEventContainer( this, iServices );
       
   421 	}
       
   422 
       
   423 // ---------------------------------------------------------
       
   424 // CCalenMissedEventView::UpdateCbaL
       
   425 // Set CBA button 
       
   426 // ---------------------------------------------------------
       
   427 //
       
   428 void CCalenMissedEventView::UpdateCbaL()
       
   429     {
       
   430     TRACE_ENTRY_POINT;  
       
   431     
       
   432     CEikButtonGroupContainer*  cba = Cba();
       
   433     
       
   434     if(iShowCloseButtonOnCba)
       
   435         {
       
   436         cba->SetCommandL( KSK2CBAPosition, R_CALEN_CLOSE_CBA_BUTTON );
       
   437         }
       
   438     
       
   439     cba->DrawNow();
       
   440        
       
   441     TRACE_EXIT_POINT;
       
   442     }
       
   443 // ----------------------------------------------------------------------------
       
   444 // CCalenMissedEventView::ClearViewSpecificDataL
       
   445 // Clear view specific data
       
   446 // ----------------------------------------------------------------------------
       
   447 //
       
   448 void CCalenMissedEventView::ClearViewSpecificDataL()
       
   449 	{
       
   450     TRACE_ENTRY_POINT;
       
   451 
       
   452     TRACE_EXIT_POINT;	
       
   453 	}
       
   454 
       
   455 // ----------------------------------------------------------------------------
       
   456 // CCalenMissedEventView::CyclePosition
       
   457 // Returns view cycle position
       
   458 // ----------------------------------------------------------------------------
       
   459 //
       
   460 CCalenView::TCyclePosition CCalenMissedEventView::CyclePosition() const
       
   461 	{
       
   462 	TRACE_ENTRY_POINT;
       
   463     TRACE_EXIT_POINT;	
       
   464     return ENoCyclePosition;
       
   465 	}
       
   466 
       
   467 // ----------------------------------------------------------------------------
       
   468 // CCalenMissedEventView::AddToolbarButtonsL
       
   469 // Adds the necessary toolbar buttons on the existing toolbar for event viewer
       
   470 // ----------------------------------------------------------------------------
       
   471 //
       
   472 void CCalenMissedEventView::AddToolbarButtonsL()
       
   473 	{
       
   474 	TRACE_ENTRY_POINT;
       
   475 	
       
   476 	// Get the existing toolbar from MCalenservices
       
   477 	MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
       
   478 	
       
   479 	if(toolbarImpl)  // If toolbar exists
       
   480 		{
       
   481 		CAknToolbar& toolbar = toolbarImpl->Toolbar();
       
   482 		
       
   483 		// Create the new buttons for event viewer toolbar
       
   484 		// If layout is mirrored the button order is reversed.
       
   485 	    // For Non mirrored layouts each button is appended to the toolbar
       
   486 	    // For mirrored layouts each button is inserted at index 0.
       
   487 	    TBool mirrored( AknLayoutUtils::LayoutMirrored() );
       
   488 	    
       
   489 	    CAknButton* button = NULL;
       
   490 	    CGulIcon* icon = NULL;
       
   491 	    
       
   492 	    // First button: Send
       
   493 	    icon = iServices.GetIconL( MCalenServices::ECalenViewerSendIcon );
       
   494 	    // put icon onto cleanup stack before its ownership is transferred to CAknButton
       
   495 	    button = CreateButtonL( icon, _L(""), R_CALEN_TB_SEND, toolbar );
       
   496 	    if( mirrored )
       
   497 	        {
       
   498 	        // Insert the button at index 0
       
   499 	        toolbar.AddItemL( button, EAknCtButton, ECalenSend, 0, 0 );
       
   500 	        }
       
   501 	    else
       
   502 	        {
       
   503 	        // Append the button
       
   504 	        toolbar.AddItemL( button, EAknCtButton, ECalenSend, 0, 0 );
       
   505 	        }
       
   506 	    
       
   507 	    // Second button: Edit
       
   508 	    icon = iServices.GetIconL( MCalenServices::ECalenViewerEditIcon );
       
   509 	    // put icon onto cleanup stack before its ownership is transferred to CAknButton
       
   510 	    button = CreateButtonL( icon, _L(""), R_CALEN_TB_EDIT, toolbar );
       
   511 	    if( mirrored )
       
   512 	        {
       
   513 	        // Insert the button at index 0
       
   514 	        toolbar.AddItemL( button, EAknCtButton, ECalenEditCurrentEntry, 0, 0 );
       
   515 	        }
       
   516 	    else
       
   517 	        {
       
   518 	        // Append the button
       
   519 	        toolbar.AddItemL( button, EAknCtButton, ECalenEditCurrentEntry, 0, 1 );
       
   520 	        }
       
   521 	    
       
   522 	    // Third button: Delete
       
   523 	    icon = iServices.GetIconL( MCalenServices::ECalenViewerDeleteIcon );
       
   524 	    // put icon onto cleanup stack before its ownership is transferred to CAknButton
       
   525 	    button = CreateButtonL( icon, _L(""), R_CALEN_TB_DELETE, toolbar );
       
   526 	    if( mirrored )
       
   527 	        {
       
   528 	        // Insert the button at index 0
       
   529 	        toolbar.AddItemL( button, EAknCtButton, ECalenDeleteCurrentEntry, 0, 0 );
       
   530 	        }
       
   531 	    else
       
   532 	        {
       
   533 	        // Append the button
       
   534 	        toolbar.AddItemL( button, EAknCtButton, ECalenDeleteCurrentEntry, 0, 2 );
       
   535 	        }
       
   536 		}
       
   537     TRACE_EXIT_POINT;
       
   538 	}
       
   539 
       
   540 // ----------------------------------------------------------------------------
       
   541 // CCalenMissedEventView::RemoveToolbarButtonsL
       
   542 // Removes the event viewer toolbar buttons and unhides the view cycling buttons
       
   543 // ----------------------------------------------------------------------------
       
   544 //
       
   545 void CCalenMissedEventView::RemoveToolbarButtonsL()
       
   546 	{
       
   547 	TRACE_ENTRY_POINT;
       
   548 	
       
   549 	MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
       
   550 	if(toolbarImpl) // If toolbar exists
       
   551 		{
       
   552 		CAknToolbar& toolbar = toolbarImpl->Toolbar();
       
   553 		if(&toolbar)
       
   554 		    {
       
   555 		    // Remove the viewer toolbar buttons
       
   556 		    toolbar.RemoveItem(ECalenDeleteCurrentEntry); // Delete button
       
   557 		    toolbar.RemoveItem(ECalenEditCurrentEntry);  // Edit button
       
   558 		    toolbar.RemoveItem(ECalenSend);  // Send button
       
   559 		    }
       
   560 		}
       
   561 	
       
   562 	TRACE_EXIT_POINT;
       
   563 	}
       
   564 	
       
   565 // ----------------------------------------------------------------------------
       
   566 // CCalenMissedEventView::CreateButtonL
       
   567 // Create calendar toolbar buttons
       
   568 // ----------------------------------------------------------------------------
       
   569 CAknButton* CCalenMissedEventView::CreateButtonL( CGulIcon* aIcon, 
       
   570                                             const TDesC& aText,
       
   571                                             TInt aTooltipID,
       
   572                                             CAknToolbar& aToolbar )
       
   573     {
       
   574     TRACE_ENTRY_POINT;
       
   575 
       
   576     TInt flags = 0;
       
   577     CAknButton* button = NULL;
       
   578     
       
   579     CleanupStack::PushL( aIcon );
       
   580     HBufC* tooltipText = StringLoader::LoadLC( aTooltipID );
       
   581     CleanupStack::Pop( tooltipText );
       
   582     // put icon onto cleanup stack before its ownership is transferred to CAknButton
       
   583     CleanupStack::Pop( aIcon );
       
   584     CleanupStack::PushL( tooltipText );
       
   585     button = CAknButton::NewL( aIcon, NULL, NULL, NULL,
       
   586                                             aText, tooltipText->Des(), flags, 0 );
       
   587     CleanupStack::PopAndDestroy( tooltipText );
       
   588 
       
   589     button->SetIconScaleMode( EAspectRatioNotPreserved );
       
   590     button->SetFocusing( EFalse );
       
   591     button->SetBackground( &aToolbar );
       
   592 
       
   593     TRACE_EXIT_POINT;
       
   594     return button;
       
   595     }    
       
   596 
       
   597 //end of file