phonebookui/Phonebook2/inc/CPbk2AddressSelect.h
changeset 0 e686773b3f54
child 21 b3431bff8c19
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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 address selection.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2ADDRESSSELECT_H
       
    20 #define CPBK2ADDRESSSELECT_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <coedef.h>   // TKeyResponse
       
    25 #include <w32std.h>   // TKeyEvent, TEventCode
       
    26 #include <MPbk2DialogEliminator.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MVPbkStoreContactField;
       
    30 class CVPbkFieldTypeSelector;
       
    31 class CVPbkFieldFilter;
       
    32 class CPbk2SelectFieldDlg;
       
    33 class TPbk2AddressSelectParams;
       
    34 class MVPbkContactAttributeManager;
       
    35 class MVPbkStoreContact;
       
    36 class CPbk2PresenceIconInfo;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41  * Phonebook 2 address selection.
       
    42  * Responsible for selecting an appropriate contact field
       
    43  * from given contact. The selection is based on the
       
    44  * given parameters.
       
    45  */
       
    46 class CPbk2AddressSelect : public CBase,
       
    47                            public MPbk2DialogEliminator
       
    48     {
       
    49     public: // Construction and destruction
       
    50 
       
    51         /**
       
    52          * Creates a new instance of this class.
       
    53          *
       
    54          * @param aParams   Address select parameters.
       
    55          * @return  A new instance of this class.
       
    56          */
       
    57         IMPORT_C static CPbk2AddressSelect* NewL(
       
    58                 TPbk2AddressSelectParams& aParams );
       
    59                 
       
    60         /**
       
    61          * Creates a new instance of this class.
       
    62          *
       
    63          * @param aParams   Address select parameters.
       
    64          * @param aFieldTypeSelector   Field type selector.
       
    65          * @param aStoreContactsArray  Additional contacts
       
    66          * @param aPresenceIconsArray  Presence icons array
       
    67          * @return  A new instance of this class.
       
    68          */
       
    69         IMPORT_C static CPbk2AddressSelect* NewL(
       
    70                 TPbk2AddressSelectParams& aParams,
       
    71                 CVPbkFieldTypeSelector& aFieldTypeSelector,
       
    72                 const TArray<MVPbkStoreContact*>* aStoreContactsArray,
       
    73                 const TArray<CPbk2PresenceIconInfo*>* aPresenceIconsArray );
       
    74 
       
    75         /**
       
    76          * Destructor.
       
    77          * Cancels address selection query if active.
       
    78          */
       
    79         IMPORT_C ~CPbk2AddressSelect();
       
    80 
       
    81     public: // Interface
       
    82 
       
    83         /**
       
    84          * Runs an address selection query (if necessary).
       
    85          * Note! The caller is responsible for the contact field
       
    86          * object returned.
       
    87          *
       
    88          * @return  NULL if query was cancelled, selected field if
       
    89          *          query was accepted. Caller takes the ownership
       
    90          *          of the returned field.
       
    91          */
       
    92         IMPORT_C MVPbkStoreContactField* ExecuteLD();
       
    93 
       
    94         /**
       
    95          * Exit any address selection query. Makes ExecuteLD return
       
    96          * which means this object is destroyed after this function returns!
       
    97          *
       
    98          * @param aAccept   ETrue means the query selection is accepted and
       
    99          *                  EFalse that query is canceled.
       
   100          */
       
   101         IMPORT_C void AttemptExitL(
       
   102                 TBool aAccept );
       
   103 
       
   104         /**
       
   105          * Override to handle key events in the list query.
       
   106          *
       
   107          * @param aKeyEvent     Key event.
       
   108          * @param aType         Key event type.
       
   109          * @return  EKeyWasConsumed if the key event was consumed,
       
   110          *          EKeyWasNotConsumed otherwise.
       
   111          */
       
   112         IMPORT_C virtual TKeyResponse Pbk2ControlKeyEventL(
       
   113                 const TKeyEvent& aKeyEvent,
       
   114                 TEventCode aType );
       
   115 
       
   116         /**
       
   117          * Sets CBA button labels if needed.
       
   118          * Overrides buttons defined in the resource file.
       
   119          */
       
   120         IMPORT_C void SetCba(
       
   121                 TInt aCbaResourceId );
       
   122         
       
   123     public: // From MPbk2DialogEliminator
       
   124         void RequestExitL(
       
   125                 TInt aCommandId );
       
   126         void ForceExit();
       
   127         void ResetWhenDestroyed(
       
   128                 MPbk2DialogEliminator** aSelfPtr );
       
   129 
       
   130     private: // Implementation
       
   131         CPbk2AddressSelect(
       
   132                 TPbk2AddressSelectParams& aParams,
       
   133                 const TArray<MVPbkStoreContact*>* aStoreContactsArray,
       
   134                 const TArray<CPbk2PresenceIconInfo*>* aPresenceIconsArray );
       
   135         void ConstructL( 
       
   136             CVPbkFieldTypeSelector* aFieldTypeSelector );
       
   137         TBool AddressField(
       
   138                 const MVPbkStoreContactField& aField ) const;
       
   139         void NoAddressesL(
       
   140                 TPbk2AddressSelectParams aParams ) const;
       
   141         void SelectFieldL();
       
   142         void SelectFromApplicableFieldsL();
       
   143         TInt IndexOfDefaultFieldL();
       
   144         TBool SelectFromDefaultFieldsL();
       
   145         MVPbkStoreContactField* FindDefaultFieldLC();
       
   146         void SetSelectedFieldL(
       
   147                 const MVPbkStoreContactField* aField );
       
   148         HBufC* LoadDialogTitleL();
       
   149         TBool AreGeoFieldsForAddressesL();
       
   150         HBufC* GetVOIPDialogTitleL();
       
   151 
       
   152     private: // Friends
       
   153         /// Field selection dialog for this class
       
   154         class CSelectFieldDlg;
       
   155         friend class CSelectFieldDlg;
       
   156 
       
   157     private: // Data
       
   158         /// Ref: Address select parameters
       
   159         TPbk2AddressSelectParams& iParams;
       
   160         /// Own: Field type selector
       
   161         CVPbkFieldTypeSelector* iFieldTypeSelector;
       
   162         /// Own: Field filter
       
   163         CVPbkFieldFilter* iFieldFilter;
       
   164         /// Own: Field selection dialog
       
   165         CPbk2SelectFieldDlg* iFieldDlg;
       
   166         /// Ref: Set to ETrue when the execution enters destructor
       
   167         TBool* iDestroyedPtr;
       
   168         /// Ref: The selected field
       
   169         MVPbkStoreContactField* iSelectedField;
       
   170         /// Ref: Virtual Phonebook attribute manager
       
   171         MVPbkContactAttributeManager* iAttributeManager;
       
   172         /// Own: No addresses for a name prompt text resource id
       
   173         TInt iNoAddressesForNamePromptResource;
       
   174         /// Own: No address prompt text resource id
       
   175         TInt iNoAddressesPromptResource;
       
   176         /// Own: Soft key resource id
       
   177         TInt iSoftKeyResource;
       
   178         /// Ref: Set to NULL when the execution enters destructor
       
   179         MPbk2DialogEliminator** iSelfPtr;
       
   180         /// Ref: Additional contacts
       
   181         const TArray<MVPbkStoreContact*>* iStoreContactsArray;
       
   182         /// Own: Field filter array for additional contacts
       
   183         RPointerArray<CVPbkFieldFilter> iFieldFilterArray;
       
   184         /// Ref: Presence icons array
       
   185         const TArray<CPbk2PresenceIconInfo*>* iPresenceIconsArray;
       
   186     };
       
   187 
       
   188 #endif // CPBK2ADDRESSSELECT_H
       
   189 
       
   190 // End of File