meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrtimecontainer.cpp
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ESMR time (start-end) field implementation
       
    15  *
       
    16 */
       
    17 #include "cmrtimecontainer.h"
       
    18 #include "esmrfieldbuilderdef.h"
       
    19 #include "mesmrfieldvalidator.h"
       
    20 #include "nmrlayoutmanager.h"
       
    21 #include "nmrcolormanager.h"
       
    22 #include "cesmrglobalnote.h"
       
    23 #include "nmrbitmapmanager.h"
       
    24 #include "cmrlabel.h"
       
    25 
       
    26 #include <layoutmetadata.cdl.h>
       
    27 #include <eikmfne.h>
       
    28 #include <avkon.hrh>
       
    29 #include <AknUtils.h>
       
    30 #include <AknsFrameBackgroundControlContext.h>
       
    31 #include <AknsDrawUtils.h>
       
    32 #include <AknsBasicBackgroundControlContext.h>
       
    33 
       
    34 // DEBUG
       
    35 #include "emailtrace.h"
       
    36 
       
    37 namespace  { // codescanner::namespace
       
    38 // start time field count of 24-hour format
       
    39 const TInt KNumsFieldOf24F = 3;
       
    40 
       
    41 #define KMinimumTime (TTime(0)) // codescanner::baddefines
       
    42 
       
    43 // 24 hours in microseconds
       
    44 const TInt64 KDayInMicroSeconds = 86400000000;
       
    45 #define KMaximumTime (TTime(KDayInMicroSeconds)) // codescanner::baddefines
       
    46 
       
    47 }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CMRTimeContainer::CMRTimeContainer
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CMRTimeContainer::CMRTimeContainer(
       
    54         MESMRFieldValidator* aValidator,
       
    55         TESMREntryFieldId aFieldId  ) :
       
    56     iValidator(aValidator),
       
    57     iFieldId( aFieldId )
       
    58     {
       
    59     FUNC_LOG;
       
    60     // do nothing
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // CMRTimeContainer::~CMRTimeContainer
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CMRTimeContainer::~CMRTimeContainer( )
       
    68     {
       
    69     FUNC_LOG;
       
    70     Reset();
       
    71     }
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // CMRTimeContainer::NewL
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 CMRTimeContainer* CMRTimeContainer::NewL(
       
    78         MESMRFieldValidator* aValidator,
       
    79         CCoeControl* aParent,
       
    80         TESMREntryFieldId aFieldId )
       
    81     {
       
    82     FUNC_LOG;
       
    83     CMRTimeContainer* self =
       
    84             new (ELeave) CMRTimeContainer( aValidator, aFieldId );
       
    85     CleanupStack::PushL ( self );
       
    86     self->ConstructL ( aParent );
       
    87     CleanupStack::Pop ( self );
       
    88     return self;
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // CMRTimeContainer::ConstructL
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 void CMRTimeContainer::ConstructL(
       
    96         CCoeControl* /*aParent*/)
       
    97     {
       
    98     FUNC_LOG;
       
    99     InitializeL();
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // CMRTimeContainer::SetContainerWindowL
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 void CMRTimeContainer::SetContainerWindowL(
       
   107         const CCoeControl& aControl )
       
   108     {
       
   109     FUNC_LOG;
       
   110 
       
   111     iContainerWindow = &aControl;
       
   112 
       
   113     CCoeControl::SetContainerWindowL ( *iContainerWindow );
       
   114     iStartTime->SetContainerWindowL ( *iContainerWindow );
       
   115     iEndTime->SetContainerWindowL ( *iContainerWindow );
       
   116     iSeparator->SetContainerWindowL( *iContainerWindow );
       
   117 
       
   118     iStartTime->SetParent( this );
       
   119     iEndTime->SetParent( this );
       
   120     iSeparator->SetParent( this );
       
   121     }
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // CMRTimeContainer::CountComponentControls
       
   125 // ---------------------------------------------------------------------------
       
   126 //
       
   127 TInt CMRTimeContainer::CountComponentControls() const
       
   128     {
       
   129     FUNC_LOG;
       
   130     TInt count( 0);
       
   131 
       
   132     if ( iStartTime )
       
   133         {
       
   134         ++count;
       
   135         }
       
   136 
       
   137     if ( iSeparator )
       
   138         {
       
   139         ++count;
       
   140         }
       
   141 
       
   142     if ( iEndTime )
       
   143         {
       
   144         ++count;
       
   145         }
       
   146 
       
   147     return count;
       
   148     }
       
   149 
       
   150 // ---------------------------------------------------------------------------
       
   151 // CMRTimeContainer::ComponentControl
       
   152 // ---------------------------------------------------------------------------
       
   153 //
       
   154 CCoeControl* CMRTimeContainer::ComponentControl(
       
   155         TInt aInd ) const
       
   156     {
       
   157     FUNC_LOG;
       
   158     switch ( aInd )
       
   159         {
       
   160         case 0:
       
   161             return iStartTime;
       
   162         case 1:
       
   163             return iSeparator;
       
   164         case 2:
       
   165             return iEndTime;
       
   166         default:
       
   167             return NULL;
       
   168         }
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // CMRTimeContainer::SizeChanged
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 void CMRTimeContainer::SizeChanged()
       
   176     {
       
   177     FUNC_LOG;
       
   178     TRect rect( Rect() );
       
   179     TAknTextComponentLayout startTimeLayout =
       
   180         NMRLayoutManager::GetTextComponentLayout(
       
   181                 NMRLayoutManager::EMRTextLayoutTimeEditorStart );
       
   182     AknLayoutUtils::LayoutMfne( iStartTime, rect, startTimeLayout );
       
   183 
       
   184     NMRColorManager::SetColor( *iStartTime,
       
   185                                NMRColorManager::EMRMainAreaTextColor );
       
   186 
       
   187     TAknLayoutText hyphonLayout =
       
   188         NMRLayoutManager::GetLayoutText(
       
   189                 rect, NMRLayoutManager::EMRTextLayoutTimeEditorSeparator );
       
   190     iSeparator->SetRect( hyphonLayout.TextRect() );
       
   191 
       
   192     NMRColorManager::SetColor( *iSeparator,
       
   193                                NMRColorManager::EMRMainAreaTextColor );
       
   194 
       
   195     TAknTextComponentLayout endTimeLayout =
       
   196         NMRLayoutManager::GetTextComponentLayout(
       
   197                 NMRLayoutManager::EMRTextLayoutTimeEditorEnd );
       
   198     AknLayoutUtils::LayoutMfne( iEndTime, rect, endTimeLayout );
       
   199 
       
   200     NMRColorManager::SetColor( *iEndTime,
       
   201                                NMRColorManager::EMRMainAreaTextColor );
       
   202 
       
   203     }
       
   204 
       
   205 // ---------------------------------------------------------------------------
       
   206 // CMRTimeContainer::OfferKeyEventL
       
   207 // ---------------------------------------------------------------------------
       
   208 //
       
   209 TKeyResponse CMRTimeContainer::OfferKeyEventL(
       
   210         const TKeyEvent& aEvent,
       
   211         TEventCode aType )
       
   212     {
       
   213     FUNC_LOG;
       
   214     TBool startFocusedBefore( iStartTime->IsFocused() );
       
   215     TInt startIndex( iStartTime->CurrentField() );
       
   216 
       
   217     TBool endFocusedBefore( iEndTime->IsFocused() );
       
   218     TInt endIndex( iEndTime->CurrentField() );
       
   219 
       
   220     TKeyResponse response = EKeyWasNotConsumed;
       
   221     if ( aType == EEventKey )
       
   222         {
       
   223         switch ( aEvent.iScanCode )
       
   224             {
       
   225             case EStdKeyLeftArrow:
       
   226                 response = ChangeFocusLeftL( aEvent, aType );
       
   227                 break;
       
   228 
       
   229             case EStdKeyRightArrow:
       
   230                 response = ChangeFocusRightL( aEvent, aType );
       
   231                 break;
       
   232 
       
   233             default: // other events than left/right arrows
       
   234                 {
       
   235                 response = FocusedEditor()->OfferKeyEventL( aEvent, aType );
       
   236                 iStartTime->DrawDeferred();
       
   237                 iEndTime->DrawDeferred();
       
   238                 }
       
   239                 break;
       
   240             }
       
   241         }
       
   242 
       
   243     if ( EKeyWasConsumed == response )
       
   244         {
       
   245         CheckIfValidatingNeededL(
       
   246                 startFocusedBefore,
       
   247                 startIndex,
       
   248                 endFocusedBefore,
       
   249                 endIndex );
       
   250         }
       
   251 
       
   252     return response;
       
   253     }
       
   254 
       
   255 // ---------------------------------------------------------------------------
       
   256 // CMRTimeContainer::FocusChanged
       
   257 // ---------------------------------------------------------------------------
       
   258 //
       
   259 void CMRTimeContainer::FocusChanged(
       
   260         TDrawNow /*aDrawNow*/)
       
   261     {
       
   262     FUNC_LOG;
       
   263     if ( IsFocused ( ) ) // if focus is gained
       
   264         {
       
   265         iStartTime->SetFocus ( ETrue );
       
   266         }
       
   267     else
       
   268         {
       
   269         if ( iStartTime->IsFocused() )
       
   270             {
       
   271             iStartTime->SetFocus( EFalse, EDrawNow );
       
   272             }
       
   273 
       
   274         if ( iEndTime->IsFocused() )
       
   275             {
       
   276             iEndTime->SetFocus( EFalse, EDrawNow );
       
   277             }
       
   278         }
       
   279     }
       
   280 
       
   281 // ---------------------------------------------------------------------------
       
   282 // CMRTimeContainer::FocusedEditor
       
   283 // ---------------------------------------------------------------------------
       
   284 //
       
   285 CEikTimeEditor* CMRTimeContainer::FocusedEditor( )
       
   286     {
       
   287     FUNC_LOG;
       
   288     return iStartTime->IsFocused ( ) ? iStartTime : iEndTime;
       
   289     }
       
   290 
       
   291 // ---------------------------------------------------------------------------
       
   292 // CMRTimeContainer::OkToLoseFocusL
       
   293 // ---------------------------------------------------------------------------
       
   294 //
       
   295 TBool CMRTimeContainer::OkToLoseFocusL(
       
   296         TESMREntryFieldId /*aFrom*/,
       
   297         TESMREntryFieldId /*aTo*/ )
       
   298     {
       
   299     FUNC_LOG;
       
   300     // validate the current time
       
   301     FocusedEditor()->PrepareForFocusLossL();
       
   302 
       
   303     if ( iStartTime->IsFocused() )
       
   304         {
       
   305         TriggerStartTimeChangedL();
       
   306         }
       
   307     else
       
   308         {
       
   309         TriggerEndTimeChangedL();
       
   310         }
       
   311 
       
   312     return ETrue;
       
   313     }
       
   314 
       
   315 // ---------------------------------------------------------------------------
       
   316 // CMRTimeContainer::SetBgRect
       
   317 // ---------------------------------------------------------------------------
       
   318 //
       
   319 void CMRTimeContainer::SetBgRect( TRect bgRect )
       
   320 	{
       
   321 	iBgRect = bgRect;
       
   322 	}
       
   323 
       
   324 // ---------------------------------------------------------------------------
       
   325 // CMRTimeContainer::SetValidatorL
       
   326 // ---------------------------------------------------------------------------
       
   327 //
       
   328 void CMRTimeContainer::SetValidatorL( MESMRFieldValidator* aValidator )
       
   329     {
       
   330     iValidator = aValidator;
       
   331 
       
   332     if ( iValidator )
       
   333         {
       
   334         iValidator->SetStartTimeFieldL( *iStartTime );
       
   335         iValidator->SetEndTimeFieldL( *iEndTime );
       
   336         }
       
   337     }
       
   338 
       
   339 // ---------------------------------------------------------------------------
       
   340 // CMRTimeContainer::SetValidatorL
       
   341 // ---------------------------------------------------------------------------
       
   342 //
       
   343 void CMRTimeContainer::EnvironmentChangedL()
       
   344     {
       
   345     FUNC_LOG;
       
   346 
       
   347     Reset();
       
   348     InitializeL();
       
   349 
       
   350     SetContainerWindowL( *iContainerWindow );
       
   351 
       
   352     iStartTime->ActivateL();
       
   353     iEndTime->ActivateL();
       
   354     iSeparator->ActivateL();
       
   355     }
       
   356 
       
   357 // ---------------------------------------------------------------------------
       
   358 // CMRTimeContainer::ChangeFocusRightL
       
   359 // ---------------------------------------------------------------------------
       
   360 //
       
   361 TKeyResponse CMRTimeContainer::ChangeFocusRightL(const TKeyEvent& aEvent,
       
   362         TEventCode aType )
       
   363     {
       
   364     FUNC_LOG;
       
   365     TKeyResponse response = EKeyWasNotConsumed;
       
   366 
       
   367     if ( iStartTime->IsFocused ( ) )
       
   368         {
       
   369         // if the focus is in the last field of start time, move focus
       
   370         // to end times first field.
       
   371         TInt current = iStartTime->CurrentField();
       
   372         TInt count = iStartTime->NumFields();
       
   373         if ( current == (count - 1) )
       
   374             {
       
   375             iStartTime->SetFocus( EFalse, EDrawNow );
       
   376             iEndTime->SetFocus( ETrue, EDrawNow );
       
   377             response = EKeyWasConsumed;
       
   378             }
       
   379         else
       
   380             {
       
   381             response = iStartTime->OfferKeyEventL ( aEvent, aType );
       
   382             }
       
   383         TriggerStartTimeChangedL();
       
   384         }
       
   385 
       
   386     else if ( iEndTime->IsFocused ( ) )
       
   387         {
       
   388         if ( iEndTime->CurrentField() == (iEndTime->NumFields() - 1) )
       
   389             {
       
   390             iEndTime->SetFocus ( EFalse, EDrawNow );
       
   391             iStartTime->SetFocus ( ETrue, EDrawNow );
       
   392             response = EKeyWasConsumed;
       
   393             }
       
   394         else
       
   395             {
       
   396             response = iEndTime->OfferKeyEventL ( aEvent, aType );
       
   397             }
       
   398         TriggerEndTimeChangedL();
       
   399         }
       
   400     return response;
       
   401     }
       
   402 
       
   403 // ---------------------------------------------------------------------------
       
   404 // CMRTimeContainer::ChangeFocusLeftL
       
   405 // ---------------------------------------------------------------------------
       
   406 //
       
   407 TKeyResponse CMRTimeContainer::ChangeFocusLeftL(
       
   408         const TKeyEvent& aEvent,
       
   409         TEventCode aType )
       
   410     {
       
   411     FUNC_LOG;
       
   412     TKeyResponse response = EKeyWasNotConsumed;
       
   413     if ( iStartTime->IsFocused ( ) )
       
   414         {
       
   415         // if the focus is in the first field of start time, move focus
       
   416         // to end times last field.
       
   417         if ( iStartTime->CurrentField ( )== 0 )
       
   418             {
       
   419             iStartTime->SetFocus ( EFalse, EDrawNow );
       
   420             iEndTime->SetFocus ( ETrue, EDrawNow );
       
   421             // last item should highlighted, API does not export the highlight
       
   422             // function, so emulate key presses
       
   423             response = iEndTime->OfferKeyEventL ( aEvent, aType );
       
   424             }
       
   425         else
       
   426             {
       
   427             response = iStartTime->OfferKeyEventL ( aEvent, aType );
       
   428             }
       
   429         
       
   430         TriggerStartTimeChangedL();
       
   431         }
       
   432 
       
   433     else if ( iEndTime->IsFocused ( ) )
       
   434         {
       
   435         if ( iEndTime->CurrentField ( )== 0 )
       
   436             {
       
   437             iEndTime->SetFocus ( EFalse, EDrawNow );
       
   438             iStartTime->SetFocus ( ETrue, EDrawNow );
       
   439             // last item should highlighted, API does not export the highlight
       
   440             // function, so emulate key presses
       
   441             response = iStartTime->OfferKeyEventL ( aEvent, aType );
       
   442             }
       
   443         else
       
   444             {
       
   445             response = iEndTime->OfferKeyEventL ( aEvent, aType );
       
   446             }
       
   447 
       
   448         TriggerEndTimeChangedL();
       
   449         }
       
   450     return response;
       
   451     }
       
   452 
       
   453 // ---------------------------------------------------------------------------
       
   454 // CMRTimeContainer::CheckIfValidatingNeededL
       
   455 // ---------------------------------------------------------------------------
       
   456 //
       
   457 void CMRTimeContainer::CheckIfValidatingNeededL(
       
   458         TBool aStartFocusedBefore,
       
   459         TInt aStartFieldIndex,
       
   460         TBool aEndFocusedBefore,
       
   461         TInt aEndFieldIndex )
       
   462     {
       
   463     FUNC_LOG;
       
   464     TBool startFocusedAfter( iStartTime->IsFocused() );
       
   465     TBool endFocusedAfter( iEndTime->IsFocused() );
       
   466 
       
   467     if ( aStartFocusedBefore != startFocusedAfter )
       
   468         {
       
   469         if ( startFocusedAfter )
       
   470             {
       
   471             TriggerEndTimeChangedL();
       
   472             }
       
   473         else
       
   474             {
       
   475             TriggerStartTimeChangedL();
       
   476             }
       
   477         }
       
   478 
       
   479     else if ( startFocusedAfter &&
       
   480               aStartFocusedBefore == startFocusedAfter )
       
   481         {
       
   482         TInt fieldIndex( iStartTime->CurrentField() );
       
   483         if ( fieldIndex != aStartFieldIndex )
       
   484             {
       
   485             TriggerStartTimeChangedL();
       
   486             }
       
   487         }
       
   488 
       
   489     else if ( endFocusedAfter &&
       
   490               aEndFocusedBefore == endFocusedAfter )
       
   491         {
       
   492         TInt fieldIndex( iEndTime->CurrentField() );
       
   493         if ( fieldIndex != aEndFieldIndex )
       
   494             {
       
   495             TriggerEndTimeChangedL();
       
   496             }
       
   497         }
       
   498     
       
   499 	if ( iStartTime->IsFocused ( ) )
       
   500 		{
       
   501 		// if the focus is in the last field of start time
       
   502 		TInt current = iStartTime->CurrentField();
       
   503 		TInt count = iStartTime->NumFields();
       
   504 		
       
   505 		if ( ( count > KNumsFieldOf24F ) && ( current == (count - 1) ) )
       
   506 			{
       
   507 			TriggerStartTimeChangedL();
       
   508 			}
       
   509 		}
       
   510     }
       
   511 
       
   512 // ---------------------------------------------------------------------------
       
   513 // CMRTimeContainer::TriggerStartTimeChangedL
       
   514 // ---------------------------------------------------------------------------
       
   515 //
       
   516 void CMRTimeContainer::TriggerStartTimeChangedL()
       
   517     {
       
   518     FUNC_LOG;
       
   519     if ( iValidator )
       
   520         {
       
   521         TRAPD( err, iValidator->StartTimeChangedL() );
       
   522         if ( err != KErrNone )
       
   523             {
       
   524             switch ( err )
       
   525                 {
       
   526                 case KErrOverflow:
       
   527                     CESMRGlobalNote::ExecuteL(
       
   528                             CESMRGlobalNote::EESMRRepeatReSchedule );
       
   529                     break;
       
   530                 }
       
   531             }
       
   532         }
       
   533     }
       
   534 
       
   535 // ---------------------------------------------------------------------------
       
   536 // CMRTimeContainer::TriggerEndTimeChangedL
       
   537 // ---------------------------------------------------------------------------
       
   538 //
       
   539 void CMRTimeContainer::TriggerEndTimeChangedL()
       
   540     {
       
   541     FUNC_LOG;
       
   542     if ( iValidator )
       
   543         {
       
   544         TRAPD( err, iValidator->EndTimeChangedL() );
       
   545         if ( err != KErrNone )
       
   546             {
       
   547             switch ( err )
       
   548                 {
       
   549                 case KErrArgument:
       
   550                     // Assuming that end date is different
       
   551                     // and this is repeating entry
       
   552                     CESMRGlobalNote::ExecuteL(
       
   553                             CESMRGlobalNote::EESMRRepeatDifferentStartAndEndDate );
       
   554                     break;
       
   555                 case KErrOverflow:
       
   556                     CESMRGlobalNote::ExecuteL(
       
   557                             CESMRGlobalNote::EESMRRepeatReSchedule );
       
   558                     break;
       
   559                 }
       
   560             }
       
   561         }
       
   562     }
       
   563 
       
   564 // ---------------------------------------------------------------------------
       
   565 // CMRTimeContainer::HandlePointerEventL
       
   566 // ---------------------------------------------------------------------------
       
   567 //
       
   568 void CMRTimeContainer::HandlePointerEventL( const TPointerEvent &aPointerEvent )
       
   569     {
       
   570     TBool startTimeEvent =
       
   571             iStartTime->Rect().Contains( aPointerEvent.iPosition );
       
   572     TBool endTimeEvent =
       
   573             iEndTime->Rect().Contains( aPointerEvent.iPosition );
       
   574 
       
   575     if( startTimeEvent )
       
   576         {
       
   577         if( !iStartTime->IsFocused() )
       
   578             {
       
   579             iStartTime->SetFocus( ETrue, ENoDrawNow );
       
   580             iEndTime->SetFocus( EFalse, ENoDrawNow );
       
   581             TriggerEndTimeChangedL();
       
   582             }
       
   583 
       
   584         CCoeControl::HandlePointerEventL( aPointerEvent );
       
   585         }
       
   586 
       
   587     if( endTimeEvent )
       
   588         {
       
   589         if( !iEndTime->IsFocused() )
       
   590             {
       
   591             iEndTime->SetFocus( ETrue, ENoDrawNow );
       
   592             iStartTime->SetFocus( EFalse, ENoDrawNow );
       
   593             TriggerStartTimeChangedL();
       
   594             }
       
   595 
       
   596         CCoeControl::HandlePointerEventL( aPointerEvent );
       
   597         }
       
   598     }
       
   599 
       
   600 // ---------------------------------------------------------------------------
       
   601 // CMRTimeContainer::ActivateL
       
   602 // ---------------------------------------------------------------------------
       
   603 //
       
   604 void CMRTimeContainer::ActivateL()
       
   605     {
       
   606     FUNC_LOG;
       
   607     CCoeControl::ActivateL();
       
   608     }
       
   609 
       
   610 // ---------------------------------------------------------------------------
       
   611 // CMRTimeContainer::InitializeL
       
   612 // ---------------------------------------------------------------------------
       
   613 //
       
   614 void CMRTimeContainer::InitializeL()
       
   615     {
       
   616     FUNC_LOG;
       
   617 
       
   618     SetComponentsToInheritVisibility( ETrue );
       
   619     
       
   620     TTime startTime;
       
   621     startTime.UniversalTime ( );
       
   622 
       
   623     iStartTime = new (ELeave) CEikTimeEditor;
       
   624     iEndTime = new (ELeave) CEikTimeEditor;
       
   625     iSeparator = CMRLabel::NewL();
       
   626 
       
   627     iStartTime->ConstructL (
       
   628             KMinimumTime,
       
   629             KMaximumTime,
       
   630             startTime,
       
   631             EEikTimeWithoutSecondsField );
       
   632 
       
   633     iEndTime->ConstructL ( 
       
   634             KMinimumTime,
       
   635             KMaximumTime,
       
   636             startTime,
       
   637             EEikTimeWithoutSecondsField );
       
   638 
       
   639     TInt align = Layout_Meta_Data::IsMirrored() ? EAknEditorAlignRight
       
   640             : EAknEditorAlignLeft;
       
   641     iStartTime->SetMfneAlignment ( align );
       
   642     iEndTime->SetMfneAlignment ( align );
       
   643 
       
   644     iSeparator->SetTextL ( KTimeFieldSeparator );
       
   645 
       
   646     if ( iValidator )
       
   647         {
       
   648         iValidator->SetStartTimeFieldL( *iStartTime );
       
   649         iValidator->SetEndTimeFieldL( *iEndTime );
       
   650         }
       
   651 
       
   652     // Setting background instead of theme skin
       
   653     NMRBitmapManager::TMRBitmapStruct bitmapStruct;
       
   654     bitmapStruct = NMRBitmapManager::GetBitmapStruct( NMRBitmapManager::EMRBitmapInputCenter );
       
   655 
       
   656     iBgCtrlContext = CAknsBasicBackgroundControlContext::NewL(
       
   657                 bitmapStruct.iItemId,
       
   658                 iBgRect,
       
   659                 EFalse );
       
   660 
       
   661     iStartTime->SetSkinBackgroundControlContextL( iBgCtrlContext );
       
   662     iEndTime->SetSkinBackgroundControlContextL( iBgCtrlContext );
       
   663     }
       
   664 
       
   665 // ---------------------------------------------------------------------------
       
   666 // CMRTimeContainer::Reset
       
   667 // ---------------------------------------------------------------------------
       
   668 //
       
   669 void CMRTimeContainer::Reset()
       
   670     {
       
   671     FUNC_LOG;
       
   672 
       
   673     delete iStartTime;
       
   674     iStartTime = NULL;
       
   675 
       
   676     delete iEndTime;
       
   677     iEndTime = NULL;
       
   678 
       
   679     delete iSeparator;
       
   680     iSeparator = NULL;
       
   681 
       
   682     delete iStartTimeBgContext;
       
   683     iStartTimeBgContext = NULL;
       
   684 
       
   685     delete iEndTimeBgContext;
       
   686     iEndTimeBgContext = NULL;
       
   687 
       
   688     delete iBgCtrlContext;
       
   689     iBgCtrlContext = NULL;
       
   690     }
       
   691 // End of file