pimappservices/calendar/client/inc/calentryimpl.h
changeset 0 f979ecb2b13e
child 74 97232defd20e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 2005-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 __CALENTRYIMPL_H__
       
    17 #define __CALENTRYIMPL_H__
       
    18 
       
    19 #include "calentry.h"
       
    20 #include "agmids.h"
       
    21 
       
    22 class CAgnContent;
       
    23 class CAgnEntry;
       
    24 class CAgnRptDef;
       
    25 class CAgnSimpleEntry;
       
    26 class CCalLiteEntry;
       
    27 class CCalSession;
       
    28 class CCalSessionImpl;
       
    29 class TAgnAlarmInfo;
       
    30 class TAgnRpt;
       
    31 class TCalRRule;
       
    32 class RAgendaServ;
       
    33 /** Implementation class for a CCalEntry.
       
    34 @internalComponent
       
    35 */
       
    36 NONSHARABLE_CLASS(CCalEntryImpl) : public CBase
       
    37 	{
       
    38 public:
       
    39 	static CCalEntryImpl* NewL(CCalEntry::TType aType, HBufC8* aUid, CCalEntry::TMethod aMethod, TUint aSeqNum, const TCalTime& aRecurrenceId, CalCommon::TRecurrenceRange aRange);
       
    40 	static CCalEntryImpl* NewL(CCalEntry::TType aType, HBufC8* aUid, CCalEntry::TMethod aMethod, TUint aSeqNum);
       
    41 	static CCalEntryImpl* NewL(CAgnEntry& aEntry, CCalSessionImpl& aSessionImpl); // takes ownership of aEntry
       
    42 	static CCalEntryImpl* NewL(CCalLiteEntry& aEntry, CCalSessionImpl& aSessionImpl);
       
    43 	~CCalEntryImpl();
       
    44 	
       
    45 	void AddAttendeeL(CCalAttendee* aAttendee);
       
    46 	RPointerArray<CCalAttendee>& AttendeesL();
       
    47 	void DeleteAttendeeL(TInt aIndex);
       
    48 	void SetOrganizerL(CCalUser* aAttendee);
       
    49 	
       
    50 	void SetPhoneOwnerL(const CCalUser* aOwner);
       
    51 	CCalUser* OrganizerL();
       
    52 	CCalUser* PhoneOwnerL();	
       
    53 	
       
    54 	void SetAlarmSoundNameL(const TDesC& aAlarmSoundName);
       
    55 	CTzRules* GetTzRulesL();
       
    56 	void SetTzRulesL(const CTzRules& aTzRules);
       
    57 	void SetTzRulesL();
       
    58 		
       
    59 	void SetRDatesL(const RArray<TCalTime>& aRDates);
       
    60 	void GetRDatesL(RArray<TCalTime>& aRDates);
       
    61 	
       
    62 	void SetExceptionDatesL(const RArray<TCalTime>& aExDates);
       
    63 	void GetExceptionDatesL(RArray<TCalTime>& aExDates);
       
    64 
       
    65 	const RPointerArray<CCalCategory>& CategoryListL();
       
    66 	void AddCategoryL(CCalCategory* aCategory);
       
    67 	void DeleteCategoryL(TInt aIndex);
       
    68 	
       
    69 	TCalTime RecurrenceIdL();
       
    70 	CalCommon::TRecurrenceRange RecurrenceRangeL();
       
    71 	
       
    72 	void SetMethodL(CCalEntry::TMethod aMethod);
       
    73 	
       
    74 	TCalTime StartTimeL();
       
    75 	TCalTime EndTimeL();
       
    76 	void SetStartAndEndTimeL(const TCalTime& aStartTime, const TCalTime& aEndTime);
       
    77 	
       
    78 	TCalTime LastModifiedDateL();
       
    79 	
       
    80 	TCalTime DTStampL();
       
    81 	
       
    82 	TCalTime CompletedTimeL();
       
    83 	void SetCompletedL(TBool aCompleted, const TCalTime& aTime);
       
    84 
       
    85 	void SetRRuleL(const TCalRRule& aRule);
       
    86 	TBool GetRRuleL(TCalRRule& aRule); 
       
    87 	
       
    88 	TCalTime NextInstanceForLocalUIDL(const TCalTime& aTime);
       
    89 	TCalTime PreviousInstanceForLocalUIDL(const TCalTime& aTime);
       
    90 
       
    91 	void ClearRepeatingPropertiesL();
       
    92 
       
    93 	void SetAlarmL(CCalAlarm* aAlarm); 
       
    94 	CCalAlarm* AlarmL();
       
    95 
       
    96 	CCalEntry::TType EntryTypeL();
       
    97 	void SetStatusL(CCalEntry::TStatus aStatus);
       
    98 	CCalEntry::TStatus StatusL();
       
    99 
       
   100 	void SetReplicationStatusL(CCalEntry::TReplicationStatus aReplicationStatus);
       
   101 	CCalEntry::TReplicationStatus ReplicationStatusL();
       
   102 
       
   103 	void SetPriorityL(TUint aPriority);
       
   104 	TUint PriorityL();
       
   105 
       
   106 	TBool CompareL(const CCalEntry& aEntry);
       
   107 
       
   108 	void PopulateAttachmentListL();
       
   109 	void AddAttachmentL(CCalAttachment* aAttachment); // takes ownership
       
   110 	void DeleteAttachmentL(const CCalAttachment& aAttachment);
       
   111 	CCalAttachment* AttachmentL(TInt aIndex);
       
   112 	TInt AttachmentCountL();
       
   113 	
       
   114 	void SetSummaryL(const TDesC& aSummary);
       
   115 	const TDesC& SummaryL();
       
   116 	void SetDescriptionL(const TDesC& aDescription);
       
   117 	const TDesC& DescriptionL(); 
       
   118 	void SetLocationL(const TDesC& aLocation);
       
   119 	const TDesC& LocationL();
       
   120 
       
   121 	CCalEntry::TMethod MethodL();
       
   122 	TInt SequenceNumberL();
       
   123 	const TDesC8& UidL();
       
   124 	
       
   125 	void SetSequenceNumberL(TInt aSeq);
       
   126 	void SetLastModifiedDateL();
       
   127 	void SetLastModifiedDateL(const TCalTime& aModifiedTime);
       
   128 	
       
   129 	void SetDTStampL(const TCalTime& aDTStampTime);
       
   130 	
       
   131 	CAgnEntry* GetFullEntryL();
       
   132 	TAgnEntryId AgnEntryIdL();
       
   133 
       
   134 	void CopyFromL(CCalEntryImpl& aOther, CCalEntry::TCopyType aCopyType);
       
   135 	
       
   136 	void SetLocalUidL(TCalLocalUid aLocalId);
       
   137 	TCalLocalUid LocalUidL();
       
   138 	MAgnCalendarTimeMode::TTimeMode TimeMode() const;
       
   139 	
       
   140 	CCalEntry::TTransp BusyStatusL();
       
   141 	void SetBusyStatusL(CCalEntry::TTransp aBusyStatus);
       
   142 	
       
   143 	CCalGeoValue* GeoValueL();
       
   144 	void SetGeoValueL(const CCalGeoValue& aGeoValue);
       
   145 	void ClearGeoValueL();
       
   146 	
       
   147 	TCalTime FindRptUntilTimeL(TInt aCount);
       
   148 	
       
   149 	void SetUserIntL( TUint32 aUserInt );
       
   150 	TUint32 UserIntL();
       
   151 
       
   152 	TUint8 ShortFileIdL();
       
   153 	
       
   154 private:
       
   155 	CCalEntryImpl();
       
   156 	CCalEntryImpl(CAgnEntry& aEntry, CCalSessionImpl& aSessionImpl);
       
   157 	CCalEntryImpl(CCalLiteEntry& aEntry, CCalSessionImpl& aSessionImpl);
       
   158 	void ConstructL(CCalEntry::TType aType, HBufC8* aUid, CCalEntry::TMethod aMethod, TUint aSeqNum, const TAgnCalendarTime& aRecurrenceId, CalCommon::TRecurrenceRange aRange);
       
   159 	void ConstructL(CCalEntry::TType aType, HBufC8* aUid, CCalEntry::TMethod aMethod, TUint aSeqNum);
       
   160 	void LoadFullEntryL();
       
   161 	void ClearSimpleEntry();
       
   162 	const CAgnSimpleEntry* SimpleEntry() const;
       
   163 	CAgnSimpleEntry* SimpleEntry();
       
   164 	void PopulateAttendeeListL();
       
   165 	void PopulateCategoryListL();
       
   166 	void CopyBasicRRuleDataL(TAgnRpt& aAgnRpt, const TCalRRule& aRpt);
       
   167 	void SetCommonRptDataL(const TCalRRule& aRpt, CAgnRptDef& aRptDef);
       
   168 	void FetchDatesL(const RArray<TAgnCalendarTime>* aDateList, RArray<TCalTime>& aRDates);
       
   169 	void SetDatesL(TBool aDateType, const RArray<TCalTime>& aDates);
       
   170 	
       
   171 private: // member data
       
   172 	// Pointers to entry data - if iFullEntry is NULL then this has been created 
       
   173 	// from a lite entry, and iLiteEntry must be non-NULL
       
   174 	CAgnEntry* iFullEntry;
       
   175 	CCalLiteEntry* iLiteEntry;
       
   176 	
       
   177 	CCalSessionImpl* iSessionImpl; // not owned
       
   178 	
       
   179 	// Pointers to 'shell' CCal- classes.
       
   180 	// iFullEntry owns the actual data in CAgn- classes. When these are returned to the client, 
       
   181 	// they are wrapped inside a CCal- class. That wrapper is owned here so that the 
       
   182 	// client does not take ownership of the CCal- classes which are returned.
       
   183 	RPointerArray<CCalCategory>* iCalCategoryList;
       
   184 	RPointerArray<CCalAttendee>* iCalAttendeeList;
       
   185 	RPointerArray<CCalAttachment>* iCalAttachmentList;
       
   186 	CCalUser* iCalOrganizer;
       
   187 
       
   188     TBool iRptSetByCount;
       
   189 	};
       
   190 
       
   191 /** Implementation class of CCalEntryId.
       
   192 
       
   193 This takes data from the alarm server when a calendar alarm expires, and extracts details
       
   194 about the calendar event associated with the alarm.
       
   195 
       
   196 @internalComponent
       
   197 */
       
   198 NONSHARABLE_CLASS(CCalEntryIdImpl) : public CBase
       
   199 	{
       
   200 public:
       
   201 	static CCalEntryIdImpl* NewL(TDesC8* aFlatData);
       
   202 	~CCalEntryIdImpl();
       
   203 	TPtrC8 IdL();
       
   204 	TPtrC StoreFileNameL();
       
   205 	TCalTime RecurrenceIdL();
       
   206 	TCalTime InstanceTimeL();
       
   207 	TCalLocalUid LocalUidL();
       
   208 private:
       
   209 	CCalEntryIdImpl();
       
   210 	void ConstructL(TDesC8* aFlatData);
       
   211 private:
       
   212 	const TDesC8* iFlatData;
       
   213 	const TAgnAlarmInfo* iUniqueId;
       
   214 	};
       
   215 	
       
   216 /** A wrapper class for a TAgnLiteEntry which allows it to be shared between many CCalEntry objects.
       
   217 
       
   218 @internalComponent	
       
   219 */
       
   220 NONSHARABLE_CLASS(CCalLiteEntry) : public CBase
       
   221 	{
       
   222 public:
       
   223 	static CCalLiteEntry* NewL(CAgnSimpleEntry& aLiteEntry, RAgendaServ& aAgendaServer);
       
   224 	
       
   225 	void IncrementRefCount();
       
   226 	void DecrementRefCount();
       
   227 	
       
   228 	CAgnSimpleEntry& LiteEntry() const;
       
   229 
       
   230 private:
       
   231 	CCalLiteEntry(CAgnSimpleEntry& aLiteEntry, RAgendaServ& aAgendaServer);
       
   232 	~CCalLiteEntry();
       
   233 
       
   234 private:
       
   235 	RAgendaServ&	 iAgendaServ;
       
   236 	CAgnSimpleEntry& iLiteEntry;
       
   237 	TInt iRefCount;
       
   238 	};
       
   239 	
       
   240 #endif // __CALENTRYIMPL_H__