wvuing/wvuieng/EngInc/MCAContactListModel.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Contact list model for UI
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MCACONTACTLISTMODEL_H
       
    21 #define MCACONTACTLISTMODEL_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "TStorageManagerGlobals.h"
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <bamdesca.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MCAContactList;
       
    31 class MCAStoredContact;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36  *  Contact list model for UI.
       
    37  *  Wrapper between UI and storage, hides multiple contact list handling logic.
       
    38  *
       
    39  *  @lib CAEngine.lib
       
    40  *  @since Series 60 3.0
       
    41  */
       
    42 class MCAContactListModel : public MDesCArray
       
    43     {
       
    44 
       
    45     public:	// Enumerations and typedefs
       
    46 
       
    47         enum TItemType
       
    48             {
       
    49             EInvalid,
       
    50             EOwnStatus,
       
    51             EContactList,
       
    52             EContactItem,
       
    53             EAll
       
    54             };
       
    55 
       
    56         struct SItem
       
    57             {
       
    58             TItemType iType;
       
    59             MCAContactList* iContactList;
       
    60             MCAStoredContact* iContact;
       
    61             };
       
    62 
       
    63     public: // New functions
       
    64 
       
    65         /**
       
    66          * @return Count of items
       
    67          */
       
    68         virtual TInt Count() const = 0;
       
    69 
       
    70         /**
       
    71          * Returns List item at given index.
       
    72          * @param aIndex
       
    73          * @return List item
       
    74          */
       
    75         virtual SItem Item( TInt aIndex ) const = 0;
       
    76 
       
    77         /**
       
    78          * Should the model show "All" item in beginning
       
    79          * of each contact list.
       
    80          * @param aShow If ETrue, first item in every contact list is "All"
       
    81          */
       
    82         virtual void ShowAll( TBool aShow ) = 0;
       
    83 
       
    84         /**
       
    85          * Get index for contact.
       
    86          * @param aContact. Contact item to be found.
       
    87          * @return Index of contact. If contact not found returns KErrNotFound
       
    88          */
       
    89         virtual TInt IndexOfContact( MCAStoredContact* aContact ) const = 0;
       
    90 
       
    91         /**
       
    92          * Get index for list
       
    93          * @param aList. Contact item to be found.
       
    94          * @param aIgnoreOwnItem. If ETrue own item is not taken into account
       
    95          *                        when resolving index.
       
    96          * @param aIgnoreEmptyLists If ETrue, empty lists are ignored.
       
    97          * @return Index of list. If list not found returns KErrNotFound
       
    98          */
       
    99         virtual TInt IndexOfList( MCAContactList* aList,
       
   100                                   TBool aIgnoreOwnItem = EFalse,
       
   101                                   TBool aIgnoreEmptyLists = ETrue ) const = 0;
       
   102 
       
   103         /**
       
   104          * Set selection mode of contact list model.
       
   105          * @param aSelectionMode. ETrue selection mode on. EFalse -> off.
       
   106          */
       
   107         virtual void SetSelectionMode( TBool aSelectionMode ) = 0;
       
   108 
       
   109         /**
       
   110          * Set primary contact list properties in use. Secondary is used
       
   111          * for example with selection mode.
       
   112          * @param aPrimaryInUse. ETrue primary. EFalse secondary.
       
   113          */
       
   114         virtual void SetPrimaryContactLists( TBool aPrimaryInUse ) = 0;
       
   115 
       
   116         /**
       
   117          * Resets default filter.
       
   118          */
       
   119         virtual void ResetDefaultFilter() = 0;
       
   120 
       
   121         /**
       
   122          * Sets default filter.
       
   123          * @param aFilter filter set to be default.
       
   124          */
       
   125         virtual void SetDefaultFilter( TStorageManagerGlobals::TFilterType aFilter ) = 0;
       
   126 
       
   127         /**
       
   128          * Sets filter.
       
   129          * @param aFilter filter set.
       
   130          */
       
   131         virtual void SetFilter( TStorageManagerGlobals::TFilterType aFilter ) = 0;
       
   132 
       
   133         /**
       
   134          * @return Filter in use.
       
   135          */
       
   136         virtual TStorageManagerGlobals::TFilterType Filter() const = 0;
       
   137 
       
   138         /**
       
   139         * Force the model in a state where every list is virtually
       
   140         * expanded. List's real expand/collapse state is kept intact.
       
   141         * @param aAllExpanded   ETrue: All list's are expanded
       
   142         *                       EFalse: Default behaviour
       
   143         */
       
   144         virtual void ForceExpanded( TBool aAllExpanded ) = 0;
       
   145 
       
   146         /**
       
   147         * Return the state of forced expand.
       
   148         * @return ETrue if force expand is active, EFalse othewise.
       
   149         */
       
   150         virtual TBool IsForceExpanded() const = 0;
       
   151 
       
   152         /**
       
   153          * Construct an array of contact list positions in model.
       
   154          * aPositionArray is cleared before appending positions!
       
   155          * @param aPositionArray array in which to store positions
       
   156          * @return none
       
   157          */
       
   158         virtual void MapContactListPositions( RArray<TInt>& aPositionArray ) = 0;
       
   159 
       
   160         /**
       
   161          * Sets the correct sorting method to storage
       
   162          * according to current setting value
       
   163          */
       
   164         virtual void SetSort() = 0;
       
   165 
       
   166     public:  // From MDesCArray
       
   167 
       
   168         /**
       
   169         * @see MDesCArray
       
   170         */
       
   171         TPtrC MdcaPoint( TInt aIndex ) const = 0;
       
   172 
       
   173         /**
       
   174         * @see MDesCArray
       
   175         */
       
   176         TInt MdcaCount() const = 0;
       
   177 
       
   178 
       
   179     protected:	// prevent deletion through this interface
       
   180 
       
   181         /**
       
   182          * Destructor.
       
   183          */
       
   184         virtual ~MCAContactListModel() {};
       
   185 
       
   186     };
       
   187 
       
   188 #endif      // MCAContactListModel_H
       
   189 
       
   190 // End of File