phonebookui/Phonebook2/UIControls/inc/CPbk2SelectFieldDlg.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 field selection dialog.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2SELECTFIELDDLG_H
       
    20 #define CPBK2SELECTFIELDDLG_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <CVPbkFieldFilter.h>
       
    25 #include <TPbk2IconId.h>
       
    26 #include "CPbk2FieldListBoxModel.h"
       
    27 #include <MVPbkContactStoreObserver.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MVPbkStoreContactField;
       
    31 class MVPbkStoreContactFieldCollection;
       
    32 class CPbk2PresentationContactFieldCollection;
       
    33 class MPbk2ControlKeyObserver;
       
    34 class CVPbkContactManager;
       
    35 class MPbk2FieldPropertyArray;
       
    36 class CPbk2FieldListBoxModel;
       
    37 class CPbk2PresenceIconInfo;
       
    38 class CPbk2FieldAnalyzer;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43  * Phonebook 2 field selection dialog.
       
    44  */
       
    45 NONSHARABLE_CLASS(CPbk2SelectFieldDlg) : 
       
    46         public CBase,
       
    47         public MVPbkContactStoreObserver
       
    48     {
       
    49     public: // Construction and destruction
       
    50 
       
    51         /**
       
    52          * Constructor.
       
    53          */
       
    54         CPbk2SelectFieldDlg();
       
    55 
       
    56         /**
       
    57          * Destructor.
       
    58          */
       
    59         ~CPbk2SelectFieldDlg();
       
    60 
       
    61     public: // From MVPbkContactStoreObserver
       
    62       void StoreReady(MVPbkContactStore& aContactStore);
       
    63       void StoreUnavailable(MVPbkContactStore& aContactStore, 
       
    64                       TInt aReason);
       
    65       void HandleStoreEventL(
       
    66                       MVPbkContactStore& aContactStore, 
       
    67                       TVPbkContactStoreEvent aStoreEvent);
       
    68       
       
    69     public: // Interface
       
    70 
       
    71         /**
       
    72          * Runs the dialog and returns selected field. Caller takes the
       
    73          * ownership of the field. Field is left to the cleanupstack
       
    74          * on return. NOTE: this object is deleted when this function
       
    75          * returns or leaves.
       
    76          *
       
    77          * @param aFieldCollection  Array of store contact fields.
       
    78          * @param aFieldCollectionArray  Array of store contact fields arrays.
       
    79          * @param aPresenceIconsArray  Presence icons array
       
    80          * @param aContactManager   Virtual Phonebook contact manager.
       
    81          * @param aFieldProperties  Phonebook 2 field properties.
       
    82          * @param aCbaResourceId    Softkey buttons for the control.
       
    83          * @param aCommMethod	    Communication method type selected
       
    84          * @param aHeading          Possible heading text for the control.
       
    85          * @param aFocusIndex       Field index to focus initially.
       
    86          *
       
    87          * @return  Returns the selected contact item field or NULL.
       
    88          * @see CPbk2SelectFieldDlg::TPbk2SelectFieldFlags
       
    89          */
       
    90         const MVPbkStoreContactField* ExecuteLCD(
       
    91                 MVPbkStoreContactFieldCollection& aFieldCollection,
       
    92                 RPointerArray<CVPbkFieldFilter>& aFieldCollectionArray,
       
    93                 const TArray<CPbk2PresenceIconInfo*>* aPresenceIconsArray,
       
    94                 const CVPbkContactManager& aContactManager,
       
    95                 const MPbk2FieldPropertyArray& aFieldProperties,
       
    96                 TInt aCbaResourceId,
       
    97                 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aCommMethod,
       
    98                 const TDesC& aHeading = KNullDesC,
       
    99                 TInt aFocusIndex = KErrNotFound );
       
   100 
       
   101         /**
       
   102          * Registers aKeyObserver as a key event observer of this control.
       
   103          * Only one observer is supported and setting a new one removes the
       
   104          * previous setting.
       
   105          *
       
   106          * @param aKeyObserver  Phonebook 2 control key observer.
       
   107          */
       
   108         void SetObserver(
       
   109                 MPbk2ControlKeyObserver* aKeyObserver );
       
   110 
       
   111         /**
       
   112          * Attempts to exit this dialog just like a soft button was pressed.
       
   113          * @see CAknPopupList::AttemptExitL(TBool).
       
   114          */
       
   115         void AttemptExitL(
       
   116                 TBool aAccept );
       
   117 
       
   118         /**
       
   119          * Sets given pointer to NULL when this dialog is destroyed.
       
   120          *
       
   121          * @param aSelfPtr      The pointer to use.
       
   122          * @precond !aSelfPtr || *aSelfPtr==this
       
   123          */
       
   124         void ResetWhenDestroyed(
       
   125                 CPbk2SelectFieldDlg** aSelfPtr );
       
   126 
       
   127     private: // Implementation
       
   128         void CreateListBoxL(
       
   129                 const CPbk2PresentationContactFieldCollection& aFieldCollection,
       
   130                 const TArray<CPbk2PresenceIconInfo*>* aPresenceIconsArray,
       
   131                 const CVPbkContactManager& aContactManager,
       
   132                 const MPbk2FieldPropertyArray& aFieldProperties,
       
   133                 TInt aCbaResourceId,
       
   134                 const TDesC& aHeading,
       
   135                 TInt aFocusIndex,
       
   136                 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aCommMethod);
       
   137 
       
   138     private: // Data
       
   139         /// Specialized list box class
       
   140         class CListBox;
       
   141         /// Own: List box inside the popup list
       
   142         CListBox* iListBox;
       
   143         /// Specialized popup list class
       
   144         class CPopupList;
       
   145         /// Own: Popup list query
       
   146         CPopupList* iPopupList;
       
   147         /// Ref: Key event observer
       
   148         MPbk2ControlKeyObserver* iKeyObserver;
       
   149         /// Ref: Set to ETrue in destructor
       
   150         TBool* iDestroyedPtr;
       
   151         /// Ref: Set to NULL when this dialog is destroyed.
       
   152         CPbk2SelectFieldDlg** iSelfPtr;
       
   153         /// Ref: list box model
       
   154         CPbk2FieldListBoxModel* iListBoxModel;
       
   155         /// Own: presentation fields for additional contacts
       
   156         RPointerArray<CPbk2PresentationContactFieldCollection>
       
   157             iFieldCollectionArray;
       
   158         /// Own: Array to keep presence icons positions in the common array
       
   159         RArray<CPbk2FieldListBoxModel::TPresenceIconPosInIconArray> iPresenceIconsPos;
       
   160         // Own: Field analyser
       
   161         CPbk2FieldAnalyzer* iFieldAnalyzer;
       
   162         /// Own: Current contact link
       
   163         MVPbkContactLink* iContactLink;
       
   164     };
       
   165 
       
   166 #endif // CPBK2SELECTFIELDDLG_H
       
   167 
       
   168 // End of File