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