meetingrequest/mrgui/mrfieldbuilderplugin/src/cmralarmonofffield.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 16 b5fbb9b25d57
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
    48 
    48 
    49 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    50 // CMRAlarmOnOffField::CMRAlarmOnOffField
    50 // CMRAlarmOnOffField::CMRAlarmOnOffField
    51 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    52 //
    52 //
    53 CMRAlarmOnOffField::CMRAlarmOnOffField() 
    53 CMRAlarmOnOffField::CMRAlarmOnOffField()
    54     {
    54     {
    55     FUNC_LOG;
    55     FUNC_LOG;
    56     iStatus = ETrue;
    56     iStatus = ETrue;
    57     
    57 
    58     SetFieldId ( EESMRFieldAlarmOnOff );
    58     SetFieldId ( EESMRFieldAlarmOnOff );
    59     SetFocusType ( EESMRHighlightFocus );
    59     SetFocusType ( EESMRHighlightFocus );
    60     }
    60     }
    61 
    61 
    62 // ---------------------------------------------------------------------------
    62 // ---------------------------------------------------------------------------
    66 void CMRAlarmOnOffField::ConstructL( MESMRFieldValidator* aValidator )
    66 void CMRAlarmOnOffField::ConstructL( MESMRFieldValidator* aValidator )
    67     {
    67     {
    68     FUNC_LOG;
    68     FUNC_LOG;
    69     iValidator = aValidator;
    69     iValidator = aValidator;
    70     iValidator->SetAbsoluteAlarmOnOffFieldL( *this );
    70     iValidator->SetAbsoluteAlarmOnOffFieldL( *this );
    71         
    71 
    72     iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapAlarm );
    72     iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapAlarm );
    73     iIcon->SetParent( this );
    73     iIcon->SetParent( this );
    74     
    74 
    75     iLabel = CMRLabel::NewL();
    75     iLabel = CMRLabel::NewL();
    76     CESMRField::ConstructL( iLabel ); // ownership transfered
    76     CESMRField::ConstructL( iLabel ); // ownership transfered
    77     iLabel->SetTextL( KNullDesC() );
    77     iLabel->SetTextL( KNullDesC() );
    78     iLabel->SetParent( this );
    78     iLabel->SetParent( this );
    79     }
    79     }
   138             case MESMRCalEntry::EESMRCalEntryMeeting: // Meeting
   138             case MESMRCalEntry::EESMRCalEntryMeeting: // Meeting
   139                 {
   139                 {
   140                 iStatus = ETrue;// Change the status to "ON" for these dialog default
   140                 iStatus = ETrue;// Change the status to "ON" for these dialog default
   141                 }
   141                 }
   142                 break;
   142                 break;
   143                 
   143 
   144             case MESMRCalEntry::EESMRCalEntryAnniversary: // Anniversary    
   144             case MESMRCalEntry::EESMRCalEntryAnniversary: // Anniversary
   145                 {
   145                 {
   146                 iStatus = ETrue;// Change the status to "ON" for these dialog default
   146                 iStatus = ETrue;// Change the status to "ON" for these dialog default
   147                 }
   147                 }
   148                 break;
   148                 break;
   149                 // Flow through
   149                 // Flow through
   150             case MESMRCalEntry::EESMRCalEntryMemo: // Memo
   150             case MESMRCalEntry::EESMRCalEntryMemo: // Memo
   151             case MESMRCalEntry::EESMRCalEntryReminder: // Reminder
   151             case MESMRCalEntry::EESMRCalEntryReminder: // Reminder
   152             
   152 
   153             default:
   153             default:
   154                 iStatus = EFalse; // Change the status to "OFF" for these dialog default
   154                 iStatus = EFalse; // Change the status to "OFF" for these dialog default
   155                 break;
   155                 break;
   156             }
   156             }
   157         }
   157         }
   196     {
   196     {
   197     FUNC_LOG;
   197     FUNC_LOG;
   198     CESMRField::SetOutlineFocusL( aFocus );
   198     CESMRField::SetOutlineFocusL( aFocus );
   199 
   199 
   200     iLabel->SetFocus( aFocus );
   200     iLabel->SetFocus( aFocus );
   201     
   201 
   202     if( aFocus ) //Focus is gained on the field
   202     if( aFocus ) //Focus is gained on the field
   203         {
   203         {
   204         if ( iStatus )
   204         if ( iStatus )
   205             {
   205             {
   206             ChangeMiddleSoftKeyL( EESMRCmdAlarmOff,R_QTN_MEET_REQ_ALARM_OFF ); //R_TEXT_SOFTKEY_OFF
   206             ChangeMiddleSoftKeyL( EESMRCmdAlarmOff,R_QTN_MEET_REQ_ALARM_OFF ); //R_TEXT_SOFTKEY_OFF
   233 TBool CMRAlarmOnOffField::ExecuteGenericCommandL( TInt aCommand )
   233 TBool CMRAlarmOnOffField::ExecuteGenericCommandL( TInt aCommand )
   234     {
   234     {
   235     FUNC_LOG;
   235     FUNC_LOG;
   236     TBool isUsed( EFalse );
   236     TBool isUsed( EFalse );
   237     // EAknCmdOpen is added for the Pointer events, see ListPane
   237     // EAknCmdOpen is added for the Pointer events, see ListPane
   238     if( aCommand == EESMRCmdAlarmOn || aCommand == EESMRCmdAlarmOff 
   238     if( aCommand == EESMRCmdAlarmOn || aCommand == EESMRCmdAlarmOff
   239             || aCommand == EAknCmdOpen )
   239             || aCommand == EAknCmdOpen )
   240         {
   240         {
   241 		HandleTactileFeedbackL();
   241 		HandleTactileFeedbackL();
   242 		
   242 
   243         SwitchMiddleSoftKeyL();
   243         SwitchMiddleSoftKeyL();
   244         isUsed = ETrue;
   244         isUsed = ETrue;
   245         }
   245         }
   246     return isUsed;
   246     return isUsed;
   247     }
   247     }
   255     FUNC_LOG;
   255     FUNC_LOG;
   256     iStatus = !iStatus; // change status
   256     iStatus = !iStatus; // change status
   257     ResetFieldL();
   257     ResetFieldL();
   258     if( iStatus )
   258     if( iStatus )
   259         {
   259         {
   260         ChangeMiddleSoftKeyL( EESMRCmdAlarmOff,R_QTN_MEET_REQ_ALARM_OFF ); 
   260         ChangeMiddleSoftKeyL( EESMRCmdAlarmOff,R_QTN_MEET_REQ_ALARM_OFF );
   261         }
   261         }
   262     else
   262     else
   263         {
   263         {
   264         ChangeMiddleSoftKeyL( EESMRCmdAlarmOn,R_QTN_MEET_REQ_ALARM_ON ); 
   264         ChangeMiddleSoftKeyL( EESMRCmdAlarmOn,R_QTN_MEET_REQ_ALARM_ON );
   265         }
   265         }
   266     
   266 
   267     if( iLabel->IsVisible() )
   267     if( iLabel->IsVisible() )
   268         {
   268         {
   269         iLabel->DrawDeferred();
   269         iLabel->DrawDeferred();
   270         }
   270         }
   271     }
   271     }
   311     FUNC_LOG;
   311     FUNC_LOG;
   312     TRect rect = Rect();
   312     TRect rect = Rect();
   313     TAknLayoutRect rowLayoutRect =
   313     TAknLayoutRect rowLayoutRect =
   314      NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
   314      NMRLayoutManager::GetFieldRowLayoutRect( rect, 1 );
   315     rect = rowLayoutRect.Rect();
   315     rect = rowLayoutRect.Rect();
   316     
   316 
   317     TAknWindowComponentLayout iconLayout =
   317     TAknWindowComponentLayout iconLayout =
   318      NMRLayoutManager::GetWindowComponentLayout( 
   318      NMRLayoutManager::GetWindowComponentLayout(
   319              NMRLayoutManager::EMRLayoutTextEditorIcon );
   319              NMRLayoutManager::EMRLayoutTextEditorIcon );
   320     AknLayoutUtils::LayoutImage( iIcon, rect, iconLayout );
   320     AknLayoutUtils::LayoutImage( iIcon, rect, iconLayout );
   321     
   321 
   322     TAknLayoutRect bgLayoutRect =
   322     TAknLayoutRect bgLayoutRect =
   323      NMRLayoutManager::GetLayoutRect( 
   323      NMRLayoutManager::GetLayoutRect(
   324              rect, NMRLayoutManager::EMRLayoutTextEditorBg );
   324              rect, NMRLayoutManager::EMRLayoutTextEditorBg );
   325     TRect bgRect( bgLayoutRect.Rect() );
   325     TRect bgRect( bgLayoutRect.Rect() );
   326     // Move focus rect so that it's relative to field's position.
   326     // Move focus rect so that it's relative to field's position.
   327     bgRect.Move( -Position() );
   327     bgRect.Move( -Position() );
   328     SetFocusRect( bgRect );
   328     SetFocusRect( bgRect );
   329     
   329 
   330     TAknLayoutText labelLayout = 
   330     TAknTextComponentLayout labelLayout =
   331      NMRLayoutManager::GetLayoutText( 
   331             NMRLayoutManager::GetTextComponentLayout(
   332              rect, NMRLayoutManager::EMRTextLayoutTextEditor );
   332                     NMRLayoutManager::EMRTextLayoutTextEditor );
   333     iLabel->SetRect( labelLayout.TextRect() );
   333     AknLayoutUtils::LayoutLabel( iLabel, rect, labelLayout );
   334     
       
   335     // Setting font for the label also
       
   336     iLabel->SetFont( labelLayout.Font() );
       
   337     }
   334     }
   338 
   335 
   339 // ---------------------------------------------------------------------------
   336 // ---------------------------------------------------------------------------
   340 // CMRAlarmOnOffField::CountComponentControls()
   337 // CMRAlarmOnOffField::CountComponentControls()
   341 // ---------------------------------------------------------------------------
   338 // ---------------------------------------------------------------------------
   376 
   373 
   377 // ---------------------------------------------------------------------------
   374 // ---------------------------------------------------------------------------
   378 // CMRAlarmOnOffField::SetContainerWindowL
   375 // CMRAlarmOnOffField::SetContainerWindowL
   379 // ---------------------------------------------------------------------------
   376 // ---------------------------------------------------------------------------
   380 //
   377 //
   381 void CMRAlarmOnOffField::SetContainerWindowL( 
   378 void CMRAlarmOnOffField::SetContainerWindowL(
   382         const CCoeControl& aContainer )
   379         const CCoeControl& aContainer )
   383     {
   380     {
   384     FUNC_LOG;
   381     FUNC_LOG;
   385     CCoeControl::SetContainerWindowL( aContainer );
   382     CCoeControl::SetContainerWindowL( aContainer );
   386     iLabel->SetContainerWindowL( aContainer );
   383     iLabel->SetContainerWindowL( aContainer );