meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmtimefield.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 16 b5fbb9b25d57
child 22 d620048b4810
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
   125     AknLayoutUtils::LayoutImage( iIcon, rect, iconLayout );
   125     AknLayoutUtils::LayoutImage( iIcon, rect, iconLayout );
   126 
   126 
   127     // Layouting lock icon
   127     // Layouting lock icon
   128     if( iLockIcon )
   128     if( iLockIcon )
   129     	{
   129     	{
   130     	TAknWindowComponentLayout iconLayout( 
   130     	TAknWindowComponentLayout iconLayout(
   131     			NMRLayoutManager::GetWindowComponentLayout( 
   131     			NMRLayoutManager::GetWindowComponentLayout(
   132     					NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
   132     					NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) );
   133     	AknLayoutUtils::LayoutImage( iLockIcon, rect, iconLayout );
   133     	AknLayoutUtils::LayoutImage( iLockIcon, rect, iconLayout );
   134     	}
   134     	}
   135 
   135 
   136     // Layouting label
   136     // Layouting label
   137     TAknLayoutText viewerLayoutText;
   137     TAknTextComponentLayout viewerLayoutText;
       
   138 
   138     if( iLockIcon )
   139     if( iLockIcon )
   139     	{
   140         {
   140     	viewerLayoutText = NMRLayoutManager::GetLayoutText( rect, 
   141         viewerLayoutText = NMRLayoutManager::GetTextComponentLayout(
   141     			NMRLayoutManager::EMRTextLayoutSingleRowEditorText );
   142                 NMRLayoutManager::EMRTextLayoutSingleRowEditorText );
   142     	}
   143         }
   143     else
   144     else
   144     	{
   145         {
   145     	viewerLayoutText = NMRLayoutManager::GetLayoutText( rect, 
   146         viewerLayoutText = NMRLayoutManager::GetTextComponentLayout(
   146     			NMRLayoutManager::EMRTextLayoutTextEditor );
   147                 NMRLayoutManager::EMRTextLayoutTextEditor );
   147     	}
   148         }
   148 
   149 
   149     TRect viewerRect( viewerLayoutText.TextRect() );    
   150     AknLayoutUtils::LayoutLabel( iLabel, rect, viewerLayoutText );
   150     iLabel->SetRect( viewerRect );
   151     TRect viewerRect( iLabel->Rect() );
   151 
   152 
   152     // Move focus rect so that it's relative to field's position.
   153     // Move focus rect so that it's relative to field's position.
   153     viewerRect.Move( -Position() );
   154     viewerRect.Move( -Position() );
   154     SetFocusRect( viewerRect );
   155     SetFocusRect( viewerRect );
   155 
       
   156     // Setting font also for the label
       
   157     iLabel->SetFont( viewerLayoutText.Font() );
       
   158     }
   156     }
   159 
   157 
   160 // ---------------------------------------------------------------------------
   158 // ---------------------------------------------------------------------------
   161 // CESMRViewerAlarmTimeField::CountComponentControls()
   159 // CESMRViewerAlarmTimeField::CountComponentControls()
   162 // ---------------------------------------------------------------------------
   160 // ---------------------------------------------------------------------------
   172 
   170 
   173     if ( iLabel )
   171     if ( iLabel )
   174         {
   172         {
   175         ++count;
   173         ++count;
   176         }
   174         }
   177     
   175 
   178     if ( iLockIcon )
   176     if ( iLockIcon )
   179     	{
   177     	{
   180     	++count;
   178     	++count;
   181     	}
   179     	}
   182     return count;
   180     return count;
   219 // ---------------------------------------------------------------------------
   217 // ---------------------------------------------------------------------------
   220 //
   218 //
   221 TBool CESMRViewerAlarmTimeField::ExecuteGenericCommandL( TInt aCommand )
   219 TBool CESMRViewerAlarmTimeField::ExecuteGenericCommandL( TInt aCommand )
   222     {
   220     {
   223     FUNC_LOG;
   221     FUNC_LOG;
   224     
   222 
   225     TBool retValue( EFalse );
   223     TBool retValue( EFalse );
   226     
   224 
   227     if( (aCommand == EAknCmdOpen) && IsLocked()  )
   225     if( (aCommand == EAknCmdOpen) && IsLocked()  )
   228     	{
   226     	{
   229 		HandleTactileFeedbackL();
   227 		HandleTactileFeedbackL();
   230     	
   228 
   231 		CESMRGlobalNote::ExecuteL(
   229 		CESMRGlobalNote::ExecuteL(
   232     	                    CESMRGlobalNote::EESMRUnableToEdit );
   230     	                    CESMRGlobalNote::EESMRUnableToEdit );
   233     	retValue = ETrue;
   231     	retValue = ETrue;
   234     	}
   232     	}
   235     
   233 
   236     if ( EMRCmdDoEnvironmentChange == aCommand )
   234     if ( EMRCmdDoEnvironmentChange == aCommand )
   237         {
   235         {
   238         FormatAlarmTimeL();
   236         FormatAlarmTimeL();
   239         retValue = ETrue;
   237         retValue = ETrue;
   240         }
   238         }
   241     
   239 
   242     return retValue;
   240     return retValue;
   243     }
   241     }
   244 
   242 
   245 // ---------------------------------------------------------------------------
   243 // ---------------------------------------------------------------------------
   246 // CESMRViewerAlarmTimeField::LockL()
   244 // CESMRViewerAlarmTimeField::LockL()
   251 	FUNC_LOG;
   249 	FUNC_LOG;
   252 	if( IsLocked() )
   250 	if( IsLocked() )
   253 		{
   251 		{
   254 		return;
   252 		return;
   255 		}
   253 		}
   256 	
   254 
   257 	CESMRField::LockL();
   255 	CESMRField::LockL();
   258 	
   256 
   259 	delete iLockIcon;
   257 	delete iLockIcon;
   260 	iLockIcon = NULL;
   258 	iLockIcon = NULL;
   261 	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
   259 	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
   262 	iLockIcon->SetParent( this );
   260 	iLockIcon->SetParent( this );
   263 	}
   261 	}
   267 // ---------------------------------------------------------------------------
   265 // ---------------------------------------------------------------------------
   268 //
   266 //
   269 void CESMRViewerAlarmTimeField::FormatAlarmTimeL()
   267 void CESMRViewerAlarmTimeField::FormatAlarmTimeL()
   270     {
   268     {
   271     FUNC_LOG;
   269     FUNC_LOG;
   272     
   270 
   273     // Read format string from AVKON resource
   271     // Read format string from AVKON resource
   274     HBufC* dateFormatString =
   272     HBufC* dateFormatString =
   275         iEikonEnv->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO );
   273         iEikonEnv->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO );
   276     HBufC* buf = HBufC::NewLC( KBufferLength );
   274     HBufC* buf = HBufC::NewLC( KBufferLength );
   277     TPtr ptr( buf->Des() );
   275     TPtr ptr( buf->Des() );
   278 
   276 
   279     iAlarmTime.FormatL( ptr, *dateFormatString );
   277     iAlarmTime.FormatL( ptr, *dateFormatString );
   280     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
   278     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
   281     iLabel->SetTextL( ptr );
   279     iLabel->SetTextL( ptr );
   282     CleanupStack::PopAndDestroy( 2, dateFormatString );    
   280     CleanupStack::PopAndDestroy( 2, dateFormatString );
   283     }
   281     }
   284 // EOF
   282 // EOF
   285 
   283