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