ipsservices/ipssosplugin/src/ipsplgmsgkey.cpp
branchRCL_3
changeset 64 3533d4323edc
parent 63 d189ee25cf9d
--- a/ipsservices/ipssosplugin/src/ipsplgmsgkey.cpp	Tue Aug 31 15:04:17 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgmsgkey.cpp	Wed Sep 01 12:28:57 2010 +0100
@@ -15,11 +15,9 @@
 *
 */
 
-// <qmail> Are AknUtils available in 10.1?
 // <cmail>
 #include <AknUtils.h>
 // </cmail>
-// </qmail>
 
 #include "emailtrace.h"
 #include "ipsplgheaders.h"
@@ -30,9 +28,7 @@
 
 _LIT(KDefaultSubjectPrefixSeparator,": ");
 // <cmail>
-// <qmail> Cmail bugfix uses AknUtils (available in 10.1?) - commented out until it is clear
-//_LIT( KCharsToReplace, "\r\n\t\x2028\x2029" );
-// <qmail>
+_LIT( KCharsToReplace, "\r\n\t\x2028\x2029" );
 // </cmail>
 
 // ---------------------------------------------------------------------------
@@ -216,38 +212,31 @@
     {
     FUNC_LOG;
     TInt  result( KEqual );
-    TPtrC leftPtr( aLeft );
-    TPtrC rightPtr( aRight );
-    TInt  leftOffset( FindSubjectStart( aLeft ) );
-    TInt  rightOffset( FindSubjectStart( aRight ) );
-    
-    leftPtr.Set( 
-        leftPtr.Ptr() + leftOffset, leftPtr.Length() - leftOffset );
-    rightPtr.Set( 
-        rightPtr.Ptr() + rightOffset, rightPtr.Length() - rightOffset );
-    
-// <qmail> Are AknUtils available in 10.1?
-    // <cmail> for unifying with UI - remove all white spaces
-    /*HBufC* croppedLeft = leftPtr.AllocLC();
-    TPtr croppedLeftPtr = croppedLeft->Des();
-    HBufC* croppedRight = rightPtr.AllocLC();
-    TPtr croppedRightPtr = croppedRight->Des();
-        
-    AknTextUtils::ReplaceCharacters( croppedLeftPtr, KCharsToReplace, ' ' );
-    croppedLeftPtr.TrimAll();
-    AknTextUtils::ReplaceCharacters( croppedRightPtr, KCharsToReplace, ' ' );
-    croppedRightPtr.TrimAll();
-    
-    result = croppedLeftPtr.CompareC( croppedRightPtr );
-    
-    CleanupStack::PopAndDestroy( croppedRight );
-    CleanupStack::PopAndDestroy( croppedLeft );*/
-    // </cmail>
-// </qmail>
-
-// <qmail> Remove line if above code is valid in 10.1
-	result = leftPtr.CompareC( rightPtr );
-// </qmail>
+    const TInt leftOffset = FindSubjectStart( aLeft );
+    const TInt rightOffset = FindSubjectStart( aRight );
+    TPtrC leftPtr( aLeft.Ptr() + leftOffset, aLeft.Length() - leftOffset );
+    TPtrC rightPtr( aRight.Ptr() + rightOffset, aRight.Length() - rightOffset );
+ 
+    // for unifying with UI - remove all white spaces
+    HBufC* croppedLeft = leftPtr.Alloc();
+    HBufC* croppedRight = rightPtr.Alloc();
+ 
+    // Comparison is done only when allocation succeeds
+    if ( croppedLeft && croppedRight )
+        {
+        TPtr croppedLeftPtr = croppedLeft->Des();
+        TPtr croppedRightPtr = croppedRight->Des();
+ 
+        AknTextUtils::ReplaceCharacters( croppedLeftPtr, KCharsToReplace, ' ' );
+        croppedLeftPtr.TrimAll();
+        AknTextUtils::ReplaceCharacters( croppedRightPtr, KCharsToReplace, ' ' );
+        croppedRightPtr.TrimAll();
+ 
+        result = croppedLeftPtr.CompareC( croppedRightPtr );
+        }
+ 
+    delete croppedRight;
+    delete croppedLeft;
         
     return result;
     }