calendarui/editors/inc/CalenEntryUpdater.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002 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:  ?Description
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CALENEDITEDENTRY_H__
       
    20 #define __CALENEDITEDENTRY_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <calcommon.h>
       
    24 #include <calprogresscallback.h>
       
    25 #include <caleninstanceid.h>
       
    26 
       
    27 class CCalEntry;
       
    28 class CCalInstance;
       
    29 class TCalTime;
       
    30 class TCalRRule;
       
    31 class CCalEntryView;
       
    32 class CCalInstanceView;
       
    33 class MCalenServices;
       
    34 
       
    35 /**
       
    36  * CCalenEntryUpdater provides method to store, update and delete 
       
    37  * whole entry or single instance for Calendar editors.
       
    38  */ 
       
    39 NONSHARABLE_CLASS( CCalenEntryUpdater ) : 
       
    40     public CBase
       
    41     {
       
    42 public: // constructors and destructors
       
    43     static CCalenEntryUpdater* NewL( MCalenServices& aServices ,RArray<TInt>& aCollectionIds);
       
    44     
       
    45     /**
       
    46      * @brief destructors
       
    47      */
       
    48     virtual ~CCalenEntryUpdater();
       
    49 
       
    50 public: // Own methods
       
    51     
       
    52     /**
       
    53      * @brief to update entry with new values
       
    54      */
       
    55     void UpdateInstanceL( CCalEntry& aEditedEntry,
       
    56                           CCalEntry& aOrigEntry,
       
    57                           const TCalTime& aOrigInstanceDate,
       
    58                           CalCommon::TRecurrenceRange aWhichInstances,
       
    59                           const TCalTime& aNewInstanceStartDate,
       
    60                           const TCalTime& aNewInstanceEndDate,
       
    61                           const TDesC& aFileName );
       
    62 
       
    63     /**
       
    64      * @brief To delete the entry
       
    65      * @param aEntry, to be deleted
       
    66      * @param aInstanceId
       
    67      */
       
    68     void DeleteEntryL( CCalEntry& aEntry, TCalenInstanceId aInstanceId );
       
    69     
       
    70     /**
       
    71      * @brief To delete the instance
       
    72      * @param aEntry
       
    73      * @param aInstanceId
       
    74      */    
       
    75     void DeleteInstanceL( CCalEntry& aEntry, TCalenInstanceId aInstanceId );
       
    76 
       
    77     /**
       
    78      * @brief Attempt to delete the entry, using CCalenCommonUI to prompt the 
       
    79      *        user whether to delete the entire series or just the instance.
       
    80      * @param aEntry
       
    81      * @param aInstanceDate
       
    82      * @param aServices
       
    83      */
       
    84     void TryDeleteInstanceWithUiL( CCalEntry& aEntry, 
       
    85                                                const TCalTime& aInstanceDate,
       
    86                                                MCalenServices& aServices );
       
    87     
       
    88     /**
       
    89      * @brief Attempt to delete the entry, using CCalenCommonUI. Only delete 
       
    90      *        the entry using the repeat type defined in aRepeatType.
       
    91      * @param aEntry 
       
    92      * @param aInstanceDate
       
    93      * @param aRepeatType
       
    94      * @param aServices       
       
    95      */
       
    96     void TryDeleteInstanceWithUiL( CCalEntry& aEntry,
       
    97                                     const TCalTime& aInstanceDate,
       
    98                                     CalCommon::TRecurrenceRange aRepeatType,
       
    99                                     MCalenServices& aServices );
       
   100 
       
   101 private: 
       
   102     
       
   103     /**
       
   104      * @brief To find the instance of the entry
       
   105      * @return The index into aInstances of the instance with the same 
       
   106      *         UID as aEntry, at the same date/time as aInstanceDate, or return
       
   107      *         KErrNotFound if no match found.
       
   108      * @param aEntry 
       
   109      * @param aInstanceDate, of the entry instance
       
   110      * @param aInstances, Array of instances of the entry        
       
   111      */
       
   112     TInt FindInstanceL( CCalEntry& aEntry,
       
   113                         const TCalTime& aInstanceDate, 
       
   114                         RPointerArray<CCalInstance>& aInstances);
       
   115     
       
   116     /**
       
   117      * @brief Updates the RDates and Exception dates of the given entry.
       
   118      * @param aEditedEntry
       
   119      * @param aOrigEntry to which new RDates and Exception dates should updated
       
   120      * @param aOrigInstanceDate
       
   121      */
       
   122     void UpdateRDatesL( CCalEntry& aEditedEntry, CCalEntry& aOrigEntry,
       
   123                         const TCalTime& aOrigInstanceDate );
       
   124     
       
   125     /**
       
   126      * @brief Compares two rrules for differences
       
   127      * @param aEditedRule
       
   128      * @param aOrigRule
       
   129      */
       
   130     TBool TypeOrIntervalChangedL( const TCalRRule& aEditedRule, 
       
   131                                   const TCalRRule& aOrigRule ) const;
       
   132     
       
   133     /**
       
   134      * @brief If aHasRepeatType is ETrue, use aRepeatType to determine whether to 
       
   135      *        delete the entire series or just the instance. If aHasRepeatType is
       
   136      *        EFalse, aRepeatType is ignored and the user is prompted to choose.
       
   137      */
       
   138     void DoTryDeleteInstanceWithUiL( CCalEntry& aEntry,
       
   139                                       const TCalTime& aInstanceDate,
       
   140                                       TBool aHasRepeatType,
       
   141                                       CalCommon::TRecurrenceRange aRepeatType,
       
   142                                       MCalenServices& aServices );
       
   143                                       
       
   144     CCalEntryView&  EntryViewL(TInt colId = -1);
       
   145     
       
   146     /**
       
   147      * @brief Get CalInstanceView from services 
       
   148      */
       
   149     CCalInstanceView&  InstanceViewL();
       
   150 
       
   151 private: // constructors
       
   152     /**
       
   153      * @brief default constructor
       
   154      */
       
   155     CCalenEntryUpdater( MCalenServices& aServices , RArray<TInt>& aCollectionIds);
       
   156     
       
   157     /**
       
   158      * @brief Two-phase constructor
       
   159      */
       
   160     void ConstructL(); 
       
   161     
       
   162 private: // data
       
   163     
       
   164     /**
       
   165      * @var iServices
       
   166      * @brief referance to MCalenServices
       
   167      */
       
   168     MCalenServices& iServices; // Not owned, don't release here.
       
   169     
       
   170     /*
       
   171      * @var collection id referance from unified editor
       
   172      */
       
   173     RArray<TInt>& iCollectionIds;
       
   174     };
       
   175 
       
   176 #endif // __CALENEDITEDENTRY_H__
       
   177 
       
   178 // End of File