calendarui/views/src/caleneventview.cpp
branchRCL_3
changeset 48 bf573002ff72
parent 36 9c5b1510919f
child 60 96907930389d
equal deleted inserted replaced
36:9c5b1510919f 48:bf573002ff72
    39 #include "calendar.hrh"
    39 #include "calendar.hrh"
    40 #include <finditem.hrh>
    40 #include <finditem.hrh>
    41 #include <finditemmenu.h>
    41 #include <finditemmenu.h>
    42 #include "calenattachmentmodel.h" 
    42 #include "calenattachmentmodel.h" 
    43 
    43 
       
    44 #include <aknappui.h>
    44 // Button position of the MSK CBA button
    45 // Button position of the MSK CBA button
    45 const TInt KSK2CBAPosition = 2;
    46 const TInt KSK2CBAPosition = 2;
    46 
    47 
    47 // ================= MEMBER FUNCTIONS =========================================
    48 // ================= MEMBER FUNCTIONS =========================================
    48 
    49 
   156         	break;
   157         	break;
   157         case EPopulationDone: 
   158         case EPopulationDone: 
   158         default:    
   159         default:    
   159         	{
   160         	{
   160         	cnt->CompletePopulationL();
   161         	cnt->CompletePopulationL();
   161         	RedrawStatusPaneL();
   162         	if(!iAvkonAppUi->IsDisplayingMenuOrDialog())
   162         	UpdateToolbarButtonsL();
   163         	    {
       
   164                 RedrawStatusPaneL();
       
   165                 UpdateToolbarButtonsL();
       
   166         	    }
   163         	nextStep = CCalenView::EDone;
   167         	nextStep = CCalenView::EDone;
   164         	}
   168         	}
   165         	break;
   169         	break;
   166         }
   170         }
   167     TRACE_EXIT_POINT;  
   171     TRACE_EXIT_POINT;  
   289     if (iServices.GetAttachmentData()->NumberOfItems()) 
   293     if (iServices.GetAttachmentData()->NumberOfItems()) 
   290         {
   294         {
   291         iServices.GetAttachmentData()->Reset();
   295         iServices.GetAttachmentData()->Reset();
   292         }
   296         }
   293     iPreviousViewId.iViewUid = KNullUid;
   297     iPreviousViewId.iViewUid = KNullUid;
   294 
   298     if (!iAvkonAppUi->IsDisplayingMenuOrDialog())
       
   299         {
       
   300         iSPUtils->HideNaviPane();
       
   301         }
   295     // Remove the toolbar buttons for event viewer before exiting from event view
   302     // Remove the toolbar buttons for event viewer before exiting from event view
   296     TRAP_IGNORE(RemoveToolbarButtonsL());
   303     TRAP_IGNORE(RemoveToolbarButtonsL());
   297     
   304     
   298     TRACE_EXIT_POINT;
   305     TRACE_EXIT_POINT;
   299     }
   306     }
   338     CCalenEventViewContainer* cnt = static_cast<CCalenEventViewContainer*>( iContainer );
   345     CCalenEventViewContainer* cnt = static_cast<CCalenEventViewContainer*>( iContainer );
   339     HBufC* titleText = StringLoader::LoadLC( cnt->GetTitleTextId(), iCoeEnv );
   346     HBufC* titleText = StringLoader::LoadLC( cnt->GetTitleTextId(), iCoeEnv );
   340     iSPUtils->UnderLineTitleText( EFalse );
   347     iSPUtils->UnderLineTitleText( EFalse );
   341     iSPUtils->SetTitleText( titleText );    // ownership passed
   348     iSPUtils->SetTitleText( titleText );    // ownership passed
   342     CleanupStack::Pop( titleText );
   349     CleanupStack::Pop( titleText );
       
   350     SetStatusPaneFromActiveContextL();
   343     iSPUtils->RefreshStatusPane();
   351     iSPUtils->RefreshStatusPane();
   344 
   352 
   345     TRACE_EXIT_POINT;
   353     TRACE_EXIT_POINT;
   346     }
   354     }
   347   
   355   
   405                 {
   413                 {
   406                 iServices.IssueNotificationL(ECalenNotifyAlarmSnoozed);
   414                 iServices.IssueNotificationL(ECalenNotifyAlarmSnoozed);
   407                 }
   415                 }
   408             else
   416             else
   409                 {
   417                 {
   410                 if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand))
   418                 if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand) && toolbarImpl)
   411                     {
   419                     {
   412                     CAknToolbar& toolbar = toolbarImpl->Toolbar();
   420                     CAknToolbar& toolbar = toolbarImpl->Toolbar();
   413                     toolbar.SetToolbarVisibility( EFalse );
   421                     toolbar.SetToolbarVisibility( EFalse );
   414                     cnt->GetFindItemMenu()->HandleItemFinderCommandL( aCommand );
   422                     cnt->GetFindItemMenu()->HandleItemFinderCommandL( aCommand );
   415                     toolbar.SetToolbarVisibility( ETrue );
   423                     toolbar.SetToolbarVisibility( ETrue );
   438            {
   446            {
   439            cnt->OnCmdFindUrlL();
   447            cnt->OnCmdFindUrlL();
   440            }
   448            }
   441            break;
   449            break;
   442         default:
   450         default:
   443             if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand))
   451             if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand) && toolbarImpl)
   444                 {
   452                 {
   445                 CAknToolbar& toolbar = toolbarImpl->Toolbar();
   453                 CAknToolbar& toolbar = toolbarImpl->Toolbar();
   446                 toolbar.SetToolbarVisibility( EFalse );
   454                 toolbar.SetToolbarVisibility( EFalse );
   447                 cnt->GetFindItemMenu()->HandleItemFinderCommandL( aCommand );
   455                 cnt->GetFindItemMenu()->HandleItemFinderCommandL( aCommand );
   448                 toolbar.SetToolbarVisibility( ETrue );
   456                 toolbar.SetToolbarVisibility( ETrue );
   808 
   816 
   809 void CCalenEventView::UpdateToolbarButtonsL()
   817 void CCalenEventView::UpdateToolbarButtonsL()
   810     {
   818     {
   811     // Get the existing toolbar from MCalenservices
   819     // Get the existing toolbar from MCalenservices
   812     MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
   820     MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
   813     CAknToolbar& toolbar = toolbarImpl->Toolbar();
   821     
   814     TCalCollectionId colId = iServices.Context().InstanceId().iColId;
   822     TCalCollectionId colId = iServices.Context().InstanceId().iColId;
   815       
   823       
   816     // get multiple db data from services
   824     // get multiple db data from services
   817     RPointerArray<CCalCalendarInfo> calendarInfoList;
   825     RPointerArray<CCalCalendarInfo> calendarInfoList;
   818     iServices.GetAllCalendarInfoL(calendarInfoList);
   826     iServices.GetAllCalendarInfoL(calendarInfoList);
   820     
   828     
   821     HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC();
   829     HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC();
   822     TInt index = calendarInfoList.Find( *calendarFileName, 
   830     TInt index = calendarInfoList.Find( *calendarFileName, 
   823     CCalenEventViewContainer::CalendarInfoIdentifierL);
   831     CCalenEventViewContainer::CalendarInfoIdentifierL);
   824     CleanupStack::PopAndDestroy(calendarFileName);
   832     CleanupStack::PopAndDestroy(calendarFileName);
   825     
   833     if(toolbarImpl)
   826     
       
   827     if(!(calendarInfoList[index]->Enabled()))
       
   828         {
   834         {
   829         toolbar.SetItemDimmed( ECalenSend, ETrue, ETrue );
   835         CAknToolbar& toolbar = toolbarImpl->Toolbar();
   830         toolbar.SetItemDimmed( ECalenDeleteCurrentEntry, ETrue, ETrue );
   836         if(!(calendarInfoList[index]->Enabled()))
   831         toolbar.SetItemDimmed( ECalenEditCurrentEntry, ETrue, ETrue );
   837             {
   832         }
   838             toolbar.SetItemDimmed( ECalenSend, ETrue, ETrue );
   833     else
   839             toolbar.SetItemDimmed( ECalenDeleteCurrentEntry, ETrue, ETrue );
   834         {
   840             toolbar.SetItemDimmed( ECalenEditCurrentEntry, ETrue, ETrue );
   835         toolbar.SetItemDimmed( ECalenSend, EFalse, ETrue );
   841             }
   836         toolbar.SetItemDimmed( ECalenDeleteCurrentEntry, EFalse, ETrue );
   842         else
   837         toolbar.SetItemDimmed( ECalenEditCurrentEntry, EFalse, ETrue );
   843             {
       
   844             toolbar.SetItemDimmed( ECalenSend, EFalse, ETrue );
       
   845             toolbar.SetItemDimmed( ECalenDeleteCurrentEntry, EFalse, ETrue );
       
   846             toolbar.SetItemDimmed( ECalenEditCurrentEntry, EFalse, ETrue );
       
   847             }
   838         }
   848         }
   839     CleanupStack::PopAndDestroy(&calendarInfoList);
   849     CleanupStack::PopAndDestroy(&calendarInfoList);
   840     }
   850     }
       
   851 // ----------------------------------------------------------------------------
       
   852 // CCalenEventView::SetStatusPaneFromActiveContextL
       
   853 // Set the calendar name to status pane
       
   854 // (other items were commented in a header).
       
   855 // ----------------------------------------------------------------------------
       
   856 //
       
   857 void CCalenEventView::SetStatusPaneFromActiveContextL()
       
   858     {
       
   859     TRACE_ENTRY_POINT;
       
   860     
       
   861     RPointerArray<CCalCalendarInfo> calendarInfoList;
       
   862     iServices.GetAllCalendarInfoL(calendarInfoList);
       
   863     CleanupClosePushL(calendarInfoList);
       
   864 
       
   865     TCalCollectionId colId; 
       
   866     colId = iServices.Context().InstanceId().iColId;
       
   867 
       
   868     HBufC* calendarFileName = iServices.GetCalFileNameForCollectionId(colId).AllocLC();
       
   869     TInt calIndex = calendarInfoList.Find( *calendarFileName, 
       
   870             CCalenEventViewContainer::CalendarInfoIdentifierL);
       
   871     CleanupStack::PopAndDestroy(calendarFileName);
       
   872     if(calIndex != KErrNotFound)
       
   873         {
       
   874         HBufC* calendarName = calendarInfoList[calIndex]->NameL().AllocLC();
       
   875         TRgb calendarColor = calendarInfoList[calIndex]->Color();
       
   876         // navi pane
       
   877         CAknNavigationDecorator* naviLabel = iSPUtils->ShowNaviPaneL( *calendarName, calendarColor );
       
   878         CleanupStack::PopAndDestroy(calendarName);
       
   879         }
       
   880     CleanupStack::PopAndDestroy(&calendarInfoList);
       
   881     
       
   882 
       
   883     iSPUtils->RefreshStatusPane();
       
   884     TRACE_EXIT_POINT;
       
   885     }
   841 //end of file
   886 //end of file