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