calendarui/views/src/calenweekcontainer.cpp
branchRCL_3
changeset 10 38571fd2a704
parent 0 f979ecb2b13e
child 15 9711e452b5e9
--- a/calendarui/views/src/calenweekcontainer.cpp	Fri Feb 19 22:49:53 2010 +0200
+++ b/calendarui/views/src/calenweekcontainer.cpp	Fri Mar 12 15:42:35 2010 +0200
@@ -211,11 +211,7 @@
     TRACE_ENTRY_POINT;
 
     delete iListBox;
-    if( iNativePreview && iPreview )
-        {
-        delete iPreview;
-        iPreview = NULL;
-        }
+    
     delete iDesArray;
 
     CleanupInstances();
@@ -1242,11 +1238,7 @@
     // Create preview pane
     TRect aRect = PreviewRectL();
     iPreview = iServices.CustomPreviewPaneL(aRect);
-    if (iPreview == NULL) 
-		{
-		iPreview = CCalenPreview::NewL( iView, locale, iServices );
-		iNativePreview = ETrue;
-		}    
+    
     // ownership of builder transferred
 
     // 3) Listbox
@@ -1361,7 +1353,7 @@
                                             AknLayoutScalable_Apps::listscroll_cale_week_pane(layoutToolBarVariant).LayoutLine() );
                                             
 
-    TWeekListBoxLayout lay( UseInfobar(), UseToolbar(), ETrue, main_pane );
+    TWeekListBoxLayout lay( UseInfobar(), UseToolbar(), UsePreview(), main_pane ); 
 
     iListBox->SetRect( iListBox->LayoutRect() );
     TInt layoutVariant = lay.LayoutVariantIndex(TWeekListBoxLayout::EScrollPaneCp08);
@@ -1545,7 +1537,7 @@
     TRACE_ENTRY_POINT;
 
     // always hide popup on key events
-    if (aType == EEventKeyDown)
+    if (iPreview && aType == EEventKeyDown)
         {
         iPreview->Hide();
         }
@@ -1766,7 +1758,7 @@
         CCalHourItem& itemInfo = *(*slotTable)[iListBox->CurrentItemIndex()];
         
         // dont focus the preview popup/previewpane if any dialog or faster app is active        
-		if(!iView->IsEditorActiveOrFasterAppExit())
+		if(iPreview && !iView->IsEditorActiveOrFasterAppExit())
 			{
 	        if( !itemInfo.IsTimed() )
 	            { 
@@ -2182,6 +2174,18 @@
             aPointerEvent.iType == TPointerEvent::EButton1Down )
             {
             IgnoreEventsUntilNextPointerUp();
+            CCoeControl* control(NULL);
+            if (aPointerEvent.iType == TPointerEvent::EButton1Down)
+                {
+                control = iLayoutManager->ControlOrNull();
+                if (control)
+                    {
+                    if (control->Rect().Contains(aPointerEvent.iPosition))
+                        {
+                        control->HandlePointerEventL(aPointerEvent);
+                        }
+                    }
+                }
             return;
             }
         
@@ -2204,10 +2208,7 @@
                             {
                             UpdateStatusPaneAndExtensionsL();
                             }
-                        iFirstTap = ETrue;
                         }
-                    else
-                        iFirstTap = EFalse;
                     }
                 else
                     {
@@ -2235,13 +2236,12 @@
                     if (newColumn != oldColumn)
                         {
                         WeekView().SetStatusPaneFromActiveContextL();
-                        }
-                    iFirstTap = ETrue;
+                        }                    
                     }
                 break;
                 }
             case TPointerEvent::EButton1Up:
-                if(isItem && iFirstTap == EFalse &&
+                if(isItem &&
                    iView->MenuBar()->IsDisplayed() == EFalse)
                     {
                     iServices.IssueCommandL( ECalenForwardsToDayView );
@@ -2267,9 +2267,10 @@
 void CCalenWeekContainer::HidePopup()
     {
     TRACE_ENTRY_POINT;
-    
-    iPreview->Hide();    
-    
+    if (iPreview)
+        {
+        iPreview->Hide();
+        }
     TRACE_EXIT_POINT;
     }
 
@@ -2285,8 +2286,10 @@
     SizeChanged();
     iViewPopulationComplete = EFalse;
     
-    iPreview->Hide();
-        
+    if (iPreview)
+        {
+        iPreview->Hide();
+        }
     iListBox->View()->SetDisableRedraw( ETrue );
     PopulatesDayListsL();
 
@@ -2465,6 +2468,18 @@
 	
     return row;	
 	}
+	
+// -----------------------------------------------------------------------------
+// CCalenWeekContainer::PreviewPane
+// Return preview pane pointer
+// -----------------------------------------------------------------------------
+//	
+const MCalenPreview* CCalenWeekContainer::PreviewPane()
+    {
+    TRACE_ENTRY_POINT
+    TRACE_EXIT_POINT
+    return iPreview;
+    }	
 
 // ----------------------------------------------------------------------------
 // CCalenWeekContainer::UpdatePreviewPaneL
@@ -2482,7 +2497,7 @@
         CCalHourItem& itemInfo = *(*slotTable)[iListBox->CurrentItemIndex()];
         
         // dont focus the preview popup/previewpane if any dialog or faster app is active
-        if(!iView->IsEditorActiveOrFasterAppExit())
+        if( iPreview && !iView->IsEditorActiveOrFasterAppExit())
             {
             if( !itemInfo.IsTimed() )
                 {