phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherheadertextorder.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2008-2008 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:  Class which takes care of placing the correct texts in the header
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCAPPCOMMLAUNCHERHEADERTEXTORDER_H_
       
    20 #define CCAPPCOMMLAUNCHERHEADERTEXTORDER_H_
       
    21 
       
    22 // INCLUDES
       
    23 #include "ccappcommlauncherheaders.h"
       
    24 
       
    25 const TInt KCCAppCommLauncherHeaderTextOrderLineCount = 3;
       
    26 const TInt KCCAppCommLauncherHeaderTextOrderFirstField = CCmsContactFieldItem::ECmsLastName; 
       
    27 const TInt KCCAppCommLauncherHeaderTextOrderLastField = CCmsContactFieldItem::ECmsShareView;
       
    28 
       
    29 
       
    30 // CLASS DECLARATION
       
    31 /**
       
    32  * Class which takes care of placing the correct texts in the header
       
    33  *
       
    34  *  @code
       
    35  *   ?good_class_usage_example(s)
       
    36  *  @endcode
       
    37  *
       
    38  *  @lib ccappcommlauncherplugin.dll
       
    39  *  @since S60 v5.0
       
    40  */
       
    41 class CCCAppCommLauncherHeaderTextOrder : public CBase
       
    42     {
       
    43 public:
       
    44     // Construction & destruction
       
    45     /**
       
    46      * Two-phased constructor.
       
    47      */
       
    48     static CCCAppCommLauncherHeaderTextOrder* NewL();
       
    49  
       
    50     /**
       
    51      * Destructor.
       
    52      */
       
    53     ~CCCAppCommLauncherHeaderTextOrder();
       
    54 
       
    55     /**
       
    56      * Gets the text for a header row
       
    57      * 
       
    58      * @param aRow Row number (0-)
       
    59      * @return const TDesC& the text
       
    60      */
       
    61     const TDesC& GetTextForRow(TInt aRow);
       
    62     
       
    63 
       
    64     /**
       
    65      * Processes the contact data and determines which fields are used
       
    66      * 
       
    67      * @param aContactField The contact field info
       
    68      */
       
    69     void ProcessContactFieldsL(RArray<CCmsContactField> aCmsContactFields);
       
    70     
       
    71     /**
       
    72      * Resets the header texts
       
    73      */
       
    74     void Reset();
       
    75     
       
    76     /**
       
    77      * Clips the text
       
    78      * 
       
    79      * @param aFont The font which will be used for the text
       
    80      * @param aLineWidth Maximun width of a row in pixels
       
    81      */
       
    82     void ClipL(const CFont& aFont, TInt aLineWidth);
       
    83 private:
       
    84     /**
       
    85      * Constructor for performing 1st stage construction
       
    86      */
       
    87     CCCAppCommLauncherHeaderTextOrder();
       
    88 
       
    89     /**
       
    90      * Constructor for performing 2nd stage construction
       
    91      */
       
    92     void ConstructL();
       
    93 
       
    94     /**
       
    95      * Processes a contact field and puts the data in a row
       
    96      * 
       
    97      * @param aContactField The contact field
       
    98      */
       
    99     void ProcessContactFieldL(const CCmsContactField& aContactField);
       
   100         
       
   101     /**
       
   102      * Sets the priority of the given contact field type
       
   103      * 
       
   104      * @param aContactField The contact field
       
   105      * @param iGroup ETrue to set the group priority, 
       
   106      * @param aPriority Priority
       
   107      */
       
   108     void SetPriority(CCmsContactFieldItem::TCmsContactField aContactField, TBool aGroup, TInt aPriority);
       
   109     
       
   110     /**
       
   111      * Gets the priority of the given contact field type
       
   112      * 
       
   113      * @param aContactField The contact field
       
   114      * @return TInt priority
       
   115      */
       
   116     TInt GetPriority(CCmsContactFieldItem::TCmsContactField aContactField, TBool aGroup);
       
   117 
       
   118     /**
       
   119      * Determines whether the Contact Field is to used or skipped.
       
   120      * 
       
   121      * @param aContactField the field  
       
   122      * @return TInt aTopGroupPriority group to be used when determining. 
       
   123      */    
       
   124     void SelectContactFieldL(const CCmsContactField& aContactField, TInt aTopGroupPriority);
       
   125 
       
   126     /**
       
   127      * Determines stripped length of Contact Field Item
       
   128      * 
       
   129      * @param aCmsContactFieldItem the item 
       
   130      * @return TInt stripped length 
       
   131      */    
       
   132     TInt StrippedLengthL( const CCmsContactFieldItem& aCmsContactFieldItem);
       
   133 
       
   134     /**
       
   135      * Deletes a char from descriptor
       
   136      * 
       
   137      * @param aDest descriptor 
       
   138      * @param aChar character to be removed 
       
   139      */
       
   140     void DeleteCharL(TDes& aDest, TChar aChar);    
       
   141     
       
   142     /**
       
   143      * Maps a string to the corresponding contact field type
       
   144      * 
       
   145      * @param aDesc The string
       
   146      * @param aType Contact field is returned through the passed reference
       
   147      * @return TInt error code, KErrNotFound if there is no type corresponding to the string, KErrNone otherwise
       
   148      */
       
   149     TInt MapStringToContactField(const TDesC& aDesc, CCmsContactFieldItem::TCmsContactField& aType);
       
   150 
       
   151     /**
       
   152      * Tells which is the correct clipping direction for a contact field type
       
   153      * 
       
   154      * @param aType Contact field
       
   155      * @return TInt error code, KErrNotFound if there is no type corresponding to the string, KErrNone otherwise
       
   156      */
       
   157     AknTextUtils::TClipDirection MapContactFieldToClipDirection(CCmsContactFieldItem::TCmsContactField aType);
       
   158     
       
   159     /**
       
   160      * Count number of items corresponding current database
       
   161      * 
       
   162      * @param CCmsContactField Field to be checked
       
   163      * @return TInt number of items 
       
   164      */    
       
   165     TInt ItemCountForCurrentDbL( const CCmsContactField& aContactField );
       
   166     
       
   167     RPointerArray<HBufC> iHeaderRows;
       
   168     RPointerArray<HBufC> iHeaderRowsClipped;
       
   169     TInt iHeaderTypes[KCCAppCommLauncherHeaderTextOrderLineCount];
       
   170     
       
   171     TBool iHeadersWrapped;
       
   172     
       
   173     TInt iGroupPriorities[KCCAppCommLauncherHeaderTextOrderLastField - KCCAppCommLauncherHeaderTextOrderFirstField + 1];
       
   174     TInt iIndividualPriorities[KCCAppCommLauncherHeaderTextOrderLastField - KCCAppCommLauncherHeaderTextOrderFirstField + 1];
       
   175     HBufC* iCurrentDbName;
       
   176     };
       
   177 
       
   178 #endif /*CCAPPCOMMLAUNCHERHEADERTEXTORDER_H_*/