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; |
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 |