meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrrecurencefield.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 13 8592a65ad3fb
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
    70 //
    70 //
    71 CESMRRecurenceField::CESMRRecurenceField( MESMRFieldValidator* aValidator )
    71 CESMRRecurenceField::CESMRRecurenceField( MESMRFieldValidator* aValidator )
    72     : iIndex( 0 )
    72     : iIndex( 0 )
    73     {
    73     {
    74     FUNC_LOG;
    74     FUNC_LOG;
    75     
    75 
    76     iValidator = aValidator;
    76     iValidator = aValidator;
    77     
    77 
    78     SetFieldId ( EESMRFieldRecurrence );
    78     SetFieldId ( EESMRFieldRecurrence );
    79     SetFocusType( EESMRHighlightFocus );
    79     SetFocusType( EESMRHighlightFocus );
    80     }
    80     }
    81 
    81 
    82 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
    98 //
    98 //
    99 CESMRRecurenceField* CESMRRecurenceField::NewL(
    99 CESMRRecurenceField* CESMRRecurenceField::NewL(
   100         MESMRFieldValidator* aValidator )
   100         MESMRFieldValidator* aValidator )
   101     {
   101     {
   102     FUNC_LOG;
   102     FUNC_LOG;
   103     CESMRRecurenceField* self = 
   103     CESMRRecurenceField* self =
   104         new( ELeave )CESMRRecurenceField( aValidator );
   104         new( ELeave )CESMRRecurenceField( aValidator );
   105     CleanupStack::PushL( self );
   105     CleanupStack::PushL( self );
   106     self->ConstructL();
   106     self->ConstructL();
   107     CleanupStack::Pop( self );
   107     CleanupStack::Pop( self );
   108     return self;
   108     return self;
   116     {
   116     {
   117     FUNC_LOG;
   117     FUNC_LOG;
   118     iRecurrence = CMRLabel::NewL();
   118     iRecurrence = CMRLabel::NewL();
   119     iRecurrence->SetParent( this );
   119     iRecurrence->SetParent( this );
   120     CESMRField::ConstructL( iRecurrence );
   120     CESMRField::ConstructL( iRecurrence );
   121     
   121 
   122     iRecurrence->SetTextL( KNullDesC() );
   122     iRecurrence->SetTextL( KNullDesC() );
   123     
   123 
   124     iFieldIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapRecurrence );
   124     iFieldIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapRecurrence );
   125     iFieldIcon->SetParent( this );
   125     iFieldIcon->SetParent( this );
   126     }
   126     }
   127 
   127 
   128 // ---------------------------------------------------------------------------
   128 // ---------------------------------------------------------------------------
   157                 iIndex = i;
   157                 iIndex = i;
   158                 SetRecurrenceL ( iIndex );
   158                 SetRecurrenceL ( iIndex );
   159                 }
   159                 }
   160             }
   160             }
   161         // resource reader
   161         // resource reader
   162         CleanupStack::PopAndDestroy(); // codescanner::cleanup 
   162         CleanupStack::PopAndDestroy(); // codescanner::cleanup
   163         }
   163         }
   164     else
   164     else
   165         {
   165         {
   166         __ASSERT_DEBUG( iObserver, Panic( EESMRRecurenceFieldNoObserver ) );
   166         __ASSERT_DEBUG( iObserver, Panic( EESMRRecurenceFieldNoObserver ) );
   167         iObserver->HideControl ( iFieldId );
   167         iObserver->HideControl ( iFieldId );
   194     TBool isUsed( EFalse );
   194     TBool isUsed( EFalse );
   195     if (aCommand == EESMRCmdOpenRecurrenceQuery ||
   195     if (aCommand == EESMRCmdOpenRecurrenceQuery ||
   196     	aCommand == EAknCmdOpen )
   196     	aCommand == EAknCmdOpen )
   197         {
   197         {
   198     	HandleTactileFeedbackL();
   198     	HandleTactileFeedbackL();
   199     	
   199 
   200         ExecuteRecurrenceQueryL();
   200         ExecuteRecurrenceQueryL();
   201         isUsed = ETrue;
   201         isUsed = ETrue;
   202         }
   202         }
   203     return isUsed;
   203     return isUsed;
   204     }
   204     }
   208 // ---------------------------------------------------------------------------
   208 // ---------------------------------------------------------------------------
   209 //
   209 //
   210 void CESMRRecurenceField::ExecuteRecurrenceQueryL()
   210 void CESMRRecurenceField::ExecuteRecurrenceQueryL()
   211     {
   211     {
   212     FUNC_LOG;
   212     FUNC_LOG;
   213     TInt ret = CESMRListQuery::ExecuteL( 
   213     TInt ret = CESMRListQuery::ExecuteL(
   214             CESMRListQuery::EESMRRecurrenceQuery );
   214             CESMRListQuery::EESMRRecurrenceQuery );
   215 
   215 
   216     if ( ret != KErrCancel )
   216     if ( ret != KErrCancel )
   217         {
   217         {
   218         SetRecurrenceL( ret );
   218         SetRecurrenceL( ret );
   309 //
   309 //
   310 void CESMRRecurenceField::SizeChanged()
   310 void CESMRRecurenceField::SizeChanged()
   311     {
   311     {
   312     FUNC_LOG;
   312     FUNC_LOG;
   313     TRect rect = Rect();
   313     TRect rect = Rect();
   314     
   314 
   315     TAknLayoutRect rowLayoutRect =
   315     TAknLayoutRect rowLayoutRect =
   316      NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
   316      NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
   317     rect = rowLayoutRect.Rect();
   317     rect = rowLayoutRect.Rect();
   318     
   318 
   319     TAknWindowComponentLayout iconLayout =
   319     TAknWindowComponentLayout iconLayout =
   320      NMRLayoutManager::GetWindowComponentLayout( 
   320      NMRLayoutManager::GetWindowComponentLayout(
   321              NMRLayoutManager::EMRLayoutTextEditorIcon );
   321              NMRLayoutManager::EMRLayoutTextEditorIcon );
   322     AknLayoutUtils::LayoutImage( iFieldIcon, rect, iconLayout );
   322     AknLayoutUtils::LayoutImage( iFieldIcon, rect, iconLayout );
   323     
   323 
   324     TAknLayoutRect bgLayoutRect =
   324     TAknLayoutRect bgLayoutRect =
   325      NMRLayoutManager::GetLayoutRect( 
   325      NMRLayoutManager::GetLayoutRect(
   326              rect, NMRLayoutManager::EMRLayoutTextEditorBg );
   326              rect, NMRLayoutManager::EMRLayoutTextEditorBg );
   327     TRect bgRect( bgLayoutRect.Rect() );
   327     TRect bgRect( bgLayoutRect.Rect() );
   328     // Move focus rect so that it's relative to field's position.
   328     // Move focus rect so that it's relative to field's position.
   329     bgRect.Move( -Position() );
   329     bgRect.Move( -Position() );
   330     SetFocusRect( bgRect );
   330     SetFocusRect( bgRect );
   331     
   331 
   332     TAknLayoutText labelLayout = 
   332     TAknTextComponentLayout editorLayout =
   333      NMRLayoutManager::GetLayoutText( 
   333             NMRLayoutManager::GetTextComponentLayout(
   334              rect, NMRLayoutManager::EMRTextLayoutTextEditor );
   334                     NMRLayoutManager::EMRTextLayoutTextEditor );
   335     iRecurrence->SetRect( labelLayout.TextRect() );
   335 
   336     
   336     AknLayoutUtils::LayoutLabel( iRecurrence, rect, editorLayout );
   337     // Setting font also for the field
       
   338     iRecurrence->SetFont( labelLayout.Font() );
       
   339     }
   337     }
   340 
   338 
   341 // ---------------------------------------------------------------------------
   339 // ---------------------------------------------------------------------------
   342 // CESMRRecurenceField::CountComponentControls
   340 // CESMRRecurenceField::CountComponentControls
   343 // ---------------------------------------------------------------------------
   341 // ---------------------------------------------------------------------------
   377 
   375 
   378 // ---------------------------------------------------------------------------
   376 // ---------------------------------------------------------------------------
   379 // CESMRRecurenceField::SetContainerWindowL
   377 // CESMRRecurenceField::SetContainerWindowL
   380 // ---------------------------------------------------------------------------
   378 // ---------------------------------------------------------------------------
   381 //
   379 //
   382 void CESMRRecurenceField::SetContainerWindowL( 
   380 void CESMRRecurenceField::SetContainerWindowL(
   383         const CCoeControl& aContainer )
   381         const CCoeControl& aContainer )
   384     {
   382     {
   385     CCoeControl::SetContainerWindowL( aContainer );
   383     CCoeControl::SetContainerWindowL( aContainer );
   386     iRecurrence->SetContainerWindowL( aContainer );
   384     iRecurrence->SetContainerWindowL( aContainer );
   387     
   385 
   388     iRecurrence->SetParent( this );
   386     iRecurrence->SetParent( this );
   389     }
   387     }
   390 
   388 
   391 // EOF
   389 // EOF