pimappservices/calendar/shared/src/agmentry.cpp
changeset 89 b57382753122
parent 18 c198609911f9
--- a/pimappservices/calendar/shared/src/agmentry.cpp	Fri Oct 15 12:10:36 2010 +0530
+++ b/pimappservices/calendar/shared/src/agmentry.cpp	Wed Nov 03 17:12:22 2010 +0530
@@ -29,13 +29,13 @@
 #include <e32math.h>
 
 #include <asshddefs.h>
-
+#define KUserDataInt 4 
 
 //---------------------------------- CAgnEntry ------------------------------------------
 
 EXPORT_C CAgnEntry* CAgnEntry::NewL(CCalEntry::TType aType)
 	{
-	__ASSERT_ALWAYS(aType>=CCalEntry::EAppt && aType<=CCalEntry::ENote, Panic(EAgmErrBadTypeEntry));
+	__ASSERT_ALWAYS(aType>=CCalEntry::EAppt && aType<=CCalEntry::EAnniv, Panic(EAgmErrBadTypeEntry));
 	// allocate a CAgnEntry object, which invokes the CAgnSimpleEntry new operator, but passing no allocator
 	// this makes the CAgnSimpleEntry new operator use the default new operator
 	
@@ -52,8 +52,7 @@
 	
 	__ASSERT_ALWAYS(type==CCalEntry::EAppt || type==CCalEntry::EEvent ||
 					type==CCalEntry::EAnniv || type==CCalEntry::ETodo ||
-					type==CCalEntry::EReminder || type == CCalEntry::ENote,
-					User::Leave(KErrCorrupt));
+					type==CCalEntry::EReminder, User::Leave(KErrCorrupt));
 
 	CAgnEntry* entry = CAgnEntry::NewL(type);
 	CleanupStack::PushL(entry);
@@ -238,9 +237,9 @@
 		
 	// Compare the user integer.
 	if (UserInt() != aEntry.UserInt())
-		{
-		return EFalse;
-		}	
+	    {
+	    return EFalse;
+	    }	
 	
 	if ( DTStampUtcL() != aEntry.DTStampUtcL() )
 		{
@@ -412,6 +411,11 @@
 		return EFalse;
 		}
 	
+    if ( UserDataInt() != aEntry.UserDataInt() )     
+        {       
+        return EFalse;       
+        }   
+    
 	return ETrue;
 	}
 
@@ -686,11 +690,17 @@
 			}
 		}
 
-	// Set the user integer of the stream.
+    // Set the user integer of the stream.
 	aStream.WriteInt32L( UserInt() );
-	
-	// future DC proofing
-	aStream.WriteUint32L(0); // number of bytes until end of entry
+
+    TInt skipCount( 0 );
+    //skip count(4) for UserDataInt is added
+    //to read those many bytes after fixed length of agmentry.
+    skipCount += KUserDataInt; 
+    
+    // Number of bytes until end of entry 
+    aStream.WriteUint32L( skipCount );
+    aStream.WriteInt32L( UserDataInt() );      
 	}
 
 
@@ -829,13 +839,18 @@
 	// Set the user integer of this entry from the stream.
 	SetUserInt(aStream.ReadInt32L());
 	
-	// future DC proofing
 	size = aStream.ReadUint32L(); // number of bytes until end of entry
+	
+	if ( size >= KUserDataInt )       
+        {       
+        SetUserDataInt( aStream.ReadInt32L() );
+		size -= KUserDataInt;
+        }  
 	while (size > 0)
 		{
-		aStream.ReadUint8L(); // ignore data
-		size--;
-		}
+			aStream.ReadUint8L(); // ignore data
+			size--;
+		}     
 	}
 
 EXPORT_C CAgnEntry* CAgnEntry::CloneL() const
@@ -1008,6 +1023,8 @@
 		HBufC8* guid = aSource.Guid().AllocL();
 		SetGuid(guid);
 		}		
+	// copy int       
+	iUserDataInt = aSource.UserDataInt();   
 	}
 	
 EXPORT_C CCalEntry::TReplicationStatus CAgnEntry::ReplicationStatus() const
@@ -1235,6 +1252,27 @@
 	iPhoneOwner = aAttendee;
 	}
 
+EXPORT_C void CAgnEntry::ClearMRSpecificData()
+    {
+    // clears the iMeetingOrganizer and iAttendeeList.
+    if( iMeetingOrganizer )
+        {
+        delete iMeetingOrganizer;
+        iMeetingOrganizer = NULL;
+
+        }
+    if( iPhoneOwner )
+        {
+        iPhoneOwner = NULL;
+        }
+
+    if( iAttendeeList )
+        {
+        iAttendeeList->ResetAndDestroy();
+        delete iAttendeeList;
+        iAttendeeList = NULL;
+        }
+    }
 
 EXPORT_C void CAgnEntry::SetDTStampUtcL(const TTime& aDTStampUtc)
 /**
@@ -1855,9 +1893,9 @@
 @internalComponent
 */
 EXPORT_C void CAgnEntry::SetUserInt( TUint32 aUserInt )
-	{
-	CAgnSimpleEntry::SetUserInt(aUserInt);
-	}
+    {
+    CAgnSimpleEntry::SetUserInt(aUserInt);
+    }
 
 /**
 Gets the user integer of this entry.
@@ -1866,9 +1904,9 @@
 @internalComponent
 */
 EXPORT_C TUint32 CAgnEntry::UserInt() const
-	{
-	return CAgnSimpleEntry::UserInt();
-	}
+    {
+    return CAgnSimpleEntry::UserInt();
+    }
 
 EXPORT_C void CAgnEntry::ExternalizeToBufferL(RWriteStream& aWriteStream) const
 /** Used for passing the data to the between client and server
@@ -2010,18 +2048,6 @@
 // verify entry is valid before storing it
 EXPORT_C void CAgnEntry::VerifyBeforeStoreL()
 	{
-	// check for entry type note
-	if( Type() == CCalEntry::ENote  && !StartTime().IsSet())
-		{
-		// read the modfication time from simple entry
-		TAgnCalendarTime agnStartTime;
-		agnStartTime.SetUtcL(CAgnSimpleEntry::LastModifiedDateUtc());
-
-		TAgnCalendarTime agnEndTime = agnStartTime;
-		// set the modification time as start and end time
-		CAgnSimpleEntry::SetStartAndEndTimeL(agnStartTime, agnEndTime);
-		}
-
 	//Check entry time
 	if ( Type() != CCalEntry::ETodo )
 		{
@@ -2099,3 +2125,13 @@
 	{
 	return (iFlags & aFlag);
 	}
+
+EXPORT_C void CAgnEntry::SetUserDataInt( TUint32 aUserInt )       
+    {       
+    iUserDataInt = aUserInt;       
+    }       
+
+EXPORT_C TUint32 CAgnEntry::UserDataInt() const       
+    {       
+    return iUserDataInt;       
+    }