306 HBufC* prefix = aPrefix.AllocLC(); |
306 HBufC* prefix = aPrefix.AllocLC(); |
307 TPtr formattedSubjectLinePtr = formattedSubjectLine->Des(); |
307 TPtr formattedSubjectLinePtr = formattedSubjectLine->Des(); |
308 TPtr prefixPtr = prefix->Des(); |
308 TPtr prefixPtr = prefix->Des(); |
309 prefixPtr.Trim(); |
309 prefixPtr.Trim(); |
310 |
310 |
311 TInt subjectLineLength = formattedSubjectLinePtr.Length(); |
|
312 TInt length = subjectLineLength; |
|
313 TInt prefixLength = prefixPtr.Length(); |
|
314 HBufC* fwdPrefix = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_FORWARD_PREFIX ); |
311 HBufC* fwdPrefix = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_FORWARD_PREFIX ); |
|
312 HBufC* rePrefix = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_REPLY_PREFIX ); |
315 TPtr fwdPrt = fwdPrefix->Des(); |
313 TPtr fwdPrt = fwdPrefix->Des(); |
316 TInt fwdLength = fwdPrt.Length(); |
314 TPtr rePtr = rePrefix->Des(); |
317 fwdPrt.Trim(); |
315 fwdPrt.Trim(); |
|
316 rePtr.Trim(); |
318 |
317 |
319 for(TInt index = formattedSubjectLinePtr.FindC( prefixPtr ); index != KErrNotFound ; index = formattedSubjectLinePtr.FindC( prefixPtr )) |
318 TInt indexRe; |
320 { |
319 TInt indexFw; |
321 formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length ); |
|
322 length = formattedSubjectLinePtr.Length() - index - prefixLength; |
|
323 } |
|
324 formattedSubjectLinePtr.Trim(); |
|
325 |
|
326 for(TInt index = formattedSubjectLinePtr.FindC( fwdPrt) ; index != KErrNotFound ; index = formattedSubjectLinePtr.FindC( fwdPrt )) |
|
327 { |
|
328 formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length ); |
|
329 length = formattedSubjectLinePtr.Length() - index - fwdLength; |
|
330 } |
|
331 |
|
332 formattedSubjectLinePtr.Trim(); |
|
333 |
320 |
|
321 |
|
322 // Start to analyse the original subject string and remove |
|
323 // all prefixes at the beggining. When no prefix found as |
|
324 // first word, than loop ends |
|
325 do |
|
326 { |
|
327 indexRe = formattedSubjectLinePtr.FindC( rePtr ); |
|
328 if( indexRe == 0 ) |
|
329 { |
|
330 formattedSubjectLinePtr.Delete( indexRe, rePtr.Length() ); |
|
331 formattedSubjectLinePtr.Trim(); |
|
332 } |
|
333 |
|
334 indexFw = formattedSubjectLinePtr.FindC( fwdPrt ); |
|
335 if( indexFw == 0 ) |
|
336 { |
|
337 formattedSubjectLinePtr.Delete( indexFw, rePtr.Length() ); |
|
338 formattedSubjectLinePtr.Trim(); |
|
339 } |
|
340 } |
|
341 while( !( indexRe != 0 && indexFw != 0) ); |
334 |
342 |
335 HBufC* finalSubject = HBufC::NewL( formattedSubjectLinePtr.Length() + prefixPtr.Length() + KSpace().Length() ); |
343 HBufC* finalSubject = HBufC::NewL( formattedSubjectLinePtr.Length() + prefixPtr.Length() + KSpace().Length() ); |
336 TPtr ptr = finalSubject->Des(); |
344 TPtr ptr = finalSubject->Des(); |
337 if ( AknLayoutUtils::LayoutMirrored() ) |
345 if ( AknLayoutUtils::LayoutMirrored() ) |
338 { |
346 { |
346 ptr.Append( prefixPtr ); |
354 ptr.Append( prefixPtr ); |
347 ptr.Append( KSpace ); |
355 ptr.Append( KSpace ); |
348 ptr.Append( formattedSubjectLinePtr ); |
356 ptr.Append( formattedSubjectLinePtr ); |
349 |
357 |
350 } |
358 } |
|
359 CleanupStack::PopAndDestroy( rePrefix ); |
351 CleanupStack::PopAndDestroy( fwdPrefix ); |
360 CleanupStack::PopAndDestroy( fwdPrefix ); |
352 CleanupStack::PopAndDestroy( prefix ); |
361 CleanupStack::PopAndDestroy( prefix ); |
353 CleanupStack::PopAndDestroy( formattedSubjectLine ); |
362 CleanupStack::PopAndDestroy( formattedSubjectLine ); |
354 |
363 |
355 return finalSubject; |
364 return finalSubject; |