meetingrequest/mrgui/inc/mesmrfieldvalidator.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 interface for time/date validation implemenatation
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MESMRFIELDVALIDATOR_H
       
    20 #define MESMRFIELDVALIDATOR_H
       
    21 
       
    22 //<cmail>
       
    23 #include "esmrdef.h"
       
    24 //</cmail>
       
    25 
       
    26 class MESMRCalEntry;
       
    27 class CEikTimeEditor;
       
    28 class CEikDateEditor;
       
    29 class MESMRFieldEventQueue;
       
    30 class MMRAbsoluteAlarmController;
       
    31 
       
    32 /**
       
    33  * MESMRFieldValidator defines interface for field validation.
       
    34  * Validators check input values and adjust field values to
       
    35  * correctly.
       
    36  *
       
    37  * MESMRFieldValidator is base class for all concrete validators.
       
    38  */
       
    39 class MESMRFieldValidator
       
    40     {
       
    41 public:
       
    42 
       
    43     /**
       
    44      * Enumeration for validator error types
       
    45      */
       
    46     enum TESMRFieldValidatorError
       
    47         {
       
    48         /** No validation errors */
       
    49         EErrorNone = 0,
       
    50         /** Entry ends earlier than starts */
       
    51         EErrorEndEarlierThanStart,
       
    52         /** Entry is recurrent and has differend start and end dates */
       
    53         EErrorRecDifferetStartAndEnd,
       
    54         /** Recurrence until is earlier than first instance start time */
       
    55         EErrorRecUntilEarlierThanStart,
       
    56         /** Alarm is later that entry starts */
       
    57         EErrorAlarmLaterThanStart,
       
    58         /** Alarm occurs in past */
       
    59         EErrorAlarmInPast,
       
    60         /** Alarm occurs too much in past*/
       
    61         EErrorAlarmTooMuchInPast,
       
    62         /** Relative alarm occurs in past */
       
    63         EErrorRelativeAlarmInPast,
       
    64         /** Reschedule instance to same day with another instance */
       
    65         EErrorRescheduleInstance,
       
    66         /** The errors be used to validate the time of one edited intance of seires*/
       
    67         EErrorInstanceOverlapsExistingOne,
       
    68         EErrorInstanceAlreadyExistsOnThisDay,
       
    69         EErrorInstanceOutOfSequence
       
    70         };
       
    71 
       
    72 public:
       
    73     /**
       
    74      * Virtual destructor.
       
    75      */
       
    76     virtual ~MESMRFieldValidator( ) { }
       
    77 
       
    78     /**
       
    79      * Validate entered values. Returns validation eror code.
       
    80      * Parameter aCorrectAutomatically defines, if validator
       
    81      * adjusts field so that no validation errors occur.
       
    82      *
       
    83      * @param aCorrectAutomatically If ETrue, fields are adjusted
       
    84      *                              automatically.
       
    85      * @return Validation error code.
       
    86      */
       
    87     virtual TESMRFieldValidatorError ValidateL(
       
    88             TBool aCorrectAutomatically ) = 0;
       
    89 
       
    90     /**
       
    91      * Read values to entry and stores them to fields.
       
    92      * @param aEntry Reference to entry.
       
    93      */
       
    94     virtual void ReadValuesFromEntryL(
       
    95             MESMRCalEntry& aEntry ) = 0;
       
    96 
       
    97     /**
       
    98      * Store values to entry.
       
    99      * @param aEntry Reference to entry.
       
   100      */
       
   101     virtual void StoreValuesToEntryL(
       
   102             MESMRCalEntry& aEntry ) = 0;
       
   103 
       
   104     /**
       
   105      * Sets start time field.
       
   106      * @param aStartTime Reference to start time field.
       
   107      */
       
   108     virtual void SetStartTimeFieldL(
       
   109             CEikTimeEditor& aStartTime ) = 0;
       
   110 
       
   111     /**
       
   112      * Sets end time field.
       
   113      * @param aEndTime Reference to end time field.
       
   114      */
       
   115     virtual void SetEndTimeFieldL(
       
   116             CEikTimeEditor& aEndTime ) = 0;
       
   117 
       
   118     /**
       
   119      * Sets start time field.
       
   120      * @param aStartDate Reference to start date field.
       
   121      */
       
   122     virtual void SetStartDateFieldL(
       
   123             CEikDateEditor& aStartDate ) = 0;
       
   124 
       
   125     /**
       
   126      * Sets end time field.
       
   127      * @param aEndDate Reference to end date field.
       
   128      */
       
   129     virtual void SetEndDateFieldL(
       
   130             CEikDateEditor& aEndDate ) = 0;
       
   131 
       
   132     /**
       
   133      * Sets alarm time field.
       
   134      * @param aAlarmTime Reference to alarm time field.
       
   135      */
       
   136     virtual void SetAlarmTimeFieldL(
       
   137             CEikTimeEditor& aAlarmTime ) = 0;
       
   138 
       
   139     /**
       
   140      * Sets alarm date field.
       
   141      * @param aAlarmDate Reference to alarm date field.
       
   142      */
       
   143     virtual void SetAlarmDateFieldL(
       
   144             CEikDateEditor& aAlarmDate ) = 0;
       
   145 
       
   146     /**
       
   147      * Sets absolute alarm on off field.
       
   148      * @param aAbsoluteAlarmOnOff Reference to interface to handle absolute 
       
   149      * alarm on-off setting.
       
   150      */
       
   151     virtual void SetAbsoluteAlarmOnOffFieldL( 
       
   152             MMRAbsoluteAlarmController& aAbsoluteAlarmController ) = 0;
       
   153     
       
   154     /**
       
   155      * Sets alarm date field.
       
   156      * @param aAlarmDate Reference to alarm date field.
       
   157      */
       
   158     virtual void SetRecurrenceUntilDateFieldL(
       
   159             CEikDateEditor& aRecurrenceUntil ) = 0;
       
   160 
       
   161     /**
       
   162      * Triggers start time change.
       
   163      */
       
   164     virtual void StartTimeChangedL() = 0;
       
   165 
       
   166     /**
       
   167      * Triggers end time change.
       
   168      */
       
   169     virtual void EndTimeChangedL() = 0;
       
   170 
       
   171     /**
       
   172      * Triggers start date change.
       
   173      */
       
   174     virtual void StartDateChandedL() = 0;
       
   175 
       
   176     /**
       
   177      * Triggers end date change.
       
   178      */
       
   179     virtual void EndDateChangedL() = 0;
       
   180 
       
   181     /**
       
   182      * Triggers alarm time change.
       
   183      */
       
   184     virtual void AlarmTimeChangedL() = 0;
       
   185 
       
   186     /**
       
   187      * Triggers alarm date change.
       
   188      */
       
   189     virtual void AlarmDateChangedL() = 0;
       
   190 
       
   191     /**
       
   192      * Triggers relative alarm change.
       
   193      * When values are forced in meeting validator, alarmfields
       
   194      * Externalize method needs to know if relative alarm is valid.
       
   195      * If aRelativeAlarmValid != ETrue, then alarm is considered
       
   196      * to be unvalid, and is set off (in CESMRAlarmField::ExternalizeL)
       
   197      *
       
   198      * @param aCurrentAlarmTimeOffset current alarm time offset
       
   199      * @param aRelativeAlarmValid for alarm validity check
       
   200      */
       
   201     virtual void RelativeAlarmChangedL(
       
   202             TTimeIntervalMinutes aCurrentAlarmTimeOffset,
       
   203             TBool aHandleAlarmChange,
       
   204             TBool& aRelativeAlarmValid ) = 0;
       
   205 
       
   206     /**
       
   207      * Set 'all day' flag for validator.
       
   208      */
       
   209     virtual void SetAllDayEventL(
       
   210             TBool aAlldayEvent ) = 0;
       
   211 
       
   212     /**
       
   213      * Set 'alarm' flag for validator.
       
   214      * @param aAlarmOn Alarm on/off
       
   215      */
       
   216     virtual void SetAlarmOnOffL(
       
   217             TBool aAlarmOn ) = 0;
       
   218 
       
   219     /**
       
   220      * Triggers recurrence change.
       
   221      * @param aRecurrence new recurrence value
       
   222      */
       
   223     virtual void RecurrenceChangedL(
       
   224             TESMRRecurrenceValue aRecurrence ) = 0;
       
   225 
       
   226     /**
       
   227      * Triggers end date change.
       
   228      */
       
   229     virtual void RecurrenceEndDateChangedL() = 0;
       
   230 
       
   231     /**
       
   232      * Checks if relative alarm is valid
       
   233      * @param aAlarmTimeOffset Alarm time offset
       
   234      */
       
   235     virtual TBool IsRelativeAlarmValid(
       
   236             TTimeIntervalMinutes aAlarmTimeOffset ) = 0;
       
   237 
       
   238     /**
       
   239      * Sets field event queue for validator.
       
   240      * Validator can send field events to event observers using the
       
   241      * event queue.
       
   242      * 
       
   243      * @param aEventQueue the event queue.
       
   244      */
       
   245     virtual void SetFieldEventQueue( MESMRFieldEventQueue* /*aEventQueue*/ ) {}
       
   246     };
       
   247 
       
   248 #endif  // MESMRFIELDVALIDATOR_H
       
   249 
       
   250 // EOF
       
   251 
       
   252