meetingrequest/mrgui/inc/cesmrannivtimevalidator.h
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 and date sanity checks and saving
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CESMRANNIVTIMEVALIDATOR_H
       
    20 #define CESMRANNIVTIMEVALIDATOR_H
       
    21 
       
    22 //<cmail>
       
    23 #include "esmrdef.h"
       
    24 //</cmail>
       
    25 #include <e32base.h>
       
    26 #include <e32std.h>
       
    27 #include "mesmrfieldvalidator.h"
       
    28 
       
    29 class MESMRCalEntry;
       
    30 class CEikTimeEditor;
       
    31 class CEikDateEditor;
       
    32 class MMRAbsoluteAlarmController;
       
    33 
       
    34 /**
       
    35  * Wrapper class handles sanity checks for date/time fields on Anniversary
       
    36  * Entry. For example start date can not be after end date.
       
    37  * this calss deals with the cheks for To-do option
       
    38  * InternalizeL() / ExternalizeL() is delegated to this class since those
       
    39  * need sanity checks. Fields (who use this wrapper class) shouldn't react
       
    40  * on ExternalizeL() functions since this wrapper class handles them. On
       
    41  * InternalizeL() they should attach their date/time editors in here.
       
    42  *
       
    43  * @lib esmrgui.lib
       
    44  */
       
    45 NONSHARABLE_CLASS( CESMRAnnivTimeValidator ):
       
    46         public CBase,
       
    47         public MESMRFieldValidator
       
    48     {
       
    49 public:
       
    50     /**
       
    51      * Two phase constructor.
       
    52      */
       
    53     static CESMRAnnivTimeValidator* NewL();
       
    54 
       
    55     /**
       
    56      * Destructor.
       
    57      */
       
    58     ~CESMRAnnivTimeValidator();
       
    59 
       
    60 public: // from MESMRFieldValidator
       
    61     MESMRFieldValidator::TESMRFieldValidatorError ValidateL(
       
    62             TBool aCorrectAutomatically );
       
    63     void ReadValuesFromEntryL(
       
    64             MESMRCalEntry& aEntry );
       
    65     void StoreValuesToEntryL(
       
    66             MESMRCalEntry& aEntry );
       
    67     void SetStartTimeFieldL(
       
    68             CEikTimeEditor& aStartTime );
       
    69     void SetEndTimeFieldL(
       
    70             CEikTimeEditor& aEndTime );
       
    71     void SetStartDateFieldL(
       
    72             CEikDateEditor& aStartDate );
       
    73     void SetEndDateFieldL(
       
    74             CEikDateEditor& aEndDate );
       
    75     void SetAlarmTimeFieldL(
       
    76             CEikTimeEditor& aAlarmTime );
       
    77     void SetAlarmDateFieldL(
       
    78             CEikDateEditor& aAlarmDate );
       
    79     void SetRecurrenceUntilDateFieldL(
       
    80             CEikDateEditor& aRecurrenceUntil );
       
    81     void SetAbsoluteAlarmOnOffFieldL( 
       
    82          MMRAbsoluteAlarmController& aAbsoluteAlarmController ); 
       
    83     void StartTimeChangedL();
       
    84     void EndTimeChangedL();
       
    85     void StartDateChandedL();
       
    86     void EndDateChangedL();
       
    87     void AlarmTimeChangedL();
       
    88     void AlarmDateChangedL();
       
    89     void RelativeAlarmChangedL(
       
    90             TTimeIntervalMinutes aCurrentAlarmTimeOffset,
       
    91             TBool aHandleAlarmChange,
       
    92             TBool& aRelativeAlarmValid );
       
    93     void SetAllDayEventL(
       
    94             TBool aAlldayEvent );
       
    95     void SetAlarmOnOffL(
       
    96             TBool aAlarmOn );
       
    97     void RecurrenceChangedL(
       
    98             TESMRRecurrenceValue aRecurrence );
       
    99     void RecurrenceEndDateChangedL();
       
   100     TBool IsRelativeAlarmValid(
       
   101             TTimeIntervalMinutes aAlarmTimeOffset );
       
   102 
       
   103 private: // Implementation
       
   104     CESMRAnnivTimeValidator();
       
   105     TInt PreValidateEditorContent();
       
   106     void PreValidateEditorContentL();
       
   107     void DrawEditorsDeferred();
       
   108     TDateTime StartTimeL();
       
   109     TDateTime AlarmTimeL();
       
   110     void ForceValuesL();
       
   111     TBool IsModifiedL( MESMRCalEntry& aEntry );
       
   112 
       
   113 private:
       
   114     /// Ref: Start date editor.
       
   115     CEikDateEditor* iStartDate;
       
   116     /// Ref: Alarm time editor
       
   117     CEikTimeEditor* iAlarmTime;
       
   118     /// Ref: Alarm date editor.
       
   119     CEikDateEditor* iAlarmDate;
       
   120     /// Own: Current anniversary date
       
   121     TTime iCurrentAnnivDate;
       
   122     /// Own: Current alarm time
       
   123     TTime iCurrentAlarmTime;
       
   124     /// Own: Flag for amarm on/off.
       
   125     TBool iAlarmOnOff;
       
   126     /// Ref: Entry being handled
       
   127     MESMRCalEntry* iEntry;
       
   128     /// Own: Saves initial alarm time, for later comparisons
       
   129     TTime iInitialAlarmTime;
       
   130     /// Own: Saves initial alarm date, for later comparisons
       
   131     TTime iInitialAlarmDate;
       
   132     /// Own: Saves initial alarm on off, for later comparisons
       
   133     TBool iInitialAlarmOnOff;
       
   134     /// Own: Saves initial due date, for later comparisons
       
   135     TTime iInitialStartDate;
       
   136     };
       
   137 
       
   138 #endif  // CESMRANNIVTIMEVALIDATOR_H