13 * |
13 * |
14 * Description: Key class for message sorting |
14 * Description: Key class for message sorting |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 // <qmail> Are AknUtils available in 10.1? |
18 // <cmail> |
19 // <cmail> |
19 #include <AknUtils.h> |
20 #include <AknUtils.h> |
20 // </cmail> |
21 // </cmail> |
|
22 // </qmail> |
21 |
23 |
22 #include "emailtrace.h" |
24 #include "emailtrace.h" |
23 #include "ipsplgheaders.h" |
25 #include "ipsplgheaders.h" |
24 |
26 |
25 const TInt KLessThan = -1; |
27 const TInt KLessThan = -1; |
26 const TInt KMoreThan = 1; |
28 const TInt KMoreThan = 1; |
27 const TInt KEqual = 0; |
29 const TInt KEqual = 0; |
28 |
30 |
29 _LIT(KDefaultSubjectPrefixSeparator,": "); |
31 _LIT(KDefaultSubjectPrefixSeparator,": "); |
30 // <cmail> |
32 // <cmail> |
31 _LIT( KCharsToReplace, "\r\n\t\x2028\x2029" ); |
33 // <qmail> Cmail bugfix uses AknUtils (available in 10.1?) - commented out until it is clear |
|
34 //_LIT( KCharsToReplace, "\r\n\t\x2028\x2029" ); |
|
35 // <qmail> |
32 // </cmail> |
36 // </cmail> |
33 |
37 |
34 // --------------------------------------------------------------------------- |
38 // --------------------------------------------------------------------------- |
35 // Basic sonstructor |
39 // Basic sonstructor |
36 // --------------------------------------------------------------------------- |
40 // --------------------------------------------------------------------------- |
210 const TDesC& aLeft, |
214 const TDesC& aLeft, |
211 const TDesC& aRight ) const |
215 const TDesC& aRight ) const |
212 { |
216 { |
213 FUNC_LOG; |
217 FUNC_LOG; |
214 TInt result( KEqual ); |
218 TInt result( KEqual ); |
215 const TInt leftOffset = FindSubjectStart( aLeft ); |
219 TPtrC leftPtr( aLeft ); |
216 const TInt rightOffset = FindSubjectStart( aRight ); |
220 TPtrC rightPtr( aRight ); |
217 TPtrC leftPtr( aLeft.Ptr() + leftOffset, aLeft.Length() - leftOffset ); |
221 TInt leftOffset( FindSubjectStart( aLeft ) ); |
218 TPtrC rightPtr( aRight.Ptr() + rightOffset, aRight.Length() - rightOffset ); |
222 TInt rightOffset( FindSubjectStart( aRight ) ); |
219 |
223 |
220 // for unifying with UI - remove all white spaces |
224 leftPtr.Set( |
221 HBufC* croppedLeft = leftPtr.Alloc(); |
225 leftPtr.Ptr() + leftOffset, leftPtr.Length() - leftOffset ); |
222 HBufC* croppedRight = rightPtr.Alloc(); |
226 rightPtr.Set( |
223 |
227 rightPtr.Ptr() + rightOffset, rightPtr.Length() - rightOffset ); |
224 // Comparison is done only when allocation succeeds |
228 |
225 if ( croppedLeft && croppedRight ) |
229 // <qmail> Are AknUtils available in 10.1? |
226 { |
230 // <cmail> for unifying with UI - remove all white spaces |
227 TPtr croppedLeftPtr = croppedLeft->Des(); |
231 /*HBufC* croppedLeft = leftPtr.AllocLC(); |
228 TPtr croppedRightPtr = croppedRight->Des(); |
232 TPtr croppedLeftPtr = croppedLeft->Des(); |
229 |
233 HBufC* croppedRight = rightPtr.AllocLC(); |
230 AknTextUtils::ReplaceCharacters( croppedLeftPtr, KCharsToReplace, ' ' ); |
234 TPtr croppedRightPtr = croppedRight->Des(); |
231 croppedLeftPtr.TrimAll(); |
235 |
232 AknTextUtils::ReplaceCharacters( croppedRightPtr, KCharsToReplace, ' ' ); |
236 AknTextUtils::ReplaceCharacters( croppedLeftPtr, KCharsToReplace, ' ' ); |
233 croppedRightPtr.TrimAll(); |
237 croppedLeftPtr.TrimAll(); |
234 |
238 AknTextUtils::ReplaceCharacters( croppedRightPtr, KCharsToReplace, ' ' ); |
235 result = croppedLeftPtr.CompareC( croppedRightPtr ); |
239 croppedRightPtr.TrimAll(); |
236 } |
240 |
237 |
241 result = croppedLeftPtr.CompareC( croppedRightPtr ); |
238 delete croppedRight; |
242 |
239 delete croppedLeft; |
243 CleanupStack::PopAndDestroy( croppedRight ); |
|
244 CleanupStack::PopAndDestroy( croppedLeft );*/ |
|
245 // </cmail> |
|
246 // </qmail> |
|
247 |
|
248 // <qmail> Remove line if above code is valid in 10.1 |
|
249 result = leftPtr.CompareC( rightPtr ); |
|
250 // </qmail> |
240 |
251 |
241 return result; |
252 return result; |
242 } |
253 } |
243 |
254 |
244 // --------------------------------------------------------------------------- |
255 // --------------------------------------------------------------------------- |