calendarui/views/src/calenmissedalarmsview.cpp
branchRCL_3
changeset 13 1984aceb8774
parent 0 f979ecb2b13e
child 15 9711e452b5e9
equal deleted inserted replaced
11:0f07cd1b5772 13:1984aceb8774
   129        	    // complete population
   129        	    // complete population
   130        	    Container()->CompletePopulationL();
   130        	    Container()->CompletePopulationL();
   131        	    RedrawStatusPaneL();
   131        	    RedrawStatusPaneL();
   132        	    UpdateCbaL();
   132        	    UpdateCbaL();
   133        	    
   133        	    
   134        	    // dim clear and clear all buttons
   134        	 
   135        	    if(Container()->MissedAlarmsCount()==0)
       
   136        	        {
       
   137        	        DimClearAndClearAllButtons();
       
   138        	        }
       
   139 
   135 
   140         	nextStep = CCalenView::EDone;
   136         	nextStep = CCalenView::EDone;
   141         	}
   137         	}
   142         	break;	
   138         	break;	
   143         }
   139         }
   232 		    iHighlightedRowNumber = Container()->CurrentItemIndex();
   228 		    iHighlightedRowNumber = Container()->CurrentItemIndex();
   233 		    iServices.IssueCommandL(aCommand);
   229 		    iServices.IssueCommandL(aCommand);
   234 		    break;
   230 		    break;
   235 		    }
   231 		    }
   236         case ECalenCmdClearAll:
   232         case ECalenCmdClearAll:
   237         case ECalenCmdGotoCalendar:            
       
   238             {
   233             {
   239             iHighlightedRowNumber = 0;
   234             iHighlightedRowNumber = 0;
   240             iServices.IssueCommandL(aCommand);
   235             iServices.IssueCommandL(aCommand);
   241             }
   236             }
   242             break;
   237             break;
       
   238         case ECalenCmdGotoCalendar:            
       
   239             {
       
   240             MCalenToolbar* toolbar = iServices.ToolbarOrNull(); 
       
   241             if(toolbar)
       
   242              {
       
   243              toolbar->SetToolbarVisibilityL(ETrue);  
       
   244              } 
       
   245             iHighlightedRowNumber = 0;
       
   246             iServices.IssueCommandL(aCommand);
       
   247             }
       
   248             break;
   243         case EAknSoftkeyBack:
   249         case EAknSoftkeyBack:
   244         case EAknSoftkeyClose:
   250         case EAknSoftkeyClose:
   245             {
   251             {
       
   252             MCalenToolbar* toolbar = iServices.ToolbarOrNull(); 
       
   253             if(toolbar)
       
   254              {
       
   255              toolbar->SetToolbarVisibilityL(ETrue);  
       
   256              } 
   246             iHighlightedRowNumber = 0;
   257             iHighlightedRowNumber = 0;
   247             iServices.IssueNotificationL(ECalenNotifyMissedAlarmViewClosed);
   258             iServices.IssueNotificationL(ECalenNotifyMissedAlarmViewClosed);
       
   259             }
       
   260             break;
       
   261         case EAknSoftkeyExit:
       
   262             {
       
   263             MCalenToolbar* toolbar = iServices.ToolbarOrNull(); 
       
   264             if(toolbar)
       
   265              {
       
   266              toolbar->SetToolbarVisibilityL(ETrue);  
       
   267              } 
       
   268             CCalenNativeView::HandleCommandL(aCommand);
   248             }
   269             }
   249             break;
   270             break;
   250         default:
   271         default:
   251             CCalenNativeView::HandleCommandL(aCommand);
   272             CCalenNativeView::HandleCommandL(aCommand);
   252             break;
   273             break;
   288         iShowCloseButtonOnCba = EFalse; 
   309         iShowCloseButtonOnCba = EFalse; 
   289         }
   310         }
   290     
   311     
   291     UpdateCbaL();
   312     UpdateCbaL();
   292     
   313     
   293     // Draw Missed Alarm toolbar by adding clear, clearall and gotocalendar buttons
   314     // Hide the toolbar.
   294     AddToolbarButtonsL();
   315     MCalenToolbar* toolbar = iServices.ToolbarOrNull();
       
   316     if(toolbar)
       
   317         {
       
   318         toolbar->SetToolbarVisibilityL(EFalse);  
       
   319         }  
   295     
   320     
   296     TRACE_EXIT_POINT;
   321     TRACE_EXIT_POINT;
   297     }
   322     }
   298 
   323 
   299 // ----------------------------------------------------------------------------
   324 // ----------------------------------------------------------------------------
   302 // ----------------------------------------------------------------------------
   327 // ----------------------------------------------------------------------------
   303 //
   328 //
   304 void CCalenMissedAlarmsView::DoDeactivateImpl()
   329 void CCalenMissedAlarmsView::DoDeactivateImpl()
   305     {
   330     {
   306     TRACE_ENTRY_POINT;
   331     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     
   332     
   312     TRACE_EXIT_POINT;
   333     TRACE_EXIT_POINT;
   313     }
   334     }
   314 
   335 
   315 // ----------------------------------------------------------------------------
   336 // ----------------------------------------------------------------------------
   483 	TRACE_EXIT_POINT;
   504 	TRACE_EXIT_POINT;
   484 	
   505 	
   485 	return static_cast<CCalenMissedAlarmsContainer*>( iContainer );
   506 	return static_cast<CCalenMissedAlarmsContainer*>( iContainer );
   486 	}
   507 	}
   487 
   508 
   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	
   509 // end of file