phonebookui/Phonebook/View/inc/CPbkContactViewListModelCommon.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *    Phonebook contact view listbox model.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CPbkContactViewListModelCommon_H__
       
    21 #define __CPbkContactViewListModelCommon_H__
       
    22 
       
    23 
       
    24 //  INCLUDES
       
    25 #include "CPbkContactViewListModelBase.h"
       
    26 #include <cntviewbase.h>    // RContactViewSortOrder
       
    27 #include "PbkIconId.hrh"    // TPbkIconId
       
    28 #include "PbkContactViewListModelFactory.h"
       
    29 
       
    30 
       
    31 //  FORWARD DECLARATIONS
       
    32 class CPbkIconArray;
       
    33 class MPbkContactUiControlExtension;
       
    34 class CPbkExtGlobals;
       
    35 /// Use for testing only!!!
       
    36 class CPbkContactViewListModel_TestAccess;
       
    37 
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42  * Offers some basic functionality for listbox models 
       
    43  * used with CPbkContactViewListControl.
       
    44  */
       
    45 NONSHARABLE_CLASS(CPbkContactViewListModelCommon) : 
       
    46         public CPbkContactViewListModelBase,
       
    47         public MPbkContactViewListModel
       
    48     {   
       
    49     public:  // from MDesCArray
       
    50         TInt MdcaCount() const;
       
    51         TPtrC MdcaPoint(TInt aIndex) const;
       
    52 
       
    53     public: // From MPbkContactViewListModel
       
    54         void SetUnnamedText(const TDesC* aText);
       
    55         void SetContactUiControlExtension
       
    56                 (MPbkContactUiControlExtension& aControlExtension);
       
    57         void RefreshSortOrderL();
       
    58 
       
    59     protected: // Constructor and destructor.
       
    60         /**
       
    61          * Constructor.
       
    62 		 * @param aParams @see PbkContactViewListModelFactory
       
    63          */ 
       
    64         CPbkContactViewListModelCommon(
       
    65             PbkContactViewListModelFactory::TParams& aParams);
       
    66 
       
    67         /**
       
    68          * Second phase constructor.
       
    69          */ 
       
    70         void ConstructL();
       
    71 
       
    72         /**
       
    73          * Destructor.
       
    74          */ 
       
    75         ~CPbkContactViewListModelCommon();
       
    76 
       
    77     protected:  // from CPbkContactViewListModelBase
       
    78         void AddDynamicIconL(const CViewContact& aViewContact) const;
       
    79         void FormatBufferForGroupL(const CViewContact& aViewContact) const;
       
    80         void FormatEmptyBuffer() const;
       
    81 
       
    82     protected:  // Implementation
       
    83         void AppendIconIndex(TPbkIconId aIconId) const;
       
    84         void AppendName(const TDesC& aName) const;
       
    85         const RContactViewSortOrder& ViewSortOrder() const;
       
    86         void AddIconL(TPbkIconId aIconId) const;
       
    87         
       
    88     private: // Constructor
       
    89         /**
       
    90         * Constructor.
       
    91         */
       
    92         CPbkContactViewListModelCommon();
       
    93 
       
    94         /// Use for testing only!!!
       
    95         friend class CPbkContactViewListModel_TestAccess;
       
    96 
       
    97     private:  // Data
       
    98         enum 
       
    99             {
       
   100             /// Maximum length of a formatted list box item text 
       
   101             KMaxListBoxText = 256
       
   102             };
       
   103         /// Own: buffer for formatted list box item text
       
   104         TBuf<KMaxListBoxText> iFormattingBuffer;
       
   105         /// Own: index of the group label field
       
   106         TInt iGroupLabelFieldIndex;
       
   107         /// Ref: text to use for unnamed items
       
   108         const TDesC* iUnnamedText;
       
   109         /// Ref: icon index mapping array
       
   110         CPbkIconArray* iIconArray;
       
   111         /// Own: empty icon id
       
   112         TPbkIconId iEmptyIconId;
       
   113         /// Own: default icon id to use for all rows if != EPbkNullIconId.
       
   114         TPbkIconId iDefaultIconId;
       
   115         /// Own: view's sort order
       
   116         RContactViewSortOrder iViewSortOrder;
       
   117         /// Ref: for updating dynamic icon
       
   118         MPbkContactUiControlExtension* iControlExtension;
       
   119     };
       
   120 
       
   121 
       
   122 #endif // __CPbkContactViewListModelCommon_H__
       
   123 
       
   124 // End of File