calendarui/views/src/calenweekcontainer.cpp
branchRCL_3
changeset 12 38571fd2a704
parent 0 f979ecb2b13e
child 21 9711e452b5e9
equal deleted inserted replaced
5:42814f902fe6 12:38571fd2a704
   209 CCalenWeekContainer::~CCalenWeekContainer()
   209 CCalenWeekContainer::~CCalenWeekContainer()
   210     {
   210     {
   211     TRACE_ENTRY_POINT;
   211     TRACE_ENTRY_POINT;
   212 
   212 
   213     delete iListBox;
   213     delete iListBox;
   214     if( iNativePreview && iPreview )
   214     
   215         {
       
   216         delete iPreview;
       
   217         iPreview = NULL;
       
   218         }
       
   219     delete iDesArray;
   215     delete iDesArray;
   220 
   216 
   221     CleanupInstances();
   217     CleanupInstances();
   222 
   218 
   223     ResetSlotTable();
   219     ResetSlotTable();
  1240 
  1236 
  1241     TLocale locale;
  1237     TLocale locale;
  1242     // Create preview pane
  1238     // Create preview pane
  1243     TRect aRect = PreviewRectL();
  1239     TRect aRect = PreviewRectL();
  1244     iPreview = iServices.CustomPreviewPaneL(aRect);
  1240     iPreview = iServices.CustomPreviewPaneL(aRect);
  1245     if (iPreview == NULL) 
  1241     
  1246 		{
       
  1247 		iPreview = CCalenPreview::NewL( iView, locale, iServices );
       
  1248 		iNativePreview = ETrue;
       
  1249 		}    
       
  1250     // ownership of builder transferred
  1242     // ownership of builder transferred
  1251 
  1243 
  1252     // 3) Listbox
  1244     // 3) Listbox
  1253     iListBox = new (ELeave) CCalenWeekListbox( *this );
  1245     iListBox = new (ELeave) CCalenWeekListbox( *this );
  1254     // compile error argument is (CCoeControl*, TInt aFlag)
  1246     // compile error argument is (CCoeControl*, TInt aFlag)
  1359     // Cached layout value:
  1351     // Cached layout value:
  1360     i_listscroll_cale_week_pane.LayoutRect( main_cale_week_pane.Rect(),
  1352     i_listscroll_cale_week_pane.LayoutRect( main_cale_week_pane.Rect(),
  1361                                             AknLayoutScalable_Apps::listscroll_cale_week_pane(layoutToolBarVariant).LayoutLine() );
  1353                                             AknLayoutScalable_Apps::listscroll_cale_week_pane(layoutToolBarVariant).LayoutLine() );
  1362                                             
  1354                                             
  1363 
  1355 
  1364     TWeekListBoxLayout lay( UseInfobar(), UseToolbar(), ETrue, main_pane );
  1356     TWeekListBoxLayout lay( UseInfobar(), UseToolbar(), UsePreview(), main_pane ); 
  1365 
  1357 
  1366     iListBox->SetRect( iListBox->LayoutRect() );
  1358     iListBox->SetRect( iListBox->LayoutRect() );
  1367     TInt layoutVariant = lay.LayoutVariantIndex(TWeekListBoxLayout::EScrollPaneCp08);
  1359     TInt layoutVariant = lay.LayoutVariantIndex(TWeekListBoxLayout::EScrollPaneCp08);
  1368     AknLayoutUtils::LayoutVerticalScrollBar( iListBox->ScrollBarFrame(),
  1360     AknLayoutUtils::LayoutVerticalScrollBar( iListBox->ScrollBarFrame(),
  1369                                              i_listscroll_cale_week_pane.Rect(),
  1361                                              i_listscroll_cale_week_pane.Rect(),
  1543                                                   TEventCode aType )
  1535                                                   TEventCode aType )
  1544     {
  1536     {
  1545     TRACE_ENTRY_POINT;
  1537     TRACE_ENTRY_POINT;
  1546 
  1538 
  1547     // always hide popup on key events
  1539     // always hide popup on key events
  1548     if (aType == EEventKeyDown)
  1540     if (iPreview && aType == EEventKeyDown)
  1549         {
  1541         {
  1550         iPreview->Hide();
  1542         iPreview->Hide();
  1551         }
  1543         }
  1552 
  1544 
  1553     // common view key handling.
  1545     // common view key handling.
  1764         
  1756         
  1765         CWeekSlotArrayPtr slotTable = iSlotTable[iColumn];
  1757         CWeekSlotArrayPtr slotTable = iSlotTable[iColumn];
  1766         CCalHourItem& itemInfo = *(*slotTable)[iListBox->CurrentItemIndex()];
  1758         CCalHourItem& itemInfo = *(*slotTable)[iListBox->CurrentItemIndex()];
  1767         
  1759         
  1768         // dont focus the preview popup/previewpane if any dialog or faster app is active        
  1760         // dont focus the preview popup/previewpane if any dialog or faster app is active        
  1769 		if(!iView->IsEditorActiveOrFasterAppExit())
  1761 		if(iPreview && !iView->IsEditorActiveOrFasterAppExit())
  1770 			{
  1762 			{
  1771 	        if( !itemInfo.IsTimed() )
  1763 	        if( !itemInfo.IsTimed() )
  1772 	            { 
  1764 	            { 
  1773 	            // Non-timed cell
  1765 	            // Non-timed cell
  1774 	            iPreview->FocusChangedL(itemInfo.iInstance);
  1766 	            iPreview->FocusChangedL(itemInfo.iInstance);
  2180 
  2172 
  2181         if( !iListBox->IsValidPointer(aPointerEvent.iPosition) &&
  2173         if( !iListBox->IsValidPointer(aPointerEvent.iPosition) &&
  2182             aPointerEvent.iType == TPointerEvent::EButton1Down )
  2174             aPointerEvent.iType == TPointerEvent::EButton1Down )
  2183             {
  2175             {
  2184             IgnoreEventsUntilNextPointerUp();
  2176             IgnoreEventsUntilNextPointerUp();
       
  2177             CCoeControl* control(NULL);
       
  2178             if (aPointerEvent.iType == TPointerEvent::EButton1Down)
       
  2179                 {
       
  2180                 control = iLayoutManager->ControlOrNull();
       
  2181                 if (control)
       
  2182                     {
       
  2183                     if (control->Rect().Contains(aPointerEvent.iPosition))
       
  2184                         {
       
  2185                         control->HandlePointerEventL(aPointerEvent);
       
  2186                         }
       
  2187                     }
       
  2188                 }
  2185             return;
  2189             return;
  2186             }
  2190             }
  2187         
  2191         
  2188         switch(aPointerEvent.iType)
  2192         switch(aPointerEvent.iType)
  2189             {
  2193             {
  2202                         SetActiveContextFromHighlightL();
  2206                         SetActiveContextFromHighlightL();
  2203                         if (newColumn != oldColumn)
  2207                         if (newColumn != oldColumn)
  2204                             {
  2208                             {
  2205                             UpdateStatusPaneAndExtensionsL();
  2209                             UpdateStatusPaneAndExtensionsL();
  2206                             }
  2210                             }
  2207                         iFirstTap = ETrue;
       
  2208                         }
  2211                         }
  2209                     else
       
  2210                         iFirstTap = EFalse;
       
  2211                     }
  2212                     }
  2212                 else
  2213                 else
  2213                     {
  2214                     {
  2214                     IgnoreEventsUntilNextPointerUp();
  2215                     IgnoreEventsUntilNextPointerUp();
  2215                     }
  2216                     }
  2233                     CalcDayFromColumn();
  2234                     CalcDayFromColumn();
  2234                     SetActiveContextFromHighlightL();
  2235                     SetActiveContextFromHighlightL();
  2235                     if (newColumn != oldColumn)
  2236                     if (newColumn != oldColumn)
  2236                         {
  2237                         {
  2237                         WeekView().SetStatusPaneFromActiveContextL();
  2238                         WeekView().SetStatusPaneFromActiveContextL();
  2238                         }
  2239                         }                    
  2239                     iFirstTap = ETrue;
       
  2240                     }
  2240                     }
  2241                 break;
  2241                 break;
  2242                 }
  2242                 }
  2243             case TPointerEvent::EButton1Up:
  2243             case TPointerEvent::EButton1Up:
  2244                 if(isItem && iFirstTap == EFalse &&
  2244                 if(isItem &&
  2245                    iView->MenuBar()->IsDisplayed() == EFalse)
  2245                    iView->MenuBar()->IsDisplayed() == EFalse)
  2246                     {
  2246                     {
  2247                     iServices.IssueCommandL( ECalenForwardsToDayView );
  2247                     iServices.IssueCommandL( ECalenForwardsToDayView );
  2248                     }
  2248                     }
  2249                 break;
  2249                 break;
  2265 // ----------------------------------------------------------------------------
  2265 // ----------------------------------------------------------------------------
  2266 //
  2266 //
  2267 void CCalenWeekContainer::HidePopup()
  2267 void CCalenWeekContainer::HidePopup()
  2268     {
  2268     {
  2269     TRACE_ENTRY_POINT;
  2269     TRACE_ENTRY_POINT;
  2270     
  2270     if (iPreview)
  2271     iPreview->Hide();    
  2271         {
  2272     
  2272         iPreview->Hide();
       
  2273         }
  2273     TRACE_EXIT_POINT;
  2274     TRACE_EXIT_POINT;
  2274     }
  2275     }
  2275 
  2276 
  2276 // ----------------------------------------------------------------------------
  2277 // ----------------------------------------------------------------------------
  2277 // CCalenWeekContainer::BeginPopulationWithInstanceViewL
  2278 // CCalenWeekContainer::BeginPopulationWithInstanceViewL
  2283     {
  2284     {
  2284     TRACE_ENTRY_POINT;
  2285     TRACE_ENTRY_POINT;
  2285     SizeChanged();
  2286     SizeChanged();
  2286     iViewPopulationComplete = EFalse;
  2287     iViewPopulationComplete = EFalse;
  2287     
  2288     
  2288     iPreview->Hide();
  2289     if (iPreview)
  2289         
  2290         {
       
  2291         iPreview->Hide();
       
  2292         }
  2290     iListBox->View()->SetDisableRedraw( ETrue );
  2293     iListBox->View()->SetDisableRedraw( ETrue );
  2291     PopulatesDayListsL();
  2294     PopulatesDayListsL();
  2292 
  2295 
  2293     TRACE_EXIT_POINT;
  2296     TRACE_EXIT_POINT;
  2294     }
  2297     }
  2463     
  2466     
  2464 	TRACE_EXIT_POINT;
  2467 	TRACE_EXIT_POINT;
  2465 	
  2468 	
  2466     return row;	
  2469     return row;	
  2467 	}
  2470 	}
       
  2471 	
       
  2472 // -----------------------------------------------------------------------------
       
  2473 // CCalenWeekContainer::PreviewPane
       
  2474 // Return preview pane pointer
       
  2475 // -----------------------------------------------------------------------------
       
  2476 //	
       
  2477 const MCalenPreview* CCalenWeekContainer::PreviewPane()
       
  2478     {
       
  2479     TRACE_ENTRY_POINT
       
  2480     TRACE_EXIT_POINT
       
  2481     return iPreview;
       
  2482     }	
  2468 
  2483 
  2469 // ----------------------------------------------------------------------------
  2484 // ----------------------------------------------------------------------------
  2470 // CCalenWeekContainer::UpdatePreviewPaneL
  2485 // CCalenWeekContainer::UpdatePreviewPaneL
  2471 // Updates preview pane whenever application comes to foreground
  2486 // Updates preview pane whenever application comes to foreground
  2472 // ----------------------------------------------------------------------------    
  2487 // ----------------------------------------------------------------------------    
  2480         
  2495         
  2481         CWeekSlotArrayPtr slotTable = iSlotTable[iColumn];
  2496         CWeekSlotArrayPtr slotTable = iSlotTable[iColumn];
  2482         CCalHourItem& itemInfo = *(*slotTable)[iListBox->CurrentItemIndex()];
  2497         CCalHourItem& itemInfo = *(*slotTable)[iListBox->CurrentItemIndex()];
  2483         
  2498         
  2484         // dont focus the preview popup/previewpane if any dialog or faster app is active
  2499         // dont focus the preview popup/previewpane if any dialog or faster app is active
  2485         if(!iView->IsEditorActiveOrFasterAppExit())
  2500         if( iPreview && !iView->IsEditorActiveOrFasterAppExit())
  2486             {
  2501             {
  2487             if( !itemInfo.IsTimed() )
  2502             if( !itemInfo.IsTimed() )
  2488                 { 
  2503                 { 
  2489                 // Non-timed cell
  2504                 // Non-timed cell
  2490                 iPreview->FocusChangedL(itemInfo.iInstance);
  2505                 iPreview->FocusChangedL(itemInfo.iInstance);