messagingapp/msgappfw/utils/src/ccsconversationentry.cpp
changeset 37 518b245aa84c
parent 23 238255e8b033
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
   133 // ----------------------------------------------------------------------------
   133 // ----------------------------------------------------------------------------
   134 // CCsConversationEntry::SetContactL
   134 // CCsConversationEntry::SetContactL
   135 // Sets the Conversation contact of this object
   135 // Sets the Conversation contact of this object
   136 // ----------------------------------------------------------------------------
   136 // ----------------------------------------------------------------------------
   137 EXPORT_C void CCsConversationEntry::SetContactL(const TDesC& aContact)
   137 EXPORT_C void CCsConversationEntry::SetContactL(const TDesC& aContact)
   138     {
   138 {
   139     if((&aContact))
   139     iContact = aContact.AllocL();
   140         {
   140 }
   141         iContact = aContact.AllocL();
       
   142         }
       
   143     }
       
   144 
   141 
   145 // ----------------------------------------------------------------------------
   142 // ----------------------------------------------------------------------------
   146 // CCsConversationEntry::ConversationDir
   143 // CCsConversationEntry::ConversationDir
   147 // Provides the Conversation direction of this object
   144 // Provides the Conversation direction of this object
   148 // ----------------------------------------------------------------------------
   145 // ----------------------------------------------------------------------------
   209 // ----------------------------------------------------------------------------
   206 // ----------------------------------------------------------------------------
   210 // CCsConversationEntry::SetDescriptionL
   207 // CCsConversationEntry::SetDescriptionL
   211 // Sets the Conversation description of this object
   208 // Sets the Conversation description of this object
   212 // ----------------------------------------------------------------------------
   209 // ----------------------------------------------------------------------------
   213 EXPORT_C void CCsConversationEntry::SetDescriptionL(const TDesC& aDescription)
   210 EXPORT_C void CCsConversationEntry::SetDescriptionL(const TDesC& aDescription)
   214     {
   211 {
   215     if((&aDescription))
   212 
   216         {
   213     TInt descrLength = aDescription.Length();
   217         TInt descrLength = aDescription.Length();
   214     if (descrLength > KMaxDescrSize)
   218         if ( descrLength > KMaxDescrSize )
   215         descrLength = KMaxDescrSize;
   219             descrLength = KMaxDescrSize;
   216     iDescription = HBufC::NewL(descrLength);
   220         
   217     iDescription->Des().Copy(aDescription.Left(descrLength));
   221         iDescription = HBufC::NewL(descrLength);
   218 
   222         iDescription->Des().Copy(aDescription.Left(descrLength));
   219 }
   223         }
       
   224     }
       
   225 
   220 
   226 // ----------------------------------------------------------------------------
   221 // ----------------------------------------------------------------------------
   227 // CCsConversationEntry::ChangeAttributes
   222 // CCsConversationEntry::ChangeAttributes
   228 // Sets or Clears the given attribute(s).
   223 // Sets or Clears the given attribute(s).
   229 // ----------------------------------------------------------------------------
   224 // ----------------------------------------------------------------------------
   253 EXPORT_C CCsConversationEntry* CCsConversationEntry::CloneL() const
   248 EXPORT_C CCsConversationEntry* CCsConversationEntry::CloneL() const
   254     {
   249     {
   255     CCsConversationEntry* cloneObject = CCsConversationEntry::NewL();
   250     CCsConversationEntry* cloneObject = CCsConversationEntry::NewL();
   256     CleanupStack::PushL(cloneObject);
   251     CleanupStack::PushL(cloneObject);
   257 
   252 
   258     cloneObject->SetContactL(*iContact);
   253     if (iContact)
       
   254         cloneObject->SetContactL(*iContact);
       
   255 
   259     cloneObject->SetConversationDir(iConversationDir);
   256     cloneObject->SetConversationDir(iConversationDir);
   260     cloneObject->SetType(iConversationType);
   257     cloneObject->SetType(iConversationType);
   261     cloneObject->SetEntryId(iEntryID);
   258     cloneObject->SetEntryId(iEntryID);
   262     cloneObject->SetSendState(iConversationStatus);
   259     cloneObject->SetSendState(iConversationStatus);
   263     cloneObject->ChangeAttributes(iConversationAttrib, ECsAttributeNone);
   260     cloneObject->ChangeAttributes(iConversationAttrib, ECsAttributeNone);
   264     cloneObject->SetDescriptionL(*iDescription);
   261     if(iDescription)
       
   262         cloneObject->SetDescriptionL(*iDescription);
   265     cloneObject->SetTimeStampL(iTimeStamp);
   263     cloneObject->SetTimeStampL(iTimeStamp);
   266 
   264 
   267     CleanupStack::Pop(cloneObject);
   265     CleanupStack::Pop(cloneObject);
   268     return cloneObject;
   266     return cloneObject;
   269     }
   267     }