41 // ======== LOCAL FUNCTIONS ======== |
41 // ======== LOCAL FUNCTIONS ======== |
42 namespace |
42 namespace |
43 { // codescanner::namespace |
43 { // codescanner::namespace |
44 |
44 |
45 const TInt KComponentCount( 2 ); // icon and label |
45 const TInt KComponentCount( 2 ); // icon and label |
46 const TInt KMaxTimeBuffer( 32 ); // buffer for date formatting |
46 const TInt KMaxTimeBuffer( 32 ); // buffer for date formatting |
47 |
47 |
48 } // unnamed namespace |
48 } // unnamed namespace |
49 |
49 |
50 // ======== MEMBER FUNCTIONS ======== |
50 // ======== MEMBER FUNCTIONS ======== |
51 |
51 |
174 AknLayoutUtils::LayoutImage( iIcon, rect, iconLayout ); |
174 AknLayoutUtils::LayoutImage( iIcon, rect, iconLayout ); |
175 |
175 |
176 // Layouting lock icon |
176 // Layouting lock icon |
177 if( iLockIcon ) |
177 if( iLockIcon ) |
178 { |
178 { |
179 TAknWindowComponentLayout iconLayout( |
179 TAknWindowComponentLayout iconLayout( |
180 NMRLayoutManager::GetWindowComponentLayout( |
180 NMRLayoutManager::GetWindowComponentLayout( |
181 NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) ); |
181 NMRLayoutManager::EMRLayoutSingleRowDColumnGraphic ) ); |
182 AknLayoutUtils::LayoutImage( iLockIcon, rect, iconLayout ); |
182 AknLayoutUtils::LayoutImage( iLockIcon, rect, iconLayout ); |
183 } |
183 } |
184 |
184 |
185 // Layouting label |
185 // Layouting label |
186 TAknLayoutText viewerLayoutText; |
186 TAknTextComponentLayout viewerLayoutText; |
187 if( iLockIcon ) |
187 if( iLockIcon ) |
188 { |
188 { |
189 viewerLayoutText = NMRLayoutManager::GetLayoutText( rect, |
189 viewerLayoutText = NMRLayoutManager::GetTextComponentLayout( |
190 NMRLayoutManager::EMRTextLayoutSingleRowEditorText ); |
190 NMRLayoutManager::EMRTextLayoutSingleRowEditorText ); |
191 } |
191 } |
192 else |
192 else |
193 { |
193 { |
194 viewerLayoutText = NMRLayoutManager::GetLayoutText( rect, |
194 viewerLayoutText = NMRLayoutManager::GetTextComponentLayout( |
195 NMRLayoutManager::EMRTextLayoutTextEditor ); |
195 NMRLayoutManager::EMRTextLayoutTextEditor ); |
196 } |
196 } |
197 |
197 |
198 TRect viewerRect( viewerLayoutText.TextRect() ); |
198 AknLayoutUtils::LayoutLabel( iLabel, rect, viewerLayoutText ); |
199 iLabel->SetRect( viewerRect ); |
199 TRect viewerRect( iLabel->Rect() ); |
200 |
200 |
201 // Move focus rect so that it's relative to field's position. |
201 // Move focus rect so that it's relative to field's position. |
202 viewerRect.Move( -Position() ); |
202 viewerRect.Move( -Position() ); |
203 SetFocusRect( viewerRect ); |
203 SetFocusRect( viewerRect ); |
204 |
|
205 // Setting font also for the label |
|
206 iLabel->SetFont( viewerLayoutText.Font() ); |
|
207 } |
204 } |
208 |
205 |
209 // --------------------------------------------------------------------------- |
206 // --------------------------------------------------------------------------- |
210 // CESMRViewerStopDateField::CountComponentControls() |
207 // CESMRViewerStopDateField::CountComponentControls() |
211 // --------------------------------------------------------------------------- |
208 // --------------------------------------------------------------------------- |
255 // --------------------------------------------------------------------------- |
252 // --------------------------------------------------------------------------- |
256 // |
253 // |
257 TBool CESMRViewerStopDateField::ExecuteGenericCommandL( TInt aCommand ) |
254 TBool CESMRViewerStopDateField::ExecuteGenericCommandL( TInt aCommand ) |
258 { |
255 { |
259 FUNC_LOG; |
256 FUNC_LOG; |
260 |
257 |
261 TBool retValue( EFalse ); |
258 TBool retValue( EFalse ); |
262 |
259 |
263 if( (aCommand == EAknCmdOpen) && IsLocked() ) |
260 if( (aCommand == EAknCmdOpen) && IsLocked() ) |
264 { |
261 { |
265 HandleTactileFeedbackL(); |
262 HandleTactileFeedbackL(); |
266 |
263 |
267 CESMRGlobalNote::ExecuteL( |
264 CESMRGlobalNote::ExecuteL( |
268 CESMRGlobalNote::EESMRUnableToEdit ); |
265 CESMRGlobalNote::EESMRUnableToEdit ); |
269 retValue = ETrue; |
266 retValue = ETrue; |
270 } |
267 } |
271 |
268 |
272 if ( EMRCmdDoEnvironmentChange == aCommand ) |
269 if ( EMRCmdDoEnvironmentChange == aCommand ) |
273 { |
270 { |
274 FormatDateStringL(); |
271 FormatDateStringL(); |
275 retValue = ETrue; |
272 retValue = ETrue; |
276 } |
273 } |
277 |
274 |
278 return retValue; |
275 return retValue; |
279 } |
276 } |
280 |
277 |
281 // --------------------------------------------------------------------------- |
278 // --------------------------------------------------------------------------- |
282 // CESMRViewerStopDateField::LockL() |
279 // CESMRViewerStopDateField::LockL() |
303 // --------------------------------------------------------------------------- |
300 // --------------------------------------------------------------------------- |
304 // |
301 // |
305 void CESMRViewerStopDateField::FormatDateStringL() |
302 void CESMRViewerStopDateField::FormatDateStringL() |
306 { |
303 { |
307 FUNC_LOG; |
304 FUNC_LOG; |
308 |
305 |
309 // Read format string from AVKON resource |
306 // Read format string from AVKON resource |
310 HBufC* dateFormatString = |
307 HBufC* dateFormatString = |
311 iEikonEnv->AllocReadResourceLC( |
308 iEikonEnv->AllocReadResourceLC( |
312 R_QTN_DATE_USUAL_WITH_ZERO); |
309 R_QTN_DATE_USUAL_WITH_ZERO); |
313 |
310 |
314 TBuf<KMaxTimeBuffer> buf; |
311 TBuf<KMaxTimeBuffer> buf; |
315 iStopTime.FormatL(buf, *dateFormatString); |
312 iStopTime.FormatL(buf, *dateFormatString); |
316 |
313 |
317 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( buf ); |
314 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( buf ); |
318 iLabel->SetTextL( buf ); |
315 iLabel->SetTextL( buf ); |
319 CleanupStack::PopAndDestroy( dateFormatString ); |
316 CleanupStack::PopAndDestroy( dateFormatString ); |
320 } |
317 } |
321 |
318 |
322 // EOF |
319 // EOF |