calendarui/views/src/calenmissedalarmscontainer.cpp
branchRCL_3
changeset 23 51372538e3d3
parent 18 d68a4b5d5885
child 28 96907930389d
--- a/calendarui/views/src/calenmissedalarmscontainer.cpp	Sun Jun 20 22:50:42 2010 +0200
+++ b/calendarui/views/src/calenmissedalarmscontainer.cpp	Sun Jun 20 22:55:39 2010 +0200
@@ -139,12 +139,12 @@
     iListBox->CreateScrollBarFrameL(ETrue);
     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
             CEikScrollBarFrame::EAuto);
-
+    iListBox->SetListBoxObserver( this ); // single click changes MK
     // set the model array
     iListBox->Model()->SetItemTextArray(iListBoxItemArray);
 
     // set icon array
-    CAknIconArray* iconArray = CreateIconsL( iIconIndices );
+    CAknIconArray* iconArray = CreateIconsL( iIconIndices, KCalenMissedAlarmsViewUidValue ); 
     CleanupStack::PushL(iconArray);
     iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(iconArray);
     CleanupStack::Pop();
@@ -401,7 +401,17 @@
 
     if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch )
         {
-        SizeChanged();
+//        SizeChanged();
+    TRect main_pane;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, main_pane );
+    SetRect( main_pane );
+    if(iListBox)
+        {
+        TRect mainPane;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
+        TRect bgContextRect( TPoint(0, 0), mainPane.Size() );
+        iListBox->SetRect( bgContextRect );
+        }
 
         // refresh
         TRAPD(error,iView->BeginRepopulationL());
@@ -461,38 +471,31 @@
         {
         case TPointerEvent::EButton1Down:
             {
-            TInt oldCursor = iListBox->View()->CurrentItemIndex();
-            iListBox->HandlePointerEventL(aPointerEvent);
-            TInt newCursor = iListBox->View()->CurrentItemIndex();
-
-            if (oldCursor != newCursor)
+            TBool isItem (iListBox->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex));
+            
+            if(isItem && MissedAlarmsCount() > 0)
                 {
-                // set the context
-                iHighlightedRowNumber = newCursor;
-                SetContextFromMissedAlarmEntryL(newCursor);
-                iFirstTap = EFalse;
+                iHighlightedRowNumber = iListBox->View()->CurrentItemIndex(); 
+                SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
                 }
-            else
-                {
-                iFirstTap = ETrue;
-                }
+            
             break;
             }
         case TPointerEvent::EDrag:
             {
-            iListBox->HandlePointerEventL(aPointerEvent);
+            /*iListBox->HandlePointerEventL(aPointerEvent);
             if (iFirstTap && index != iListBox->CurrentItemIndex())
                 {
                 iFirstTap = EFalse;
-                }
+                }*/
             break;
             }
 
         case TPointerEvent::EButton1Up:
             {
-            if (iFirstTap)
+           // if (iFirstTap)
                 {
-                iView->HandleCommandL(ECalenMissedEventView);
+               // iView->HandleCommandL(ECalenMissedEventView);
                 }
             break;
             }
@@ -500,6 +503,11 @@
             break;
         }
 
+   if ( aPointerEvent.iType != TPointerEvent::EButtonRepeat )
+        {
+        iListBox->HandlePointerEventL( aPointerEvent );
+        }
+  
     TRACE_EXIT_POINT;
     }
 
@@ -909,7 +917,9 @@
     TCalenInstanceId missedAlarm = iMissedAlarmsArray[aIndex];
             
     CCalEntry* entry = iServices.EntryViewL(missedAlarm.iColId)->FetchL( missedAlarm.iEntryLocalUid );
-    User::LeaveIfNull( entry );
+    //User::LeaveIfNull( entry );
+    if (entry)
+    	{
     CleanupStack::PushL( entry );
     
     TTime instanceTime;
@@ -925,6 +935,7 @@
     context.SetInstanceIdL( id, context.ViewId() ); 
     
     CleanupStack::PopAndDestroy( entry );
+    }
     
     TRACE_EXIT_POINT;
     }
@@ -952,4 +963,43 @@
     return KErrNotFound;
     }
 
+
+void CCalenMissedAlarmsContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, 
+                                                      TListBoxEvent aEventType)
+    {
+    TRACE_ENTRY_POINT;
+    switch( aEventType )
+        {
+        // Single click integration
+        case EEventItemSingleClicked:
+            {
+             iHighlightedRowNumber = iListBox->View()->CurrentItemIndex();
+            
+              SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
+            //Handle listbox item selection event
+           // iListBox->HandlePointerEventL(aPointerEvent);
+            if(iView->MenuBar()->IsDisplayed() == EFalse)
+                {
+                iView->HandleCommandL( ECalenMissedEventView );
+                }
+            break;
+            }
+            
+        // Single click integration
+        case EEventEnterKeyPressed:
+            {
+            iHighlightedRowNumber = iListBox->View()->CurrentItemIndex();
+            
+              SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
+            iView->HandleCommandL( ECalenMissedEventView );
+            break;
+            }
+        default:
+            break;
+        };
+    TRACE_EXIT_POINT;
+    }
+
+
+
 // End of File