wvuing/wvuieng/EngSrc/CCAContactListModel.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 CCACONTACTLISTMODEL_H
       
    21 #define CCACONTACTLISTMODEL_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "MCAContactListModel.h"
       
    25 #include "MCASettingsObserver.h"
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MCAStoredContacts;
       
    30 class MCASettings;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  *  Contact list model for UI.
       
    36  *  Wrapper between UI and storage, hides multiple contact list handling logic.
       
    37  *
       
    38  *  @lib CAEngine.lib
       
    39  *  @since Series 60 3.0
       
    40  */
       
    41 class CCAContactListModel : public CBase,
       
    42             public MCAContactListModel,
       
    43             public MCASettingsObserver
       
    44     {
       
    45     public:  // Constructors and destructor
       
    46 
       
    47         /**
       
    48          * Two-phased constructor.
       
    49          * @param aSettingsInterface Settings interface
       
    50          */
       
    51         static CCAContactListModel* NewL( MCASettings& aSettingsInterface );
       
    52 
       
    53         /**
       
    54          * Destructor.
       
    55          */
       
    56         virtual ~CCAContactListModel();
       
    57 
       
    58 
       
    59     protected: // Functions from MCAContactListModel
       
    60 
       
    61         /**
       
    62          * @return Count of items
       
    63          */
       
    64         TInt Count() const;
       
    65 
       
    66         /**
       
    67          * Returns List item at given index.
       
    68          * @param aIndex
       
    69          * @return List item
       
    70          */
       
    71         SItem Item( TInt aIndex ) const;
       
    72 
       
    73         /**
       
    74          * Should the model show "All" item in beginning
       
    75          * of each contact list.
       
    76          * @param aShow If ETrue, first item in every contact list is "All"
       
    77          */
       
    78         void ShowAll( TBool aShow );
       
    79 
       
    80         /**
       
    81          * @see MCAContactListModel
       
    82          */
       
    83         TInt IndexOfContact( MCAStoredContact* aContact ) const;
       
    84 
       
    85         /**
       
    86          * @see MCAContactListModel
       
    87          */
       
    88         TInt IndexOfList( MCAContactList* aList,
       
    89                           TBool aIgnoreOwnItem /*= EFalse*/,
       
    90                           TBool aIgnoreEmptyLists /*= ETrue*/ ) const;
       
    91 
       
    92         /**
       
    93          * Set selection mode on/off
       
    94          * @param aSelectionMode ETrue if on. EFalse if off. Default is off.
       
    95          */
       
    96         void SetSelectionMode( TBool aSelectionMode );
       
    97 
       
    98         /**
       
    99          * Set primary contact lists in use
       
   100          */
       
   101         void SetPrimaryContactLists( TBool aPrimaryInUse );
       
   102 
       
   103         /**
       
   104          * Resets default filter.
       
   105          */
       
   106         void ResetDefaultFilter();
       
   107 
       
   108         /**
       
   109          * Sets default filter.
       
   110          * @param aFilter filter set to be default.
       
   111          */
       
   112         void SetDefaultFilter( TStorageManagerGlobals::TFilterType aFilter );
       
   113 
       
   114         /**
       
   115          * Sets filter.
       
   116          * @param aFilter filter set.
       
   117          */
       
   118         void SetFilter( TStorageManagerGlobals::TFilterType aFilter );
       
   119 
       
   120         /**
       
   121          * @return Filter in use.
       
   122          */
       
   123         TStorageManagerGlobals::TFilterType Filter() const;
       
   124 
       
   125         /**
       
   126         * Force the model in a state where every list is virtually
       
   127         * expanded. List's real expand/collapse state is kept intact.
       
   128         * @param aAllExpanded   ETrue: All list's are expanded
       
   129         *                       EFalse: Default behaviour
       
   130         */
       
   131         void ForceExpanded( TBool aAllExpanded );
       
   132 
       
   133         /**
       
   134         * Return the state of forced expand.
       
   135         * @return ETrue if force expand is active, EFalse othewise.
       
   136         */
       
   137         TBool IsForceExpanded() const;
       
   138 
       
   139         /**
       
   140          * @see MCAContactListModel
       
   141          */
       
   142         void MapContactListPositions( RArray<TInt>& aPositionArray );
       
   143 
       
   144         /**
       
   145          * Sets the correct sorting method to storage
       
   146          * according to current setting value
       
   147          */
       
   148         void SetSort();
       
   149 
       
   150     protected: // Functions from MCASettingsObserver
       
   151 
       
   152         /**
       
   153          * Handles setting changes.
       
   154          * @param aChangedSettingEnum specifies the changed setting.
       
   155          */
       
   156         void HandleSettingsChangeL( TInt aChangedSettingEnum );
       
   157 
       
   158     protected:  // Functions from MDesCArray
       
   159 
       
   160         /**
       
   161         * @see MDesCArray
       
   162         */
       
   163         TInt MdcaCount() const;
       
   164 
       
   165         /**
       
   166         * @see MDesCArray
       
   167         */
       
   168         TPtrC MdcaPoint( TInt aIndex ) const;
       
   169 
       
   170 
       
   171     private: // new functions
       
   172 
       
   173 
       
   174 
       
   175     private:
       
   176 
       
   177         /**
       
   178          * C++ default constructor.
       
   179          * @param aSettingsInterface Settings interface
       
   180          */
       
   181         CCAContactListModel( MCASettings& aSettingsInterface );
       
   182 
       
   183         /**
       
   184          * By default Symbian 2nd phase constructor is private.
       
   185          */
       
   186         void ConstructL();
       
   187 
       
   188     private:    // Data
       
   189 
       
   190         // doesn't own, storage interface for contacts
       
   191         MCAStoredContacts* iContacts;
       
   192 
       
   193         // reference to settings interface
       
   194         MCASettings& iSettings;
       
   195 
       
   196         // is "all" item displayed in beginning of each list
       
   197         TBool iShowAll;
       
   198 
       
   199         /// selection-mode on/off
       
   200         TBool iSelectionMode;
       
   201 
       
   202         // type of filtering contacts
       
   203         TStorageManagerGlobals::TFilterType iFilter;
       
   204 
       
   205         // type of filtering contacts, can be restored
       
   206         TStorageManagerGlobals::TFilterType iDefaultFilter;
       
   207 
       
   208         // Are all the contact lists forced to expanded state.
       
   209         // List's original states are preserved and they are only shown
       
   210         // expanded
       
   211         TBool iExpandAll;
       
   212     };
       
   213 
       
   214 #endif      // CCAContactListModel_H
       
   215 
       
   216 // End of File