emailuis/emailui/src/ncsutility.cpp
branchRCL_3
changeset 31 72d484772ca6
parent 8 e1b6206813b4
child 13 0396474f30f5
--- a/emailuis/emailui/src/ncsutility.cpp	Fri Feb 19 22:37:30 2010 +0200
+++ b/emailuis/emailui/src/ncsutility.cpp	Fri Mar 12 15:41:14 2010 +0200
@@ -36,9 +36,9 @@
 #include <flogger.h>
 #include <aknenv.h>	// CAknEnv
 
-#include "cfsmailbox.h"
-#include "cfsmailclient.h"
-#include "cfsmailaddress.h"
+#include "CFSMailBox.h"
+#include "CFSMailClient.h"
+#include "CFSMailAddress.h"
 
 #include <aknlayoutscalable_apps.cdl.h>
 #include <layoutmetadata.cdl.h>
@@ -300,51 +300,59 @@
 HBufC* NcsUtility::FormatSubjectLineL( 
         const TDesC& aNewSubjectLine, const TDesC& aPrefix )
 	{
-    FUNC_LOG;
-
-	HBufC* formattedSubjectLine = aNewSubjectLine.AllocLC();
-	HBufC* prefix = aPrefix.AllocLC();
-
-	TPtr formattedSubjectLinePtr = formattedSubjectLine->Des();
-	TPtr prefixPtr = prefix->Des();
-	prefixPtr.Trim();
-
-	TInt subjectLineLength = formattedSubjectLinePtr.Length();
-	TInt index = 0;
-	TInt length = subjectLineLength;
-	TInt prefixLength = prefixPtr.Length();
-
-	do
-		{
-		formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
-		index = formattedSubjectLinePtr.FindC( prefixPtr );
-		length = formattedSubjectLinePtr.Length() - index - prefixLength;
-		}
-	while( index != KErrNotFound );
+	FUNC_LOG;
+	   
+	    HBufC* formattedSubjectLine = aNewSubjectLine.AllocLC();
+	    HBufC* prefix = aPrefix.AllocLC();
+	    TPtr formattedSubjectLinePtr = formattedSubjectLine->Des();
+	    TPtr prefixPtr = prefix->Des();
+	    prefixPtr.Trim();
+	    
+	    TInt subjectLineLength = formattedSubjectLinePtr.Length();
+	    TInt length = subjectLineLength;
+	    TInt prefixLength = prefixPtr.Length();
+	    HBufC* fwdPrefix = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_FORWARD_PREFIX );
+	    TPtr fwdPrt = fwdPrefix->Des();
+	    TInt fwdLength = fwdPrt.Length();
+	    fwdPrt.Trim();
+	    
+	      for(TInt index = formattedSubjectLinePtr.FindC( prefixPtr ); index != KErrNotFound ; index = formattedSubjectLinePtr.FindC( prefixPtr ))
+	        {
+	            formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
+	            length = formattedSubjectLinePtr.Length() - index - prefixLength;
+	        }
+	       formattedSubjectLinePtr.Trim();
+	       
+	       for(TInt index = formattedSubjectLinePtr.FindC( fwdPrt) ; index != KErrNotFound  ; index = formattedSubjectLinePtr.FindC( fwdPrt ))
+	          {
+	               formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
+	               length = formattedSubjectLinePtr.Length() - index - fwdLength;
+	          }
 
-	formattedSubjectLinePtr.Trim();
+	       formattedSubjectLinePtr.Trim();
+	    
+	    
+	    HBufC* finalSubject = HBufC::NewL( formattedSubjectLinePtr.Length() + prefixPtr.Length() + KSpace().Length()  );
+	    TPtr ptr = finalSubject->Des();
+	    if ( AknLayoutUtils::LayoutMirrored() )
+	        {
+	        ptr.Append( formattedSubjectLinePtr );
+	        ptr.Append( KSpace );
+	        ptr.Append( prefixPtr );        
+	        
+	        }
+	    else
+	        {
+	        ptr.Append( prefixPtr );
+	        ptr.Append( KSpace );
+	        ptr.Append( formattedSubjectLinePtr );
+	    
+	        }
+	    CleanupStack::PopAndDestroy( fwdPrefix );
+	    CleanupStack::PopAndDestroy( prefix );
+	    CleanupStack::PopAndDestroy( formattedSubjectLine );
 
-	HBufC* finalSubject = HBufC::NewL( 
-	        formattedSubjectLinePtr.Length() + prefixPtr.Length() + 
-	        KSpace().Length() );
-	TPtr ptr = finalSubject->Des();
-	if ( AknLayoutUtils::LayoutMirrored() )
-		{
-		ptr.Append( formattedSubjectLinePtr );
-		ptr.Append( KSpace );
-		ptr.Append( prefixPtr );		
-		}
-	else
-		{
-		ptr.Append( prefixPtr );
-		ptr.Append( KSpace );
-		ptr.Append( formattedSubjectLinePtr );
-		}
-
-	CleanupStack::PopAndDestroy( prefix );
-	CleanupStack::PopAndDestroy( formattedSubjectLine );
-
-	return finalSubject;
+	    return finalSubject;
 	}
 
 // -----------------------------------------------------------------------------