calendarui/views/src/calendaycontainer.cpp
branchRCL_3
changeset 48 bf573002ff72
parent 36 9c5b1510919f
child 59 aba12c885d83
equal deleted inserted replaced
36:9c5b1510919f 48:bf573002ff72
    14 * Description:  For Day view container of calendar application.
    14 * Description:  For Day view container of calendar application.
    15  *                The class derived from CCalenContainer
    15  *                The class derived from CCalenContainer
    16  *
    16  *
    17 */
    17 */
    18 
    18 
    19 
    19 #include <Calendar.rsg>
    20 //debug
       
    21 #include "calendarui_debug.h"
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include "calendaycontainer.h"
       
    25 #include "calencontainerlayoutmanager.h"
       
    26 #include "calencontroller.h"
       
    27 
       
    28 #include <calenconstants.h>
    20 #include <calenconstants.h>
    29 #include <calendateutils.h>
    21 #include <calendateutils.h>
    30 #include "calendaylistboxmodel.h"
       
    31 #include "calendaylistboxview.h"
       
    32 #include "calendaylistbox.h"
       
    33 #include "calendayview.h"
       
    34 #include "CalenUid.h"
       
    35 #include <calenagendautils.h>
    22 #include <calenagendautils.h>
    36 #include <calenservices.h>
    23 #include <calenservices.h>
    37 #include "calenlocationutil.h"
       
    38 
       
    39 #include "calendar.hrh"
       
    40 #include <Calendar.rsg>
       
    41 #include <csxhelp/cale.hlp.hrh>
    24 #include <csxhelp/cale.hlp.hrh>
    42 
       
    43 #include <AknsDrawUtils.h>
    25 #include <AknsDrawUtils.h>
    44 #include <AknsFrameBackgroundControlContext.h>
    26 #include <AknsFrameBackgroundControlContext.h>
    45 #include <AknUtils.h>
    27 #include <AknUtils.h>
    46 #include <AknIconArray.h>
    28 #include <AknIconArray.h>
    47 #include <eikfrlbd.h>
    29 #include <eikfrlbd.h>
    48 #include <eiklabel.h>
    30 #include <eiklabel.h>
    49 #include <eikmenub.h>
    31 #include <eikmenub.h>
    50 #include <StringLoader.h>
    32 #include <StringLoader.h>
    51 #include <calenviewutils.h>
    33 #include <calenviewutils.h>
    52 #include <aknlayoutscalable_apps.cdl.h>
    34 #include <aknlayoutscalable_apps.cdl.h>
    53 
       
    54 #include <calinstance.h>
    35 #include <calinstance.h>
    55 #include <calentry.h>
    36 #include <calentry.h>
    56 #include <calinstanceview.h>
    37 #include <calinstanceview.h>
    57 #include <caltime.h>
    38 #include <caltime.h>
    58 
       
    59 #include <AknDef.h>
    39 #include <AknDef.h>
    60 #include <calencontext.h>
    40 #include <calencontext.h>
    61 #include <akntoolbar.h>
    41 #include <akntoolbar.h>
    62 #include <aknstyluspopupmenu.h>
    42 #include <aknstyluspopupmenu.h>
    63 #include <barsread.h>
    43 #include <barsread.h>
       
    44 #include <gesturehelper.h> //CGestureHelper
       
    45 
       
    46 // INCLUDE FILES
       
    47 #include "calendaycontainer.h"
       
    48 #include "calencontainerlayoutmanager.h"
       
    49 #include "calencontroller.h"
       
    50 #include "calenlocationutil.h"
       
    51 #include "calendaylistboxmodel.h"
       
    52 #include "calendaylistboxview.h"
       
    53 #include "calendaylistbox.h"
       
    54 #include "calendayview.h"
       
    55 #include "CalenUid.h"
       
    56 #include "calendar.hrh"
       
    57 //debug
       
    58 #include "calendarui_debug.h"
    64 
    59 
    65 //  LOCAL CONSTANTS AND MACROS
    60 //  LOCAL CONSTANTS AND MACROS
    66 const TInt KLayoutTableGranularity(10);
    61 const TInt KLayoutTableGranularity(10);
    67 const TInt KNullMinutes = -1;
    62 const TInt KNullMinutes = -1;
    68 
    63 
   103     delete iListBox;
    98     delete iListBox;
   104     iInstanceList.ResetAndDestroy();
    99     iInstanceList.ResetAndDestroy();
   105     delete iLayoutTable;
   100     delete iLayoutTable;
   106     // Skin contexts
   101     // Skin contexts
   107     delete iBackgroundSkinContext;
   102     delete iBackgroundSkinContext;
       
   103     delete iGestureHelper;
   108 
   104 
   109     TRACE_EXIT_POINT;
   105     TRACE_EXIT_POINT;
   110     }
   106     }
   111 	
   107 	
   112 // ---------------------------------------------------------
   108 // ---------------------------------------------------------
   121     switch( aEventType )
   117     switch( aEventType )
   122         {
   118         {
   123         // Single click integration
   119         // Single click integration
   124         case EEventItemSingleClicked:
   120         case EEventItemSingleClicked:
   125             {
   121             {
   126             //Handle listbox item selection event
   122             // left/right gestures (touch down, drag, touch release) are treated
   127             //iListBox->HandlePointerEventL(aPointerEvent);
   123              // by CEikListBox as single click, probably this should be fixed by AVKON team
   128             if(iView->MenuBar()->IsDisplayed() == EFalse)
   124              if ( !iGestureHandled )
       
   125                  {
       
   126                  if(iView->MenuBar()->IsDisplayed() == EFalse)
       
   127                      {
       
   128                      iView->HandleCommandL( ECalenViewCurrentEntry );
       
   129                      }
       
   130                  }
       
   131             break;
       
   132             }
       
   133         case EEventEmptyListClicked:
       
   134             {
       
   135             // left/right gestures (touch down, drag, touch release) are treated
       
   136             // by CEikListBox as single click, probably this should be fixed by AVKON team
       
   137             if ( !iGestureHandled )
   129                 {
   138                 {
   130                 iView->HandleCommandL( ECalenViewCurrentEntry );
   139                 if (iListBox->Model()->NumberOfItems() <= 0)
       
   140                     {
       
   141                     iView->HandleCommandL(ECalenCmdOpenMskDialog);
       
   142                     }
   131                 }
   143                 }
   132             break;
   144             break;
       
   145             }
       
   146             
       
   147         case EEventEmptyAreaClicked:
       
   148             {
       
   149             // left/right gestures (touch down, drag, touch release) are treated
       
   150             // by CEikListBox as single click, probably this should be fixed by AVKON team
       
   151 			break;
   133             }
   152             }
   134 			
   153 			
   135         // Single click integration
   154         // Single click integration
   136         case EEventEnterKeyPressed:
   155         case EEventEnterKeyPressed:
   137             {
   156             {
  1226     model->SetOwnershipType(ELbmDoesNotOwnItemArray);
  1245     model->SetOwnershipType(ELbmDoesNotOwnItemArray);
  1227     
  1246     
  1228     CAknIconArray* iconList = CreateIconsL( iIconIndices );
  1247     CAknIconArray* iconList = CreateIconsL( iIconIndices );
  1229     iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
  1248     iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconList );
  1230     
  1249     
       
  1250     iGestureHelper = GestureHelper::CGestureHelper::NewL( *this );
       
  1251     iGestureHelper->SetHoldingEnabled( EFalse );
       
  1252     iGestureHelper->SetDoubleTapEnabled( EFalse );
       
  1253     
  1231     TRACE_EXIT_POINT;
  1254     TRACE_EXIT_POINT;
  1232     }
  1255     }
  1233 
  1256 
  1234 // ----------------------------------------------------------------------------
  1257 // ----------------------------------------------------------------------------
  1235 // CCalenDayContainer::NotifyDeleteItemL
  1258 // CCalenDayContainer::NotifyDeleteItemL
  1448                 {
  1471                 {
  1449                 control->HandlePointerEventL(aPointerEvent);	
  1472                 control->HandlePointerEventL(aPointerEvent);	
  1450                 return;
  1473                 return;
  1451                 }
  1474                 }
  1452             }
  1475             }
  1453         if (iListBox->Model()->NumberOfItems() <= 0)
  1476         }
  1454             {
  1477 		if(iGestureHelper)
  1455             iView->HandleCommandL(ECalenCmdOpenMskDialog);
  1478         {
       
  1479         iGestureHelper->HandlePointerEventL( aPointerEvent );
       
  1480         if (  iGestureHandled )
       
  1481             {
       
  1482             TRACE_EXIT_POINT;
  1456             return;
  1483             return;
  1457             }
  1484             }
  1458         }
  1485         }
       
  1486 	        	
  1459 	        	
  1487 	        	
  1460     TInt pointerIndex(-1);    
  1488     TInt pointerIndex(-1);    
  1461      // Single click integration
  1489      // Single click integration
  1462     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
  1490     if ( aPointerEvent.iType == TPointerEvent::EButton1Down
  1463             && iListBox->View()->XYPosToItemIndex(
  1491             && iListBox->View()->XYPosToItemIndex(
  1477         }
  1505         }
  1478 
  1506 
  1479     TRACE_EXIT_POINT;
  1507     TRACE_EXIT_POINT;
  1480     }
  1508     }
  1481 
  1509 
       
  1510 // ---------------------------------------------------------------------------
       
  1511 // CCalenDayContainer::HandleGestureL
       
  1512 // Handle the gesture event
       
  1513 // ---------------------------------------------------------------------------
       
  1514 //
       
  1515 void CCalenDayContainer::HandleGestureL( const GestureHelper::MGestureEvent& aEvent )
       
  1516     {
       
  1517     TRACE_ENTRY_POINT;
       
  1518     GestureHelper::TGestureCode code = aEvent.Code( GestureHelper::MGestureEvent::EAxisBoth );
       
  1519     
       
  1520     switch ( code )
       
  1521         {
       
  1522         case GestureHelper::EGestureStart:
       
  1523             {
       
  1524             iGestureHandled = EFalse;
       
  1525             break;
       
  1526             }
       
  1527         case GestureHelper::EGestureSwipeRight:
       
  1528             {
       
  1529             HandleNaviDecoratorEventL( EAknNaviDecoratorEventLeftTabArrow );
       
  1530             iGestureHandled = ETrue;
       
  1531             break;
       
  1532             }
       
  1533         case GestureHelper::EGestureSwipeLeft:
       
  1534             {
       
  1535             HandleNaviDecoratorEventL( EAknNaviDecoratorEventRightTabArrow );
       
  1536             iGestureHandled = ETrue;
       
  1537             break;
       
  1538             }
       
  1539         default:
       
  1540             // Other gestures are not handled here
       
  1541             break;
       
  1542         }
       
  1543     
       
  1544     TRACE_EXIT_POINT;
       
  1545     }
  1482 // ----------------------------------------------------------------------------
  1546 // ----------------------------------------------------------------------------
  1483 // CCalenDayContainer::HandleNaviDecoratorEventL
  1547 // CCalenDayContainer::HandleNaviDecoratorEventL
  1484 // ?implementation_description
  1548 // ?implementation_description
  1485 // (other items were commented in a header).
  1549 // (other items were commented in a header).
  1486 // ----------------------------------------------------------------------------
  1550 // ----------------------------------------------------------------------------