meetingrequest/mrservices/inc/cesmrrecurrenceinfohandler.h
changeset 0 8466d47a6819
child 16 4ce476e64c59
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007-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 service policy checker
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CESMRRECURRENCEINFOHANDLER_H
       
    20 #define CESMRRECURRENCEINFOHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 //<cmail>
       
    24 #include "esmrdef.h"
       
    25 //</cmail>
       
    26 #include <caltime.h>
       
    27 
       
    28 class CCalEntry;
       
    29 class TCalRRule;
       
    30 
       
    31 /**
       
    32  *  CESMRRecurrenceInfoHandler is responsible for handling recurrence related
       
    33  *  issues.
       
    34  *
       
    35  *  @lib esmrservices.lib
       
    36  */
       
    37 NONSHARABLE_CLASS(CESMRRecurrenceInfoHandler) :
       
    38         public CBase
       
    39     {
       
    40 public: // Construction and destruction
       
    41     /**
       
    42      * Two-phased constructor. Creates and initializes
       
    43      * CESMRRecurrenceInfoHandler object. Ownership transferred to caller.
       
    44      *
       
    45      * @param aEntry Reference to calendar entry.
       
    46      * @return Pointer to esmr recurrence handler object.
       
    47      */
       
    48     IMPORT_C static CESMRRecurrenceInfoHandler* NewL(
       
    49             CCalEntry& aEntry );
       
    50 
       
    51     /**
       
    52      * Two-phased constructor. Creates and initializes
       
    53      * CESMRRecurrenceInfoHandler object. Ownership transferred to caller.
       
    54      * Created object is left to cleanup stack.
       
    55      *
       
    56      * @param aEntry Reference to calendar entry.
       
    57      * @return Pointer to esmr recurrence handler object.
       
    58      */
       
    59     IMPORT_C static CESMRRecurrenceInfoHandler* NewLC(
       
    60             CCalEntry& aEntry );
       
    61 
       
    62     /**
       
    63      * C++ Destructor.
       
    64      */
       
    65     IMPORT_C ~CESMRRecurrenceInfoHandler();
       
    66 
       
    67 public: // Interface
       
    68 
       
    69     /**
       
    70      * Sets recurrence to ES MR entry. If until time is not set
       
    71      * (i.e, it is null time), then until time is implementation
       
    72      * dependent.
       
    73      *
       
    74      * When recurrence is set to ERecurrenceNot, then aUntil parameter
       
    75      * is ignored.
       
    76      *
       
    77      * @param aRecurrece Recurrece value.
       
    78      * @param aUntil Recurrence valid until in UTC format.
       
    79      */
       
    80     IMPORT_C void SetRecurrenceL(
       
    81             TESMRRecurrenceValue aRecurrence,
       
    82             TTime aUntil );
       
    83 
       
    84     /**
       
    85      * Fetches entry's recurrence value.
       
    86      *
       
    87      * @param aRecurrence On return contains entry's recurrence information
       
    88      * @param aUntil On return contains time in UTC until recurrence is valid.
       
    89      */
       
    90     IMPORT_C void GetRecurrenceL(
       
    91             TESMRRecurrenceValue& aRecurrence,
       
    92             TTime& aUntil) const;
       
    93 
       
    94     /**
       
    95      * Removes instance from series.
       
    96      * @param aInstanceTime Instance to be removed
       
    97      */
       
    98     IMPORT_C void RemoveInstanceL(
       
    99             TCalTime aInstanceTime );
       
   100 
       
   101     /**
       
   102      * Removes calendar instance from entry.
       
   103      * @param aNewInstanceTime New instance time
       
   104      * @param aOrginalInstanceTime Orginal instance time
       
   105      */
       
   106     IMPORT_C void AddExceptionL(
       
   107              TCalTime aNewInstanceTime,
       
   108              TCalTime aOrginalInstanceTime );
       
   109 
       
   110     /**
       
   111      * Copies recurrence information to entry given as parameter.
       
   112      * @param aDestination Reference to destination calendar entry
       
   113      */
       
   114     IMPORT_C void CopyRecurrenceInformationToL(
       
   115             CCalEntry& aDestination );
       
   116 
       
   117     /**
       
   118      * Copies recurrence information from entry given as parameter.
       
   119      * @param aSource Reference to source calendar entry
       
   120      */
       
   121     IMPORT_C void CopyRecurrenceInformationFromL(
       
   122             const CCalEntry& aSource );
       
   123 
       
   124     /**
       
   125      * Gets first instances start and end time.
       
   126      * @param aStart Reference to start time.
       
   127      * @param aEnd Reference to end time.
       
   128      */
       
   129     IMPORT_C void GetFirstInstanceTimeL(
       
   130             TCalTime& aStart,
       
   131             TCalTime& aEnd );
       
   132 
       
   133 private: // Implementation
       
   134     CESMRRecurrenceInfoHandler(
       
   135             CCalEntry& aEntry );
       
   136     void ConstructL();
       
   137 
       
   138     void CalculateRecurrenceUntilDateL(
       
   139             TESMRRecurrenceValue aRecurrenceType,
       
   140             TTime& aUntil,
       
   141             TCalRRule& aRule,
       
   142             const CCalEntry& aEntry  ) const;
       
   143 
       
   144     void HandleDailyRecurrenceL(
       
   145             TESMRRecurrenceValue& aRecurrenceValue,
       
   146             TCalRRule& aRule ) const;
       
   147 
       
   148     void HandleWeeklyRecurrenceL(
       
   149             TESMRRecurrenceValue& aRecurrenceValue,
       
   150             TCalRRule& aRule ) const;
       
   151 
       
   152     void HandleMonthlyRecurrenceL(
       
   153             TESMRRecurrenceValue& aRecurrenceValue,
       
   154             TCalRRule& aRule ) const;
       
   155 
       
   156     void HandleYearlyRecurrenceL(
       
   157             TESMRRecurrenceValue& aRecurrenceValue,
       
   158             TCalRRule& aRule ) const;
       
   159 
       
   160     TBool NeedToSetRecurrenceL(
       
   161             TESMRRecurrenceValue aRecurrence,
       
   162             TTime aUntil ) const;
       
   163 
       
   164 
       
   165 private:
       
   166     /// Ref: Reference to meeting request entry
       
   167     CCalEntry& iEntry;
       
   168     };
       
   169 
       
   170 #endif // CESMRRECURRENCEINFOHANDLER_H
       
   171 
       
   172 // EOF