ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp
branchRCL_3
changeset 24 d189ee25cf9d
parent 23 dcf0eedfc1a3
child 25 3533d4323edc
--- a/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp	Thu Aug 19 09:38:05 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp	Tue Aug 31 15:04:17 2010 +0300
@@ -307,7 +307,10 @@
     TBool modified ( EFalse );
     TBool unread( aEmlEntry.Unread() );
 
-    if ( !LogicalXor( unread, msgFlags & EFSMsgFlag_Read ) )
+// <qmail>
+    if ( LogicalXor( unread, msgFlags & EFSMsgFlag_Read ) ||
+         LogicalXor( unread, msgFlags & EFSMsgFlag_Read_Locally ))
+// </qmail>
         {
         aEmlEntry.SetUnread( !unread );
         modified = ETrue;
@@ -359,11 +362,6 @@
     // EFSMsgFlag_Answered: supported only with IMAP4 (see below)
 
     // EFSMsgFlag_Forwarded: no counterpart in Symbian message in S60 3.1
-    if ( LogicalXor( aEmlEntry.Forwarded(), msgFlags & EFSMsgFlag_Forwarded ) )
-        {
-        aEmlEntry.SetForwarded( !aEmlEntry.Forwarded() );
-        modified = ETrue;
-        }
 
     // EFSMsgFlag_OnlyToMe: no counterpart in Symbian message
 
@@ -410,17 +408,14 @@
 
     TMsvEmailEntry tEntry( cEntry->Entry() );
     TBool isModified = ChangeTEntryFlagsL( tEntry, aMessage );
-
+    // <qmail>
     if ( isModified )
         {
-        CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewLC();
-        CMsvOperation* ops = cEntry->ChangeL( tEntry, waiter->iStatus );
-        CleanupStack::PushL( ops );
-        waiter->Start();
-        CleanupStack::PopAndDestroy( 2, waiter );
+        cEntry->ChangeL( tEntry );
         }
 
     CleanupStack::PopAndDestroy( cEntry );
+    // </qmail>
     }
 
 // ---------------------------------------------------------------------------
@@ -718,8 +713,7 @@
 							{
 							// Only text/calendar part included as attachment
 							aMsg.ResetFlag( EFSMsgFlag_Attachments );
-							//Set Attachment flag for CMsvEntry (needed for sorting)
-							TRAP_IGNORE( SetAttachmentFlagL( aEntry, EFalse ) );
+							// <qmail> remove call to SetAttachmentFlagL(), because shouln't be needed any more
 							}
                 		}
                 	delete cEntry;
@@ -754,14 +748,7 @@
     aMsg.ResetFlag( EFSMsgFlag_Answered );
 
     // EFSMsgFlag_Forwarded: not supported in S60 3.1
-    if ( aEntry.Forwarded() )
-        {
-        aMsg.SetFlag( EFSMsgFlag_Forwarded );
-        }
-    else
-        {
-        aMsg.ResetFlag( EFSMsgFlag_Forwarded );
-        }
+    aMsg.ResetFlag( EFSMsgFlag_Forwarded );
 
     // EFSMsgFlag_OnlyToMe: like EFSMsgFlag_Multiple
 
@@ -955,17 +942,24 @@
 // ---------------------------------------------------------------------------
 // <cmail>
 TInt CIpsPlgMsgMapper::ConvertBodyPartMimeType(
-    const TUid& aEntryType,
+    const TMsvEmailEntry& aEntry,
     TDes& aMimeType )
     {
     FUNC_LOG;
     TInt result( KErrNone );
 
-    switch ( aEntryType.iUid )
+    switch ( aEntry.iType.iUid )
     {
     case KUidMsvEmailTextEntryValue:
         {
+        if( aEntry.ICalendar() )
+            {
+            aMimeType.Append( KFSMailContentTypeTextCalendar );
+            }
+        else
+            {
             aMimeType.Append( KMimeTypeTextPlain );
+            }
         break;
         }
     case KUidMsvEmailHtmlEntryValue:
@@ -1098,7 +1092,7 @@
             childPart = GetMessagePartL( (*cEntry)[0].Id(), aMailBoxId, aMessageId );
             if( childPart )
                 {
-                aParts.Append( childPart );
+                aParts.AppendL( childPart );
                 }
             }
         }
@@ -1160,7 +1154,7 @@
         // Insert the new child part to the result array
         if ( childPart )
             {
-            aParts.Insert( childPart, position );
+            aParts.InsertL( childPart, position );
             childPart = NULL;
             }
         }
@@ -1177,11 +1171,11 @@
     FUNC_LOG;
     CFSMailMessagePart* result( NULL );
     TInt status;
-// <cmail>
     HBufC* buf = HBufC::NewLC( KMaxContentTypeLength );
     TPtr contentType = buf->Des();
 
-    status = ConvertBodyPartMimeType( aEntry.iType, contentType );
+    status = ConvertBodyPartMimeType( aEntry, contentType );
+    
     __ASSERT_DEBUG( ( status == KErrNone ),
         User::Panic( KIpsPlgPanicCategory, EIpsPlgInvalidEntry ) );
     if ( status == KErrNone )
@@ -1194,7 +1188,6 @@
             {
             GetCharsetParameterL( aEntry, contentType );
             }
-// </cmail>
         result->SetContentType( contentType );
         result->SetMailBoxId( aMailBoxId );
 
@@ -1521,24 +1514,21 @@
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // <cmail>
-void CIpsPlgMsgMapper::SetAttachmentFlagL( const TMsvEmailEntry& aEntry,
-										   TBool aHasAttachment )
+void CIpsPlgMsgMapper::SetAttachmentFlagL( const TMsvEmailEntry& /*aEntry*/,
+										   TBool /*aHasAttachment*/ )
 	{
 	FUNC_LOG;
-	CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() );
+	// <qmail> commented out, causing freeze in message list
+	/*CMsvEntry* cEntry = iSession.GetEntryL( aEntry.Id() );
 	CleanupStack::PushL( cEntry );
 	// Only text/calendar part included as attachment
 	TMsvEmailEntry entryToBeChanged( aEntry );
 	entryToBeChanged.SetAttachment( aHasAttachment );
-	CIpsPlgOperationWait* waiter = CIpsPlgOperationWait::NewLC();
-	CMsvOperation* ops = cEntry->ChangeL( entryToBeChanged, waiter->iStatus );
-	CleanupStack::PushL( ops );
-	waiter->Start();
-	CleanupStack::PopAndDestroy( 3, cEntry );
+
+	cEntry->ChangeL( entryToBeChanged );
+	CleanupStack::PopAndDestroy( cEntry );*/
+// </qmail>
 	}
-// </cmail>
-
-// <cmail>
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 void CIpsPlgMsgMapper::GetCharsetParameterL(
@@ -1558,11 +1548,11 @@
             mimeHeader->RestoreL( *store );
 
             TInt count = mimeHeader->ContentTypeParams().MdcaCount();
-            INFO_1("# of CT params: %d", count);
+            //INFO_1("# of CT params: %d", count);
             for ( TInt i = 0; i < count; i++ )
                 {
                 TPtrC8 key8 = mimeHeader->ContentTypeParams().MdcaPoint( i );
-                INFO_1("%S", &key8);
+                //INFO_1("%S", &key8);
                 TPtr16 keyUppercase16 = HBufC::NewLC( key8.Length() )->Des();
                 keyUppercase16.Copy( key8 );
                 keyUppercase16.UpperCase();