phonebookui/Phonebook2/UIControls/inc/CPbk2ContactInfoListBox.h
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Phonebook 2 contact info list box.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2CONTACTINFOLISTBOX_H
       
    20 #define CPBK2CONTACTINFOLISTBOX_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "MPbk2ClipListBoxText.h"
       
    24 #include "CPbk2FieldAnalyzer.h"
       
    25 #include <TPbk2IconId.h>
       
    26 #include <aknlists.h>
       
    27 #include <MPbk2PointerEventInspector.h>
       
    28 #include <MVPbkContactAttributeManager.h>
       
    29 
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CVPbkContactManager;
       
    33 class CPbk2PresentationContactFieldCollection;
       
    34 class CItemDrawer;
       
    35 class CPbk2FieldListBoxModel;
       
    36 class CPbk2ContactInfoDataSwapper;
       
    37 class MPbk2FieldPropertyArray;
       
    38 class CPbk2ContactFieldDynamicProperties;
       
    39 class MVPbkContactOperationBase;
       
    40 
       
    41 /**
       
    42  * Phonebook 2 contact info list box.
       
    43  */
       
    44 NONSHARABLE_CLASS(CPbk2ContactInfoListBox) :
       
    45         public CAknFormDoubleGraphicStyleListBox,
       
    46         public MPbk2ClipListBoxText,
       
    47         public MPbk2PointerEventInspector,
       
    48         public MVPbkMultiAttributePresenceObserver
       
    49     {
       
    50     public: // Constructors and destructor
       
    51 
       
    52         /**
       
    53          * Creates a new instance of this class.
       
    54          *
       
    55          * @param aContainer    The control container for this control.
       
    56          * @param aResourceId   The resource id from where to construct
       
    57          *                      this object from.
       
    58          * @param aManager      Virtual phonebook contact manager.
       
    59          * @return  A new instance of this class.
       
    60          */
       
    61         static CPbk2ContactInfoListBox* NewL(
       
    62                 CCoeControl& aContainer,
       
    63                 TInt aResourceId,
       
    64                 CVPbkContactManager& aManager );
       
    65 
       
    66         /**
       
    67          * Destructor.
       
    68          */
       
    69         ~CPbk2ContactInfoListBox();
       
    70 
       
    71     public: // Interface
       
    72 
       
    73         /**
       
    74          * Prepares the data for updating, i.e. replacing the shown
       
    75          * contact with a new one.
       
    76          *
       
    77          * @param aDataSwapper          Utility class for data
       
    78          *                              storage and swapping.
       
    79          * @param aFieldCollection      Contact's fields.
       
    80          * @param aFieldProperties      Field properties.
       
    81          * @param aDynamicProperties    Dynamic field properties.
       
    82          */
       
    83         void PrepareForUpdateL(
       
    84                 CPbk2ContactInfoDataSwapper& aDataSwapper,
       
    85                 const CPbk2PresentationContactFieldCollection& aFieldCollection,
       
    86                 MPbk2FieldPropertyArray& aFieldProperties,
       
    87                 const CPbk2ContactFieldDynamicProperties* aDynamicProperties );
       
    88 
       
    89         /**
       
    90          * Updates list box content with the data got from the data swapper.
       
    91          *
       
    92          * @param aDataSwapper  Utility class for data storage and swapping.
       
    93          * @param aContact      Store contact.
       
    94          */
       
    95         void DoUpdateL(
       
    96                 CPbk2ContactInfoDataSwapper& aDataSwapper,
       
    97                 MVPbkStoreContact& aContact );
       
    98 
       
    99         /**
       
   100          * Returns the number of items in the list box currently.
       
   101          *
       
   102          * @return  Number of items in the listbox.
       
   103          */
       
   104         TInt NumberOfItems() const;
       
   105 
       
   106         /**
       
   107          * Returns list box selection status.
       
   108          *
       
   109          * @return  ETrue if there are items marked, EFalse otherwise.
       
   110          */
       
   111         TBool ContactsMarked() const;
       
   112 
       
   113         /**
       
   114          * Returns current item index.
       
   115          *
       
   116          * @return  Current item index.
       
   117          */
       
   118         TInt CurrentItemIndex() const;
       
   119 
       
   120         /**
       
   121          * Handles resource change events.
       
   122          * @see CCoeControl::HandleResourceChange
       
   123          *
       
   124          * @param aType Resource change type.
       
   125          */
       
   126         void DoHandleResourceChangeL(
       
   127                 const TInt aType ) const;
       
   128 
       
   129         /**
       
   130          * Returns flags read from the resource file.
       
   131          *
       
   132          * @return  Flags from resource file (TResourceData.iFlags).
       
   133          */
       
   134         TUint Flags() const;
       
   135 
       
   136         /**
       
   137          * Sets the scroll event observer.
       
   138          */
       
   139         void SetScrollEventObserver(MEikScrollBarObserver* aObserver);
       
   140 
       
   141     public: // From CEikColumnListBox
       
   142         class CItemDrawer;
       
   143         CItemDrawer* ItemDrawer() const;
       
   144         void CreateItemDrawerL();
       
   145         void HandlePointerEventL(
       
   146                 const TPointerEvent& aPointerEvent );
       
   147         void HandleScrollEventL( CEikScrollBar* aScrollBar, 
       
   148                                  TEikScrollEvent aEventType );
       
   149 
       
   150     private: // From MPbk2ClipListBoxText
       
   151         TBool ClipFromBeginning(
       
   152                 TDes& aBuffer,
       
   153                 TInt aItemIndex,
       
   154                 TInt aSubCellNumber );
       
   155 
       
   156     public: // From MPbk2PointerEventInspector
       
   157         TBool FocusedItemPointed();
       
   158         TBool FocusableItemPointed();
       
   159         TBool SearchFieldPointed();
       
   160 
       
   161     private: // from MVPbkMultiAttributePresenceObserver
       
   162         void AttributePresenceOperationComplete(
       
   163             MVPbkContactOperationBase& aOperation, 
       
   164             MVPbkStoreContactFieldCollection* aResult);
       
   165         void AttributePresenceOperationFailed(
       
   166             MVPbkContactOperationBase& aOperation, TInt aError);
       
   167 
       
   168     private: // Implementation
       
   169         CPbk2ContactInfoListBox(
       
   170                 CVPbkContactManager& aManager );
       
   171         void ConstructL(
       
   172                 CCoeControl& aContainer,
       
   173                 TInt aResourceId );
       
   174         CPbk2FieldListBoxModel* CreateListBoxModelL(
       
   175                 const CVPbkContactManager& aContactManager,
       
   176                 const CPbk2PresentationContactFieldCollection& aFieldCollection,
       
   177                 MPbk2FieldPropertyArray& aFieldProperties,
       
   178                 const CPbk2ContactFieldDynamicProperties* aDynamicProperties );
       
   179         void DoCreateVoiceTagRetrieverL(MVPbkStoreContact& aContact);
       
   180         void DoRefreshListBoxContentL(
       
   181             MVPbkStoreContactFieldCollection* aResult);
       
   182 
       
   183     private: // Data loaded from resources
       
   184         struct TResourceData
       
   185             {
       
   186             /// Own: Flags
       
   187             TUint iFlags;
       
   188             /// Own: Text to use for unnamed entries
       
   189             HBufC* iUnnamedText;
       
   190             /// Own: Empty icon id
       
   191             TPbk2IconId iEmptyIconId;
       
   192             /// Own: Default icon id
       
   193             TPbk2IconId iDefaultIconId;
       
   194             /// Own: Listbox empty text in find state
       
   195             HBufC* iFindEmptyText;
       
   196             };
       
   197 
       
   198     private: // Data
       
   199         /// Own: Data loaded from resources
       
   200         TResourceData iResourceData;
       
   201         /// Own: List box model
       
   202         MDesC16Array* iModel;
       
   203         /// Own: Field analyzer
       
   204         CPbk2FieldAnalyzer* iFieldAnalyzer;
       
   205         /// Ref: Field collection
       
   206         const CPbk2PresentationContactFieldCollection* iFieldCollection;
       
   207         /// Ref: Virtual Phonebook contact manager
       
   208         CVPbkContactManager& iManager;
       
   209         /// Own: ETrue, if user tapped a focusable item in the list
       
   210         TBool iFocusableItemPointed;
       
   211         /// Own: ETrue, if user tapped a previously focused item in the list
       
   212         TBool iFocusedItemPointed;
       
   213         /// Own: Voice tag retrieval operation
       
   214         MVPbkContactOperationBase* iVoiceTagFindOperation;
       
   215         /// Ref: scroll event observer
       
   216         MEikScrollBarObserver* iScrollEventObserver;
       
   217 
       
   218     };
       
   219 
       
   220 #endif // CPBK2CONTACTINFOLISTBOX_H
       
   221 
       
   222 // End of File