ipsservices/ipssosplugin/inc/ipsplgmsgkey.h
changeset 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Key class for message sorting
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IPSPLGMSGKEY_H
       
    20 #define IPSPLGMSGKEY_H
       
    21 
       
    22 #include <e32base.h>          // TKey
       
    23 //<cmail>
       
    24 #include "CFSMailCommon.h"    // tfsmailsortcriteria
       
    25 //</cmail>
       
    26 
       
    27 class CMsvEntry;
       
    28 
       
    29 const TInt KMaxSubjectPrefixSeparatorLength = 8;
       
    30 
       
    31 /**
       
    32  *  Comparison class for message objects
       
    33  *
       
    34  *  @code
       
    35  *  @endcode
       
    36  *
       
    37  *  @lib ipssosplugin.lib
       
    38  *  @since 
       
    39  */
       
    40 class TIpsPlgMsgKey : public TKey
       
    41     {
       
    42 
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Constructor.
       
    47      *
       
    48      * @since 
       
    49      * @param aFolderEntry  Folder to be sorted
       
    50      * @param aSortCriteria Sorting criteria
       
    51      */
       
    52     TIpsPlgMsgKey( 
       
    53         CMsvEntry& aFolderEntry,
       
    54         const RArray<TFSMailSortCriteria>& aSortCriteria );
       
    55         
       
    56     /**
       
    57      * Finds the offset from which the actual subject starts after 
       
    58      * the prefixes
       
    59      *
       
    60      * @param aSubject Message subject string
       
    61      * @return Offset from the beginning of the string. If the string
       
    62      *         is not found, returns 0.
       
    63      */
       
    64     TInt FindSubjectStart( const TDesC& aSubject ) const;
       
    65 
       
    66 public:
       
    67 
       
    68     /**
       
    69      * From TKey
       
    70      */
       
    71     virtual TInt Compare(TInt aLeft, TInt aRight) const;
       
    72 
       
    73     /**
       
    74      * From TKey
       
    75      */
       
    76     virtual TAny* At(TInt anIndex) const;
       
    77 
       
    78 private:
       
    79     // Prevent usage of the default constructor
       
    80     TIpsPlgMsgKey();
       
    81     
       
    82 private:
       
    83     /**
       
    84      * Compares the subject strings omitting the reply & forward prefixes
       
    85      */
       
    86     TInt CompareSubjectsL( const TDesC& aLeft, const TDesC& aRight ) const; // <cmail> change to leaving function
       
    87 
       
    88 private:
       
    89     // Folder objects the messages of which are sorted. Not owned.    
       
    90     CMsvEntry& iFolderEntry;
       
    91     
       
    92     // Sorting criteria
       
    93     const RArray<TFSMailSortCriteria>& iSortingCriteria;
       
    94     
       
    95     // String which separates the subject prefixes (Re, Fwd etc) 
       
    96     // from the actual subject
       
    97     TBuf<KMaxSubjectPrefixSeparatorLength> iSubjectPrefixSeparator;
       
    98     
       
    99     };
       
   100 
       
   101 #endif // IPSPLGMSGKEY_H