pimappservices/calendar/shared/inc/agmsimpleentry.h
changeset 0 f979ecb2b13e
child 29 12af337248b1
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __AGMSIMPLEENTRY_H__
       
    17 #define __AGMSIMPLEENTRY_H__
       
    18 
       
    19 #include "agmids.h"
       
    20 #include "calentry.h"
       
    21 
       
    22 class CAgnRptDef;
       
    23 class CAgnSimpleEntryAllocator;
       
    24 
       
    25 /** The maximum possible alarm offset is a constant which means there is no alarm. */
       
    26 const TInt32 KAlarmNotSet = KMaxTInt32;
       
    27 
       
    28 NONSHARABLE_CLASS(CAgnSimpleEntry) : public CBase
       
    29 /** Base class for agenda entry types.
       
    30 
       
    31 It provides an interface to the following entry attributes:
       
    32 - type
       
    33 - repeat information
       
    34 - entry id
       
    35 - last changed date
       
    36 - alarm time
       
    37 - priority
       
    38 - status
       
    39 - start and end time
       
    40 
       
    41 CAgnSimpleEntry is the base class for the full entry CAgnEntry.
       
    42 
       
    43 On the client side, CAgnSimpleEntry is used as the 'light entry' which is stored in an 
       
    44 instance. Calling FindInstanceL will return CCalInstances. Each of these CCalInstances will 
       
    45 reference a 'light entry', which is a CAgnSimpleEntry. If a function is called on the instance 
       
    46 which cannot be handled by CAgnSimpleEntry, the full CAgnEntry will be loaded.
       
    47 
       
    48 On the server side, CAgnSimpleEntry is used in the entry index - CAgnIndex.
       
    49 There is one main index of CAgnSimpleEntrys, other indexes contain pointers to simple entries in that
       
    50 index.
       
    51 
       
    52 @internalComponent
       
    53 @released
       
    54 */
       
    55 	{
       
    56 public:
       
    57 	IMPORT_C CCalEntry::TType Type() const;
       
    58 
       
    59 	// time
       
    60 	IMPORT_C void SetStartAndEndTimeL(const TAgnCalendarTime& aStartTime, const TAgnCalendarTime& aEndTime);
       
    61 	IMPORT_C const TAgnCalendarTime& StartTime() const;
       
    62 	IMPORT_C const TAgnCalendarTime& EndTime() const;
       
    63 	IMPORT_C const TAgnCalendarTime& EntryTime() const; // returns start time for non-todos, end (due) time for todos
       
    64 	
       
    65 	IMPORT_C TBool MoveStartTimeLocalL(const TTime& aNewStartTimeLocal);
       
    66 	IMPORT_C void AdjustStartUntilTimeForRepEntryL();
       
    67 	
       
    68 	IMPORT_C MAgnCalendarTimeMode::TTimeMode TimeMode() const;
       
    69 
       
    70 	// alarm date/time
       
    71 	IMPORT_C TBool HasAlarm() const;
       
    72 	IMPORT_C void SetAlarmOffset(const TTimeIntervalMinutes& aStartTimeOffset);
       
    73 	IMPORT_C TTimeIntervalMinutes AlarmOffset() const;
       
    74 
       
    75 	// ids
       
    76 	IMPORT_C const TAgnEntryId& EntryId() const;
       
    77 	IMPORT_C void SetEntryId(const TAgnEntryId& aId);
       
    78 	IMPORT_C TCalLocalUid LocalUid() const;	
       
    79 	IMPORT_C void SetLocalUid(TCalLocalUid aUId);
       
    80 	IMPORT_C TUint32 GuidHash() const;	
       
    81 	IMPORT_C void SetGuidHash(TUint32 aGuidHash);	
       
    82 	
       
    83 	// repeat rule
       
    84 	IMPORT_C void SetRptDefL(const CAgnRptDef& aRptDef);
       
    85 	IMPORT_C void ClearRepeat();
       
    86 	IMPORT_C CAgnRptDef* RptDef();
       
    87 	IMPORT_C const CAgnRptDef* RptDef() const;
       
    88 
       
    89 	// status
       
    90 	IMPORT_C void SetStatus(CCalEntry::TStatus aStatus);
       
    91 	IMPORT_C CCalEntry::TStatus Status() const;
       
    92 
       
    93 	// last changed date
       
    94 	IMPORT_C void SetLastModifiedDate();
       
    95 	IMPORT_C void SetLastModifiedDateUtc(const TTime& aLastChangedDateUtc);
       
    96 	IMPORT_C const TTime& LastModifiedDateUtc() const;
       
    97 	
       
    98 	// priority
       
    99 	IMPORT_C void SetPriority(TUint8 aPriority);
       
   100 	IMPORT_C TUint8 Priority() const;
       
   101 	
       
   102 	// crossed out date - todos only
       
   103 	IMPORT_C const TTime& CompletedDateUtc() const;
       
   104 	IMPORT_C void SetCompletedDateUtcL(const TTime& aDateUtc);
       
   105 	IMPORT_C void SetIncomplete();
       
   106 
       
   107 	// used for extraction
       
   108 	IMPORT_C TTime ValidFromTimeLocalL() const;
       
   109 	IMPORT_C TTime ValidToTimeLocalL() const;
       
   110 	IMPORT_C TTime DurationPlusL(const TTime& aTime) const;
       
   111 	IMPORT_C TTime DurationMinusL(const TTime& aTime) const;
       
   112 	
       
   113 	// non-exported
       
   114 	void CopySimpleEntryL(const CAgnSimpleEntry& aSimpleEntry, CCalEntry::TCopyType aCopyType);
       
   115 	
       
   116 	IMPORT_C virtual void ExternalizeL(RWriteStream& aStream, TBool aToBuffer=EFalse) const;
       
   117 	IMPORT_C virtual void InternalizeL(RReadStream& aStream, TBool aFromBuffer=EFalse);
       
   118 
       
   119 	void doExternalizeL(RWriteStream& aStream, TBool aToBuffer) const;
       
   120 	void doInternalizeL(RReadStream& aStream, TBool aFromBuffer);
       
   121 	
       
   122 	TBool operator == (const CAgnSimpleEntry& aSimpleEntry) const;
       
   123 	
       
   124 	// We only need to internalize/externalize the GuidHash for the
       
   125 	// persistent index file so it's separate from the other
       
   126 	// internalize/externalize methods.
       
   127 	IMPORT_C void InternalizeGuidHashL(RReadStream& aReadStream);
       
   128 	IMPORT_C void ExternalizeGuidHashL(RWriteStream& aWriteStream) const;
       
   129 	IMPORT_C void SetCollectionId(TCalCollectionId aFileId);
       
   130 	IMPORT_C TCalCollectionId CollectionId()const;
       
   131 	
       
   132 	// User integer.
       
   133 	IMPORT_C void SetUserInt( TUint32 aUserInt );
       
   134 	IMPORT_C TUint32 UserInt() const;
       
   135 
       
   136 protected:
       
   137 
       
   138 	friend class CAgnSimpleEntryAllocator;
       
   139 
       
   140 	// set constructor and destructor protected because only the CAgnSimpleEntryAllocator
       
   141 	// can create or destroy CAgnSimpleEntry objects
       
   142 
       
   143 	CAgnSimpleEntry(CCalEntry::TType aType);
       
   144 	virtual ~CAgnSimpleEntry();
       
   145 	
       
   146 	// overload new operator to allocate CAgnSimpleEntry object with CAgnSimpleEntryAllocator
       
   147 	
       
   148 	TAny* operator new(TUint aSize, TLeave aType, CAgnSimpleEntryAllocator* aAllocator);
       
   149 	
       
   150 	void StartTimeChanged();
       
   151 
       
   152 private:
       
   153 	CAgnRptDef* 		iRptDef;		// contains the repeat definition plus exceptions
       
   154 	TAgnEntryId 		iEntryId;		// the entry Id
       
   155 	TCalLocalUid		iLocalUid;		// the unique Id
       
   156 	TUint32				iGuidHash;		// the hash of Guid
       
   157 	TAgnCalendarTime 	iStartTime;
       
   158 	TAgnCalendarTime 	iEndTime;
       
   159 	TTime 				iLastModifiedDateUtc;
       
   160 	TTime				iCompletedDateUtc; // todos only
       
   161 	TInt32				iAlarmOffset;
       
   162 	TUint8				iType;
       
   163 	TUint8				iPriority;
       
   164 	TUint8				iStatus;
       
   165 	TUint8				iReserved;		// This exists whether declared or not because of the 4-byte memory boundaries
       
   166 	TCalCollectionId	iCollectionId;
       
   167 
       
   168 	TUint32             iUserInt; //the field has been moved to simple entry since PREQ2049
       
   169 	};
       
   170 
       
   171 #endif