calendarui/views/src/calenmissedalarmscontainer.cpp
branchRCL_3
changeset 23 51372538e3d3
parent 18 d68a4b5d5885
child 28 96907930389d
equal deleted inserted replaced
22:07e82e2b738b 23:51372538e3d3
   137     
   137     
   138     // Create scroll bar
   138     // Create scroll bar
   139     iListBox->CreateScrollBarFrameL(ETrue);
   139     iListBox->CreateScrollBarFrameL(ETrue);
   140     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
   140     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
   141             CEikScrollBarFrame::EAuto);
   141             CEikScrollBarFrame::EAuto);
   142 
   142     iListBox->SetListBoxObserver( this ); // single click changes MK
   143     // set the model array
   143     // set the model array
   144     iListBox->Model()->SetItemTextArray(iListBoxItemArray);
   144     iListBox->Model()->SetItemTextArray(iListBoxItemArray);
   145 
   145 
   146     // set icon array
   146     // set icon array
   147     CAknIconArray* iconArray = CreateIconsL( iIconIndices );
   147     CAknIconArray* iconArray = CreateIconsL( iIconIndices, KCalenMissedAlarmsViewUidValue ); 
   148     CleanupStack::PushL(iconArray);
   148     CleanupStack::PushL(iconArray);
   149     iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(iconArray);
   149     iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(iconArray);
   150     CleanupStack::Pop();
   150     CleanupStack::Pop();
   151 
   151 
   152     iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
   152     iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
   399     
   399     
   400     CCalenContainer::HandleResourceChange( aType );
   400     CCalenContainer::HandleResourceChange( aType );
   401 
   401 
   402     if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch )
   402     if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch )
   403         {
   403         {
   404         SizeChanged();
   404 //        SizeChanged();
       
   405     TRect main_pane;
       
   406     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, main_pane );
       
   407     SetRect( main_pane );
       
   408     if(iListBox)
       
   409         {
       
   410         TRect mainPane;
       
   411         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
       
   412         TRect bgContextRect( TPoint(0, 0), mainPane.Size() );
       
   413         iListBox->SetRect( bgContextRect );
       
   414         }
   405 
   415 
   406         // refresh
   416         // refresh
   407         TRAPD(error,iView->BeginRepopulationL());
   417         TRAPD(error,iView->BeginRepopulationL());
   408         if(error!=KErrNone)
   418         if(error!=KErrNone)
   409             {
   419             {
   459 
   469 
   460     switch (aPointerEvent.iType)
   470     switch (aPointerEvent.iType)
   461         {
   471         {
   462         case TPointerEvent::EButton1Down:
   472         case TPointerEvent::EButton1Down:
   463             {
   473             {
   464             TInt oldCursor = iListBox->View()->CurrentItemIndex();
   474             TBool isItem (iListBox->View()->XYPosToItemIndex(aPointerEvent.iPosition, pointerIndex));
   465             iListBox->HandlePointerEventL(aPointerEvent);
   475             
   466             TInt newCursor = iListBox->View()->CurrentItemIndex();
   476             if(isItem && MissedAlarmsCount() > 0)
   467 
       
   468             if (oldCursor != newCursor)
       
   469                 {
   477                 {
   470                 // set the context
   478                 iHighlightedRowNumber = iListBox->View()->CurrentItemIndex(); 
   471                 iHighlightedRowNumber = newCursor;
   479                 SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
   472                 SetContextFromMissedAlarmEntryL(newCursor);
       
   473                 iFirstTap = EFalse;
       
   474                 }
   480                 }
   475             else
   481             
   476                 {
       
   477                 iFirstTap = ETrue;
       
   478                 }
       
   479             break;
   482             break;
   480             }
   483             }
   481         case TPointerEvent::EDrag:
   484         case TPointerEvent::EDrag:
   482             {
   485             {
   483             iListBox->HandlePointerEventL(aPointerEvent);
   486             /*iListBox->HandlePointerEventL(aPointerEvent);
   484             if (iFirstTap && index != iListBox->CurrentItemIndex())
   487             if (iFirstTap && index != iListBox->CurrentItemIndex())
   485                 {
   488                 {
   486                 iFirstTap = EFalse;
   489                 iFirstTap = EFalse;
       
   490                 }*/
       
   491             break;
       
   492             }
       
   493 
       
   494         case TPointerEvent::EButton1Up:
       
   495             {
       
   496            // if (iFirstTap)
       
   497                 {
       
   498                // iView->HandleCommandL(ECalenMissedEventView);
   487                 }
   499                 }
   488             break;
   500             break;
   489             }
   501             }
   490 
       
   491         case TPointerEvent::EButton1Up:
       
   492             {
       
   493             if (iFirstTap)
       
   494                 {
       
   495                 iView->HandleCommandL(ECalenMissedEventView);
       
   496                 }
       
   497             break;
       
   498             }
       
   499         default:
   502         default:
   500             break;
   503             break;
   501         }
   504         }
   502 
   505 
       
   506    if ( aPointerEvent.iType != TPointerEvent::EButtonRepeat )
       
   507         {
       
   508         iListBox->HandlePointerEventL( aPointerEvent );
       
   509         }
       
   510   
   503     TRACE_EXIT_POINT;
   511     TRACE_EXIT_POINT;
   504     }
   512     }
   505 
   513 
   506 // ----------------------------------------------------------------------------
   514 // ----------------------------------------------------------------------------
   507 // CCalenMissedAlarmsContainer::HandleNaviDecoratorEventL
   515 // CCalenMissedAlarmsContainer::HandleNaviDecoratorEventL
   907     TRACE_ENTRY_POINT;
   915     TRACE_ENTRY_POINT;
   908     
   916     
   909     TCalenInstanceId missedAlarm = iMissedAlarmsArray[aIndex];
   917     TCalenInstanceId missedAlarm = iMissedAlarmsArray[aIndex];
   910             
   918             
   911     CCalEntry* entry = iServices.EntryViewL(missedAlarm.iColId)->FetchL( missedAlarm.iEntryLocalUid );
   919     CCalEntry* entry = iServices.EntryViewL(missedAlarm.iColId)->FetchL( missedAlarm.iEntryLocalUid );
   912     User::LeaveIfNull( entry );
   920     //User::LeaveIfNull( entry );
       
   921     if (entry)
       
   922     	{
   913     CleanupStack::PushL( entry );
   923     CleanupStack::PushL( entry );
   914     
   924     
   915     TTime instanceTime;
   925     TTime instanceTime;
   916     TCalTime inscaltime;
   926     TCalTime inscaltime;
   917     
   927     
   923     TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime );
   933     TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime );
   924     id.iColId = missedAlarm.iColId;
   934     id.iColId = missedAlarm.iColId;
   925     context.SetInstanceIdL( id, context.ViewId() ); 
   935     context.SetInstanceIdL( id, context.ViewId() ); 
   926     
   936     
   927     CleanupStack::PopAndDestroy( entry );
   937     CleanupStack::PopAndDestroy( entry );
       
   938     }
   928     
   939     
   929     TRACE_EXIT_POINT;
   940     TRACE_EXIT_POINT;
   930     }
   941     }
   931 
   942 
   932 // -----------------------------------------------------------------------------
   943 // -----------------------------------------------------------------------------
   950 
   961 
   951     TRACE_EXIT_POINT;
   962     TRACE_EXIT_POINT;
   952     return KErrNotFound;
   963     return KErrNotFound;
   953     }
   964     }
   954 
   965 
       
   966 
       
   967 void CCalenMissedAlarmsContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, 
       
   968                                                       TListBoxEvent aEventType)
       
   969     {
       
   970     TRACE_ENTRY_POINT;
       
   971     switch( aEventType )
       
   972         {
       
   973         // Single click integration
       
   974         case EEventItemSingleClicked:
       
   975             {
       
   976              iHighlightedRowNumber = iListBox->View()->CurrentItemIndex();
       
   977             
       
   978               SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
       
   979             //Handle listbox item selection event
       
   980            // iListBox->HandlePointerEventL(aPointerEvent);
       
   981             if(iView->MenuBar()->IsDisplayed() == EFalse)
       
   982                 {
       
   983                 iView->HandleCommandL( ECalenMissedEventView );
       
   984                 }
       
   985             break;
       
   986             }
       
   987             
       
   988         // Single click integration
       
   989         case EEventEnterKeyPressed:
       
   990             {
       
   991             iHighlightedRowNumber = iListBox->View()->CurrentItemIndex();
       
   992             
       
   993               SetContextFromMissedAlarmEntryL(iListBox->View()->CurrentItemIndex());
       
   994             iView->HandleCommandL( ECalenMissedEventView );
       
   995             break;
       
   996             }
       
   997         default:
       
   998             break;
       
   999         };
       
  1000     TRACE_EXIT_POINT;
       
  1001     }
       
  1002 
       
  1003 
       
  1004 
   955 // End of File
  1005 // End of File