23 #include <aknbutton.h> |
23 #include <aknbutton.h> |
24 #include <akntoolbar.h> |
24 #include <akntoolbar.h> |
25 #include <calencommands.hrh> // Calendar commands |
25 #include <calencommands.hrh> // Calendar commands |
26 #include <calencontext.h> |
26 #include <calencontext.h> |
27 #include <CalenStatusPaneUtils.h> |
27 #include <CalenStatusPaneUtils.h> |
|
28 #include <calcalendarinfo.h> |
|
29 #include <caleninstanceid.h> |
28 |
30 |
29 // user includes |
31 // user includes |
30 #include "caleneventview.h" |
32 #include "caleneventview.h" |
31 #include "calendarui_debug.h" |
33 #include "calendarui_debug.h" |
32 #include "caleneventviewcontainer.h" |
34 #include "caleneventviewcontainer.h" |
419 case EAknSoftkeyEmpty: // so that it will not crash in stop-snooze case. |
422 case EAknSoftkeyEmpty: // so that it will not crash in stop-snooze case. |
420 { |
423 { |
421 // nothing to do |
424 // nothing to do |
422 } |
425 } |
423 break; |
426 break; |
|
427 case ECalenCmdFindPhoneNum: |
|
428 { |
|
429 cnt->OnCmdFindPhoneNumL(); |
|
430 } |
|
431 break; |
|
432 case ECalenCmdFindEmail: |
|
433 { |
|
434 cnt->OnCmdFindEmailL(); |
|
435 } |
|
436 break; |
|
437 case ECalenCmdFindURL: |
|
438 { |
|
439 cnt->OnCmdFindUrlL(); |
|
440 } |
|
441 break; |
424 default: |
442 default: |
425 if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand)) |
443 if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand)) |
426 { |
444 { |
427 CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
445 CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
428 toolbar.SetToolbarVisibility( EFalse ); |
446 toolbar.SetToolbarVisibility( EFalse ); |
463 // |
481 // |
464 void CCalenEventView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
482 void CCalenEventView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
465 { |
483 { |
466 TRACE_ENTRY_POINT; |
484 TRACE_ENTRY_POINT; |
467 CCalenEventViewContainer* cnt = static_cast<CCalenEventViewContainer*>( iContainer ); |
485 CCalenEventViewContainer* cnt = static_cast<CCalenEventViewContainer*>( iContainer ); |
|
486 TCalCollectionId colId = iServices.Context().InstanceId().iColId; |
|
487 // get multiple db data from services |
|
488 RPointerArray<CCalCalendarInfo> calendarInfoList; |
|
489 iServices.GetAllCalendarInfoL(calendarInfoList); |
|
490 CleanupClosePushL(calendarInfoList); |
|
491 |
|
492 HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC(); |
|
493 TInt index = calendarInfoList.Find( *calendarFileName, |
|
494 CCalenEventViewContainer::CalendarInfoIdentifierL); |
|
495 CleanupStack::PopAndDestroy(calendarFileName); |
468 switch(aResourceId) |
496 switch(aResourceId) |
469 { |
497 { |
470 case R_CALEN_EVENT_VIEW_MENUPANE: |
498 case R_CALEN_EVENT_VIEW_MENUPANE: |
471 case R_CALEN_EVENT_VIEW_LONGTAP_MENUPANE: |
499 case R_CALEN_EVENT_VIEW_LONGTAP_MENUPANE: |
472 { |
500 { |
495 if(!eventViewData->AttachmentCount()) |
523 if(!eventViewData->AttachmentCount()) |
496 { |
524 { |
497 aMenuPane->DeleteMenuItem(ECalenViewAttachmentList); |
525 aMenuPane->DeleteMenuItem(ECalenViewAttachmentList); |
498 } |
526 } |
499 } |
527 } |
500 cnt->GetFindItemMenu()->AddItemFindMenuL(cnt->GetItemFinder(),aMenuPane,EFindItemMenuPlaceHolder,KNullDesC); |
528 |
501 |
529 |
502 if(CCalenLocationUtil::IsMapProviderAvailableL()) |
530 if(CCalenLocationUtil::IsMapProviderAvailableL()) |
503 { |
531 { |
504 if(cnt->IsEventHasMapLocationL() || cnt->IsEventHasNoLocationTextL()) |
532 if(cnt->IsEventHasMapLocationL() || cnt->IsEventHasNoLocationTextL()) |
505 { |
533 { |
513 else // No map provider available, remove both option items |
541 else // No map provider available, remove both option items |
514 { |
542 { |
515 aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace ); |
543 aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace ); |
516 aMenuPane->DeleteMenuItem( ECalenShowLocation ); |
544 aMenuPane->DeleteMenuItem( ECalenShowLocation ); |
517 } |
545 } |
|
546 if(!(calendarInfoList[index]->Enabled())) |
|
547 { |
|
548 aMenuPane->DeleteMenuItem(ECalenSend); |
|
549 aMenuPane->DeleteMenuItem(ECalenCmdPromptThenEdit); |
|
550 aMenuPane->DeleteMenuItem(ECalenDeleteCurrentEntry); |
|
551 } |
|
552 |
|
553 |
518 break; |
554 break; |
519 } |
555 } |
520 default: |
556 default: |
521 { |
557 { |
522 cnt->GetFindItemMenu()->UpdateItemFinderMenuL(aResourceId,aMenuPane); |
558 cnt->GetFindItemMenu()->UpdateItemFinderMenuL(aResourceId,aMenuPane); |
523 } |
559 } |
524 break; |
560 break; |
525 } |
561 } |
526 |
562 CleanupStack::PopAndDestroy(&calendarInfoList); |
527 TRACE_EXIT_POINT; |
563 TRACE_EXIT_POINT; |
528 } |
564 } |
529 |
565 |
530 // ---------------------------------------------------------------------------- |
566 // ---------------------------------------------------------------------------- |
531 // CCalenEventView::Id |
567 // CCalenEventView::Id |
760 button->SetFocusing( EFalse ); |
796 button->SetFocusing( EFalse ); |
761 button->SetBackground( &aToolbar ); |
797 button->SetBackground( &aToolbar ); |
762 |
798 |
763 TRACE_EXIT_POINT; |
799 TRACE_EXIT_POINT; |
764 return button; |
800 return button; |
765 } |
801 } |
|
802 |
|
803 // ---------------------------------------------------------------------------- |
|
804 // CCalenEventView::UpdateToolbarButtonsL |
|
805 // Updates the toolbar buttons on the existing toolbar for event viewer |
|
806 // ---------------------------------------------------------------------------- |
|
807 // |
|
808 |
|
809 void CCalenEventView::UpdateToolbarButtonsL() |
|
810 { |
|
811 // Get the existing toolbar from MCalenservices |
|
812 MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull(); |
|
813 CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
814 TCalCollectionId colId = iServices.Context().InstanceId().iColId; |
|
815 |
|
816 // get multiple db data from services |
|
817 RPointerArray<CCalCalendarInfo> calendarInfoList; |
|
818 iServices.GetAllCalendarInfoL(calendarInfoList); |
|
819 CleanupClosePushL(calendarInfoList); |
|
820 |
|
821 HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC(); |
|
822 TInt index = calendarInfoList.Find( *calendarFileName, |
|
823 CCalenEventViewContainer::CalendarInfoIdentifierL); |
|
824 CleanupStack::PopAndDestroy(calendarFileName); |
|
825 |
|
826 |
|
827 if(!(calendarInfoList[index]->Enabled())) |
|
828 { |
|
829 toolbar.SetItemDimmed( ECalenSend, ETrue, ETrue ); |
|
830 toolbar.SetItemDimmed( ECalenDeleteCurrentEntry, ETrue, ETrue ); |
|
831 toolbar.SetItemDimmed( ECalenEditCurrentEntry, ETrue, ETrue ); |
|
832 } |
|
833 else |
|
834 { |
|
835 toolbar.SetItemDimmed( ECalenSend, EFalse, ETrue ); |
|
836 toolbar.SetItemDimmed( ECalenDeleteCurrentEntry, EFalse, ETrue ); |
|
837 toolbar.SetItemDimmed( ECalenEditCurrentEntry, EFalse, ETrue ); |
|
838 } |
|
839 CleanupStack::PopAndDestroy(&calendarInfoList); |
|
840 } |
766 //end of file |
841 //end of file |