13 * |
13 * |
14 * Description: ESMR alarm field implementation |
14 * Description: ESMR alarm field implementation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "emailtrace.h" |
|
19 #include "cesmralarmfield.h" |
18 #include "cesmralarmfield.h" |
20 |
19 #include "cesmralarm.h" |
21 #include <eiklabel.h> |
20 #include "esmrcommands.h" |
|
21 #include "cesmrglobalnote.h" |
|
22 #include "mesmrfieldvalidator.h" |
|
23 #include "cesmrlistquery.h" |
|
24 #include "cmrimage.h" |
|
25 #include "cmrlabel.h" |
|
26 #include "nmrlayoutmanager.h" |
|
27 |
22 #include <avkon.hrh> |
28 #include <avkon.hrh> |
23 #include <e32keys.h> |
29 #include <e32keys.h> |
24 #include <barsc.h> |
30 #include <barsc.h> |
25 #include <barsread.h> |
31 #include <barsread.h> |
26 #include <calentry.h> |
32 #include <calentry.h> |
27 #include <calalarm.h> |
33 #include <calalarm.h> |
28 #include <esmrgui.rsg> |
34 #include <esmrgui.rsg> |
29 //<cmail> |
35 //<cmail> |
30 #include "esmrdef.h" |
36 #include "esmrdef.h" |
31 //</cmail> |
37 //</cmail> |
32 #include <AknUtils.h> |
38 #include <aknutils.h> |
33 |
39 |
34 #include "cesmrborderlayer.h" |
40 // DEBUG |
35 #include "cesmralarm.h" |
41 #include "emailtrace.h" |
36 #include "esmrcommands.h" |
|
37 #include "cesmrglobalnote.h" |
|
38 #include "mesmrfieldvalidator.h" |
|
39 #include "cesmrlistquery.h" |
|
40 |
42 |
41 // Unnamed namespace for local definitions |
43 // Unnamed namespace for local definitions |
42 namespace{ // codescanner::namespace |
44 namespace{ // codescanner::namespace |
43 |
45 |
44 _LIT( KNoText, "" ); |
|
45 const TInt KMinuteInMicroSeconds(60000000); |
46 const TInt KMinuteInMicroSeconds(60000000); |
|
47 const TInt KComponentCount( 2 ); |
46 |
48 |
47 }//namespace |
49 }//namespace |
48 |
50 |
49 // ======== MEMBER FUNCTIONS ======== |
51 // ======== MEMBER FUNCTIONS ======== |
50 |
52 |
69 CESMRAlarmField::~CESMRAlarmField( ) |
71 CESMRAlarmField::~CESMRAlarmField( ) |
70 { |
72 { |
71 FUNC_LOG; |
73 FUNC_LOG; |
72 iArray.ResetAndDestroy ( ); |
74 iArray.ResetAndDestroy ( ); |
73 iArray.Close ( ); |
75 iArray.Close ( ); |
74 } |
76 delete iIcon; |
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // CESMRAlarmField::InitializeL |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CESMRAlarmField::InitializeL() |
|
81 { |
|
82 FUNC_LOG; |
|
83 iAlarm->SetFont( iLayout->Font(iCoeEnv, iFieldId ) ); |
|
84 iAlarm->SetLabelAlignment( CESMRLayoutManager::IsMirrored() |
|
85 ? ELayoutAlignRight : ELayoutAlignLeft ); |
|
86 |
|
87 // Update text color |
|
88 AknLayoutUtils::OverrideControlColorL(*iAlarm, |
|
89 EColorLabelText, |
|
90 iLayout->GeneralListAreaTextColor() ); |
|
91 } |
77 } |
92 |
78 |
93 // --------------------------------------------------------------------------- |
79 // --------------------------------------------------------------------------- |
94 // CESMRAlarmField::InternalizeL |
80 // CESMRAlarmField::InternalizeL |
95 // --------------------------------------------------------------------------- |
81 // --------------------------------------------------------------------------- |
275 // CESMRAlarmField::CESMRAlarmField |
261 // CESMRAlarmField::CESMRAlarmField |
276 // --------------------------------------------------------------------------- |
262 // --------------------------------------------------------------------------- |
277 // |
263 // |
278 CESMRAlarmField::CESMRAlarmField( MESMRFieldValidator* aValidator ) |
264 CESMRAlarmField::CESMRAlarmField( MESMRFieldValidator* aValidator ) |
279 : iOptIndex(0), |
265 : iOptIndex(0), |
280 iValidator( aValidator ), |
|
281 iRelativeAlarmValid( ETrue ) |
266 iRelativeAlarmValid( ETrue ) |
282 { |
267 { |
283 FUNC_LOG; |
268 FUNC_LOG; |
284 //do nothing |
269 |
|
270 iValidator = aValidator; |
|
271 SetFieldId ( EESMRFieldAlarm ); |
|
272 SetFocusType( EESMRHighlightFocus ); |
285 } |
273 } |
286 |
274 |
287 // --------------------------------------------------------------------------- |
275 // --------------------------------------------------------------------------- |
288 // CESMRAlarmField::ConstructL |
276 // CESMRAlarmField::ConstructL |
289 // --------------------------------------------------------------------------- |
277 // --------------------------------------------------------------------------- |
290 // |
278 // |
291 void CESMRAlarmField::ConstructL( ) |
279 void CESMRAlarmField::ConstructL( ) |
292 { |
280 { |
293 FUNC_LOG; |
281 FUNC_LOG; |
294 SetFieldId ( EESMRFieldAlarm ); |
282 iAlarm = CMRLabel::NewL(); // base class takes ownership |
295 iAlarm = new (ELeave) CEikLabel; // base class takes ownership |
283 CESMRField::ConstructL( iAlarm ); |
296 iAlarm->SetTextL ( KNoText ); |
284 iAlarm->SetTextL ( KNullDesC() ); |
297 CESMRIconField::ConstructL (KAknsIIDQgnMeetReqIndiAlarm, iAlarm ); |
285 |
|
286 iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapAlarm ); |
|
287 iIcon->SetParent( this ); |
|
288 } |
|
289 |
|
290 // --------------------------------------------------------------------------- |
|
291 // CESMRAlarmField::CountComponentControls |
|
292 // --------------------------------------------------------------------------- |
|
293 // |
|
294 TInt CESMRAlarmField::CountComponentControls() const |
|
295 { |
|
296 return KComponentCount; |
|
297 } |
|
298 |
|
299 // --------------------------------------------------------------------------- |
|
300 // CESMRAlarmField::ComponentControl |
|
301 // --------------------------------------------------------------------------- |
|
302 // |
|
303 CCoeControl* CESMRAlarmField::ComponentControl( TInt aIndex ) const |
|
304 { |
|
305 CCoeControl* control = NULL; |
|
306 switch( aIndex ) |
|
307 { |
|
308 case 0: |
|
309 { |
|
310 control = iAlarm; |
|
311 break; |
|
312 } |
|
313 case 1: |
|
314 { |
|
315 control = iIcon; |
|
316 break; |
|
317 } |
|
318 default: |
|
319 ASSERT( EFalse ); |
|
320 } |
|
321 |
|
322 return control; |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // CESMRAlarmField::SizeChanged |
|
327 // --------------------------------------------------------------------------- |
|
328 // |
|
329 void CESMRAlarmField::SizeChanged() |
|
330 { |
|
331 TRect rect( Rect() ); |
|
332 TAknLayoutRect iconLayout = |
|
333 NMRLayoutManager::GetLayoutRect( |
|
334 rect, NMRLayoutManager::EMRLayoutTextEditorIcon ); |
|
335 TRect iconRect( iconLayout.Rect() ); |
|
336 iIcon->SetRect( iconRect ); |
|
337 |
|
338 TAknLayoutRect bgLayoutRect = |
|
339 NMRLayoutManager::GetLayoutRect( |
|
340 rect, NMRLayoutManager::EMRLayoutTextEditorBg ); |
|
341 TRect bgRect( bgLayoutRect.Rect() ); |
|
342 // Move focus rect so that it's relative to field's position. |
|
343 bgRect.Move( -Position() ); |
|
344 SetFocusRect( bgRect ); |
|
345 |
|
346 TAknTextComponentLayout editorLayout = |
|
347 NMRLayoutManager::GetTextComponentLayout( |
|
348 NMRLayoutManager::EMRTextLayoutTextEditor ); |
|
349 |
|
350 AknLayoutUtils::LayoutLabel( iAlarm, rect, editorLayout ); |
298 } |
351 } |
299 |
352 |
300 // --------------------------------------------------------------------------- |
353 // --------------------------------------------------------------------------- |
301 // CESMRAlarmField::UpdateAlarmLabelL |
354 // CESMRAlarmField::UpdateAlarmLabelL |
302 // --------------------------------------------------------------------------- |
355 // --------------------------------------------------------------------------- |
363 |
416 |
364 // --------------------------------------------------------------------------- |
417 // --------------------------------------------------------------------------- |
365 // CESMRAlarmField::ExecuteGenericCommandL |
418 // CESMRAlarmField::ExecuteGenericCommandL |
366 // --------------------------------------------------------------------------- |
419 // --------------------------------------------------------------------------- |
367 // |
420 // |
368 void CESMRAlarmField::ExecuteGenericCommandL( TInt aCommand ) |
421 TBool CESMRAlarmField::ExecuteGenericCommandL( TInt aCommand ) |
369 { |
422 { |
370 FUNC_LOG; |
423 FUNC_LOG; |
|
424 TBool isUsed( EFalse ); |
371 if(aCommand == EESMRCmdOpenAlarmQuery || |
425 if(aCommand == EESMRCmdOpenAlarmQuery || |
372 aCommand == EAknCmdOpen ) |
426 aCommand == EAknCmdOpen ) |
373 { |
427 { |
374 ExecuteMSKCommandL(); |
428 ExecuteMSKCommandL(); |
375 } |
429 isUsed = ETrue; |
|
430 |
|
431 HandleTactileFeedbackL(); |
|
432 } |
|
433 return isUsed; |
376 } |
434 } |
377 |
435 |
378 // --------------------------------------------------------------------------- |
436 // --------------------------------------------------------------------------- |
379 // CESMRAlarmField::ExecuteMskCommandL |
437 // CESMRAlarmField::ExecuteMskCommandL |
380 // --------------------------------------------------------------------------- |
438 // --------------------------------------------------------------------------- |