calendarui/views/src/calenmonthcontainer.cpp
branchRCL_3
changeset 12 38571fd2a704
parent 5 42814f902fe6
child 21 9711e452b5e9
equal deleted inserted replaced
5:42814f902fe6 12:38571fd2a704
   114     {
   114     {
   115     TRACE_ENTRY_POINT;
   115     TRACE_ENTRY_POINT;
   116 
   116 
   117     delete iGrid;
   117     delete iGrid;
   118     delete iMonthDataArray;
   118     delete iMonthDataArray;
   119     delete iBackgroundSkinContext;
   119     delete iBackgroundSkinContext;    
   120     if( iNativePreview && iPreview )
       
   121         {
       
   122         delete iPreview;
       
   123         iPreview = NULL;
       
   124         }
       
   125 
   120 
   126     TRACE_EXIT_POINT;
   121     TRACE_EXIT_POINT;
   127     }
   122     }
   128 
   123 
   129 // ----------------------------------------------------------------------------
   124 // ----------------------------------------------------------------------------
   508     TRACE_ENTRY_POINT;
   503     TRACE_ENTRY_POINT;
   509 
   504 
   510     SetActiveDayL( aNewActiveDay );
   505     SetActiveDayL( aNewActiveDay );
   511 
   506 
   512     // dont focus the preview popup/previewpane if any dialog or faster app is active
   507     // dont focus the preview popup/previewpane if any dialog or faster app is active
   513     if( !iView->IsEditorActiveOrFasterAppExit())
   508     if( iPreview && !iView->IsEditorActiveOrFasterAppExit())
   514     	{
   509     	{
   515     	iPreview->FocusChangedL( aNewActiveDay );
   510     	iPreview->FocusChangedL( aNewActiveDay );
   516     	}
   511     	}
   517 
   512 
   518     UpdateStatusPaneAndExtensionsL();
   513     UpdateStatusPaneAndExtensionsL();
   617 TKeyResponse CCalenMonthContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   612 TKeyResponse CCalenMonthContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
   618                                                    TEventCode aType )
   613                                                    TEventCode aType )
   619     {
   614     {
   620     TRACE_ENTRY_POINT;
   615     TRACE_ENTRY_POINT;
   621 
   616 
   622     if (aType == EEventKeyDown)
   617     if (iPreview && aType == EEventKeyDown) 
   623         {
   618         {
   624         iPreview->Hide();
   619         iPreview->Hide();
   625         }
   620         }
   626 
   621 
   627     // Common view key handling - view switching etc.
   622     // Common view key handling - view switching etc.
  1033 
  1028 
  1034     TRACE_EXIT_POINT;
  1029     TRACE_EXIT_POINT;
  1035     }
  1030     }
  1036 
  1031 
  1037 // ----------------------------------------------------------------------------
  1032 // ----------------------------------------------------------------------------
       
  1033 // CCalenMonthContainer::PreviewPane
       
  1034 // Returns previewpane pointer
       
  1035 // ----------------------------------------------------------------------------  
       
  1036 const MCalenPreview* CCalenMonthContainer::PreviewPane()
       
  1037     {
       
  1038     TRACE_ENTRY_POINT
       
  1039     TRACE_EXIT_POINT
       
  1040     return iPreview;
       
  1041     }
       
  1042 	
  1038 // CCalenMonthContainer::ConstructImplL
  1043 // CCalenMonthContainer::ConstructImplL
  1039 // Third phase constructor.
  1044 // Third phase constructor.
  1040 // This function was called CCalenNativeView::ConstructL().
  1045 // This function was called CCalenNativeView::ConstructL().
  1041 // (other items were commented in a header).
  1046 // (other items were commented in a header).
  1042 // ----------------------------------------------------------------------------
  1047 // ----------------------------------------------------------------------------
  1053     TLocale locale;
  1058     TLocale locale;
  1054 
  1059 
  1055     // Create preview pane
  1060     // Create preview pane
  1056     TRect aRect = PreviewRectL();
  1061     TRect aRect = PreviewRectL();
  1057     iPreview = iServices.CustomPreviewPaneL(aRect);
  1062     iPreview = iServices.CustomPreviewPaneL(aRect);
  1058     if (iPreview == NULL) 
  1063     
  1059 		{
       
  1060 		iPreview = CCalenPreview::NewL( iView, locale, iServices );
       
  1061 		iNativePreview = ETrue;
       
  1062 		}
       
  1063      
       
  1064     // grid
  1064     // grid
  1065     iGrid = new(ELeave) CCalenMonthGrid(iFirstDayOfGrid,this);
  1065     iGrid = new(ELeave) CCalenMonthGrid(iFirstDayOfGrid,this);
  1066     iGrid->SetContainerWindowL(*this);
  1066     iGrid->SetContainerWindowL(*this);
  1067     iGrid->ConstructL(this, CEikListBox::EMultipleSelection);
  1067     iGrid->ConstructL(this, CEikListBox::EMultipleSelection);
  1068 
  1068 
  1656     {
  1656     {
  1657     TRACE_ENTRY_POINT;
  1657     TRACE_ENTRY_POINT;
  1658 
  1658 
  1659     if(AknLayoutUtils::PenEnabled())
  1659     if(AknLayoutUtils::PenEnabled())
  1660         {
  1660         {
       
  1661         CCoeControl* control( NULL );
       
  1662         if(aPointerEvent.iType == TPointerEvent::EButton1Down)
       
  1663             {
       
  1664             control = iLayoutManager->ControlOrNull();
       
  1665             if(control)
       
  1666                 {
       
  1667                 if(control->Rect().Contains(aPointerEvent.iPosition))
       
  1668                     {
       
  1669                     control->HandlePointerEventL(aPointerEvent); 
       
  1670                     return;
       
  1671                     }
       
  1672                 }
       
  1673             }
  1661         TInt pointerIndex(-1);
  1674         TInt pointerIndex(-1);
  1662         TBool isItem (iGrid->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex));
  1675         TBool isItem (iGrid->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex));
  1663         CAknGridM* gridModel = static_cast<CAknGridM*>(iGrid->Model());
  1676         CAknGridM* gridModel = static_cast<CAknGridM*>(iGrid->Model());
  1664 
  1677 
  1665         if(gridModel->NumberOfData() <= 0)
  1678         if(gridModel->NumberOfData() <= 0)
  1730                 TMonth activeMonth( iDate.DateTime().Month() );
  1743                 TMonth activeMonth( iDate.DateTime().Month() );
  1731                 TMonth newMonth( newActiveDay.DateTime().Month() );
  1744                 TMonth newMonth( newActiveDay.DateTime().Month() );
  1732                 if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  1745                 if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  1733                     {
  1746                     {
  1734                     iGrid->HandlePointerEventL( pointerEvent );
  1747                     iGrid->HandlePointerEventL( pointerEvent );
  1735                     iPreview->Hide();
  1748                     if (iPreview)
       
  1749                         {
       
  1750                         iPreview->Hide();
       
  1751                         }
  1736                     if ( pointerIndex != index )
  1752                     if ( pointerIndex != index )
  1737                         {
  1753                         {
  1738                         iChangeMonth = EFalse;
  1754                         iChangeMonth = EFalse;
  1739                         if ( activeMonth != newMonth )
  1755                         if ( activeMonth != newMonth )
  1740                             {
  1756                             {
  1777 void CCalenMonthContainer::HandleListBoxEventL(
  1793 void CCalenMonthContainer::HandleListBoxEventL(
  1778         CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
  1794         CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
  1779     {
  1795     {
  1780     switch ( aEventType )
  1796     switch ( aEventType )
  1781         {
  1797         {
  1782         case ( MEikListBoxObserver::EEventItemDoubleClicked ):
  1798         case ( MEikListBoxObserver::EEventItemClicked ): 
  1783             {
  1799             {
  1784             if ( !iView->MenuBar()->IsDisplayed() )
  1800             if ( !iView->MenuBar()->IsDisplayed() )
  1785                 {
  1801                 {
  1786                 iServices.IssueCommandL( ECalenForwardsToDayView );
  1802                 iServices.IssueCommandL( ECalenForwardsToDayView );
  1787                 }
  1803                 }
  1789             }
  1805             }
  1790         }
  1806         }
  1791     }
  1807     }
  1792 
  1808 
  1793 
  1809 
  1794 
  1810 // ----------------------------------------------------------------------------
       
  1811 // CCalenMonthContainer::HidePopup
       
  1812 // ----------------------------------------------------------------------------
  1795 void CCalenMonthContainer::HidePopup()
  1813 void CCalenMonthContainer::HidePopup()
  1796     {
  1814     {
  1797     TRACE_ENTRY_POINT;
  1815     TRACE_ENTRY_POINT;
  1798     
  1816     if (iPreview)
  1799     iPreview->Hide();
  1817         {
  1800     
  1818         iPreview->Hide();
       
  1819         }
  1801     TRACE_EXIT_POINT;
  1820     TRACE_EXIT_POINT;
  1802     }
  1821     }
  1803 
  1822 
  1804 // ----------------------------------------------------------------------------
  1823 // ----------------------------------------------------------------------------
  1805 // CCalenMonthContainer::RedrawPreviewPane
  1824 // CCalenMonthContainer::RedrawPreviewPane
  2129     AddToStackAndMakeVisibleL();
  2148     AddToStackAndMakeVisibleL();
  2130 		
  2149 		
  2131 		iView->SetEditorActive( EFalse );
  2150 		iView->SetEditorActive( EFalse );
  2132 		
  2151 		
  2133     // dont focus the preview popup/previewpane if any dialog or faster app is active
  2152     // dont focus the preview popup/previewpane if any dialog or faster app is active
  2134     if(!iView->IsEditorActiveOrFasterAppExit())
  2153     if(iPreview && !iView->IsEditorActiveOrFasterAppExit())
  2135        {
  2154        {
  2136        // preview popup is shown when application comes to foreground
  2155        // preview popup is shown when application comes to foreground
  2137        iPreview->FocusChangedL( iServices.Context().FocusDateAndTimeL().TimeLocalL() );
  2156        iPreview->FocusChangedL( iServices.Context().FocusDateAndTimeL().TimeLocalL() );
  2138        }
  2157        }
  2139     
  2158