diff -r 000000000000 -r 8466d47a6819 ipsservices/ipssosplugin/inc/ipsplgmsgkey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ipsservices/ipssosplugin/inc/ipsplgmsgkey.h Thu Dec 17 08:39:21 2009 +0200 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Key class for message sorting +* +*/ + + +#ifndef IPSPLGMSGKEY_H +#define IPSPLGMSGKEY_H + +#include // TKey +// +#include "CFSMailCommon.h" // tfsmailsortcriteria +// + +class CMsvEntry; + +const TInt KMaxSubjectPrefixSeparatorLength = 8; + +/** + * Comparison class for message objects + * + * @code + * @endcode + * + * @lib ipssosplugin.lib + * @since + */ +class TIpsPlgMsgKey : public TKey + { + +public: + + /** + * Constructor. + * + * @since + * @param aFolderEntry Folder to be sorted + * @param aSortCriteria Sorting criteria + */ + TIpsPlgMsgKey( + CMsvEntry& aFolderEntry, + const RArray& aSortCriteria ); + + /** + * Finds the offset from which the actual subject starts after + * the prefixes + * + * @param aSubject Message subject string + * @return Offset from the beginning of the string. If the string + * is not found, returns 0. + */ + TInt FindSubjectStart( const TDesC& aSubject ) const; + +public: + + /** + * From TKey + */ + virtual TInt Compare(TInt aLeft, TInt aRight) const; + + /** + * From TKey + */ + virtual TAny* At(TInt anIndex) const; + +private: + // Prevent usage of the default constructor + TIpsPlgMsgKey(); + +private: + /** + * Compares the subject strings omitting the reply & forward prefixes + */ + TInt CompareSubjectsL( const TDesC& aLeft, const TDesC& aRight ) const; // change to leaving function + +private: + // Folder objects the messages of which are sorted. Not owned. + CMsvEntry& iFolderEntry; + + // Sorting criteria + const RArray& iSortingCriteria; + + // String which separates the subject prefixes (Re, Fwd etc) + // from the actual subject + TBuf iSubjectPrefixSeparator; + + }; + +#endif // IPSPLGMSGKEY_H