calendarui/commonutils/inc/calenentryutil.h
changeset 0 f979ecb2b13e
child 16 7bb9df301388
child 74 97232defd20e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   CalenEntryUtil stores data from edited Symbian CCalEntry
       
    15 *                to format that match Calendar Editors fields. Editor fields
       
    16 *                update CalenEntryUtil.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef CALENEDITORDATA_H
       
    22 #define CALENEDITORDATA_H
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 #include <caltime.h>
       
    27 #include "calennotedatautil.h"
       
    28 #include <calentry.h>
       
    29 
       
    30 
       
    31 /**
       
    32  * CCalenEntryUtil contains edited data in exactly same format that editor 
       
    33  * fields show them. For example, alarm time is represented as alarm time,
       
    34  * not as offset to entry start time, like CalInterimApi represents it. 
       
    35  * 
       
    36  * This class or CCalenEditorDataHandler encapsulates rules how this data is 
       
    37  * then read from and write to CalInterimApi CCalEntry.
       
    38  *
       
    39  *  @lib CalenDefaultEditors
       
    40  *  @since S60 v3.0
       
    41  */
       
    42 class CCalenEntryUtil : public CBase
       
    43     {
       
    44 public:
       
    45     enum TTodoPriority
       
    46         {
       
    47         ETodoPriorityHigh = 1,
       
    48         ETodoPriorityNormal = 2,
       
    49         ETodoPriorityLow = 3
       
    50         };
       
    51 
       
    52     enum TSynchType
       
    53         {
       
    54         ESynchPrivate = 0,
       
    55         ESynchPublic, 
       
    56         ESynchNoSync
       
    57         };
       
    58 
       
    59 public:
       
    60     IMPORT_C static CCalenEntryUtil* NewL( CCalEntry& aEntry, const TCalTime& aInstanceDateTime ); 
       
    61 
       
    62     virtual ~CCalenEntryUtil();
       
    63 
       
    64     // Getters
       
    65     IMPORT_C const TDesC& Summary() const;
       
    66     IMPORT_C const TDesC& Location() const;
       
    67     IMPORT_C const TDesC& Description() const;
       
    68 
       
    69     IMPORT_C const TTime& EventDateTime() const;
       
    70     IMPORT_C const TTime& StartDateTime() const;
       
    71     IMPORT_C const TTime& EndDateTime() const;
       
    72 
       
    73     IMPORT_C TBool IsAlarmActivated() const;
       
    74     IMPORT_C const TTime& AlarmDateTime() const;
       
    75 
       
    76 	IMPORT_C TBool IsAllDayEvent();
       
    77 
       
    78     IMPORT_C TCalenRepeatIndex RepeatType() const;
       
    79     IMPORT_C const TTime& RepeatUntilDateTime() const;
       
    80 
       
    81     IMPORT_C TTodoPriority Priority() const;
       
    82     IMPORT_C TSynchType SynchType() const;
       
    83     IMPORT_C TInt AttachmentCount() const;
       
    84     IMPORT_C CCalAttachment* AttachmentL(TInt aIndex) const;
       
    85 
       
    86     // Setters
       
    87     IMPORT_C void SetSummaryL( const TDesC& aSummary );
       
    88     IMPORT_C void SetLocationL( const TDesC& aLocation );
       
    89     IMPORT_C void SetDescriptionL( const TDesC& aDescription );
       
    90     /** 
       
    91      * Set description by passing in new description in HBufC. 
       
    92      * CCalenEntryUtil takes ownership of new description. This can
       
    93      * be used to save unnecessary copying when setting description
       
    94      * created by Notepad API:
       
    95      */
       
    96     IMPORT_C void SetDescriptionTransferOwnershipL( HBufC* aDescription );
       
    97 
       
    98     IMPORT_C void SetStartDateTimeL( const TTime& aStart );
       
    99     IMPORT_C void SetEndDateTimeL( const TTime& aEnd );
       
   100 
       
   101     IMPORT_C void SetEventDateL( const TTime& aDate );
       
   102 
       
   103     IMPORT_C void SetAlarmOnL( const TTime& aTime );
       
   104     IMPORT_C void SetAlarmOffL();
       
   105     IMPORT_C void SetAlarmDateTimeL( const TTime& aTime );
       
   106 
       
   107     IMPORT_C void SetNonRepeatingL();
       
   108     IMPORT_C void SetRepeatingL(TCalenRepeatIndex aRepeatType, const TTime& aUntilDateTime );
       
   109     IMPORT_C void SetRepeatUntilDateTimeL(const TTime& aTime); 
       
   110 
       
   111     IMPORT_C void SetPriorityL(TTodoPriority aPriority);
       
   112     IMPORT_C void SetSynchTypeL(TSynchType aSynchType);
       
   113     IMPORT_C void SetEntryType( CCalEntry::TType aEntryType );
       
   114     IMPORT_C void SetAttachmentCount(TInt aAttachmentCount);
       
   115 	/**
       
   116 	 * @brief set AllDay field value
       
   117 	 * @param aAllDayEvent
       
   118 	 */
       
   119 	IMPORT_C void SetAllDayEvent( TBool aAllDayEvent );
       
   120 
       
   121     // To get iEntryType
       
   122     IMPORT_C const CCalEntry::TType& EntryType() const;
       
   123     
       
   124     /*
       
   125     *To get iEntryStatus
       
   126     */
       
   127     IMPORT_C const CCalEntry::TStatus& Status() const;
       
   128 
       
   129     // Utility functions
       
   130     IMPORT_C TBool IsRepeating() const;
       
   131     
       
   132     /**
       
   133      * Return attachment names
       
   134      * 
       
   135      * @return HBufC 
       
   136      */
       
   137     IMPORT_C void AttachmentNamesL(RPointerArray<HBufC>& aAttachmentNames);
       
   138     
       
   139     /*
       
   140     * Allday event is an event  with a duration of n*24h.
       
   141     **/    
       
   142     IMPORT_C TBool CheckForAlldayEventL( TTime aStartTime, TTime aStopTime );
       
   143     
       
   144     /**
       
   145      * Return array of Rdates
       
   146      * 
       
   147      * @return RArray<TCalTime> 
       
   148      */
       
   149     IMPORT_C const RArray<TCalTime> GetRdatesL();
       
   150     
       
   151 private:
       
   152     CCalenEntryUtil( CCalEntry& aEntry );
       
   153 
       
   154     void ConstructL(CCalEntry& aEntry, const TCalTime& aInstanceDateTime );
       
   155 
       
   156     void CopyDataFromEntryL( CCalEntry& aEntry, const TCalTime& aInstanceDateTime );
       
   157     TSynchType CCalenEntryUtil::GetSynchTypeL(const CCalEntry& aEntry);
       
   158 
       
   159 private: // data
       
   160 
       
   161     /**
       
   162      * ?description_of_member
       
   163      */
       
   164     //?type ?member_name;
       
   165 
       
   166     /**
       
   167      * ?description_of_pointer_member
       
   168      * Own.  *** Write "Own" if this class owns the object pointed to; in
       
   169      other words, if this class is responsible for deleting it.
       
   170     */
       
   171     //?type* ?member_name;
       
   172 
       
   173     /**
       
   174      * ?description_of_pointer_member
       
   175      * Not own.  *** Write "Not own" if some other class owns this object.
       
   176      */
       
   177     //?type* ?member_name;
       
   178 
       
   179     /**
       
   180      * ?description_of_pointer_member
       
   181      * Own.
       
   182      */
       
   183     HBufC* iSummary;
       
   184 
       
   185     /**
       
   186      * ?description_of_pointer_member
       
   187      * Own.
       
   188      */
       
   189     HBufC* iLocation;
       
   190 
       
   191     /**
       
   192      * ?description_of_pointer_member
       
   193      * Own.
       
   194      */
       
   195     HBufC* iDescription;
       
   196 
       
   197     /**
       
   198      * ?description_of_member
       
   199      */
       
   200     TTime iStartDateTime;
       
   201 
       
   202     /**
       
   203      * ?description_of_member
       
   204      */
       
   205     TTime iEndDateTime;
       
   206 
       
   207     /**
       
   208      * ?description_of_member
       
   209      */
       
   210     TBool iIsAlarmActivated;
       
   211 
       
   212     /**
       
   213      * ?description_of_member
       
   214      */
       
   215 	TBool iIsAllDayEvent;
       
   216     TTime iAlarmDateTime;
       
   217 
       
   218     /**
       
   219      * ?description_of_member
       
   220      */
       
   221     TCalenRepeatIndex iRepeatType;
       
   222 
       
   223     /**
       
   224      * ?description_of_member
       
   225      */
       
   226     TTime iRepeatUntilDateTime;
       
   227 
       
   228     /**
       
   229      * ?description_of_member
       
   230      */
       
   231     TTodoPriority iPriority;
       
   232 
       
   233     /**
       
   234      * ?description_of_member
       
   235      */
       
   236     TSynchType iSynchType;
       
   237 
       
   238     /**
       
   239      * Tells what type of entry does editor data referring to (i.e. Anniv, ToDo).
       
   240      * Set at construction. Used in DataHandler to force the correctness
       
   241      * of fields. (i.e. The rules to force the correctness of alarm fields
       
   242      * vary based on entry type)
       
   243      */    
       
   244     CCalEntry::TType iEntryType;
       
   245     
       
   246     /**
       
   247      * Tells the status values of the entry.
       
   248      */     
       
   249     CCalEntry::TStatus iEntryStatus;
       
   250 
       
   251     /**
       
   252      * The identifier for editing entry or instance
       
   253      */
       
   254     CalCommon::TRecurrenceRange iRecurrenceType;
       
   255     
       
   256     CCalEntry& iEntry;
       
   257     
       
   258     TInt iAttachmentCount;
       
   259     };
       
   260 
       
   261 #endif // CALENEDITORDATA_H