phonebookui/Phonebook2/UIControls/inc/CPbk2AddItemManager.h
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Manages adding new items to the contact
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2ADDITEMMANAGER_H
       
    20 #define CPBK2ADDITEMMANAGER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2FieldProperty.h>
       
    25 #include "TPbk2ContactEditorParams.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CPbk2PresentationContact;
       
    29 class MPbk2ContactEditorFieldArray;
       
    30 class MPbk2FieldPropertyArray;
       
    31 class TPbk2AddItemWrapper;
       
    32 class MVPbkStoreContact;
       
    33 class CPbk2FieldGroupPropertyArray;
       
    34 class MPbk2ApplicationServices;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 
       
    39 /**
       
    40  *  Manages adding new items to the contact.
       
    41  *
       
    42  */
       
    43 NONSHARABLE_CLASS(CPbk2AddItemManager) : public CBase
       
    44     {
       
    45     public:  // Constructors and destructor
       
    46     	class TReturnValue
       
    47     		{
       
    48     		public:
       
    49     			TReturnValue()
       
    50     			:iGruopId(EPbk2FieldGroupIdNone), 
       
    51     			iControlId(KErrNone)
       
    52 				{}
       
    53 	
       
    54     		public:
       
    55     			TInt iControlId;
       
    56     			TPbk2FieldGroupId iGruopId;
       
    57 	};
       
    58 
       
    59         /**
       
    60          * Creates a new instance of this class.
       
    61          *
       
    62          * @param aContact          The contact to add fields.
       
    63          * @param aFieldArray       The field array for adding new fields.
       
    64          * @return  A new instance of this class.
       
    65          */
       
    66         static CPbk2AddItemManager* NewL(
       
    67                 CPbk2PresentationContact& aContact,
       
    68                 MPbk2ContactEditorFieldArray& aFieldArray, 
       
    69                 TPbk2ContactEditorParams& aParams,
       
    70                 MPbk2ApplicationServices* aAppServices );
       
    71 
       
    72         /**
       
    73          * Destructor.
       
    74          */
       
    75         ~CPbk2AddItemManager();
       
    76 
       
    77     public: // Interface
       
    78         /**
       
    79          * Executes the add item dialog and returns the control id
       
    80          * of the field that was added upmost.
       
    81          *
       
    82          * @param aFieldTypeResId   Add item field type resource id.
       
    83          *                          If positive or zero, the list box
       
    84          *                          will not be run, but a corresponding
       
    85          *                          control id will be returned.
       
    86          *                          If negative, the list box will be run
       
    87          *                          and selected index will be returned.
       
    88          * @param aFieldTypeXspName Add item field type xSP name.
       
    89          * @return  The control id.
       
    90          */
       
    91     	TReturnValue AddFieldsL(
       
    92                 TInt& aFieldTypeResId, TPtrC& aFieldTypeXspName);
       
    93             
       
    94     private:  // Implementation
       
    95         CPbk2AddItemManager(
       
    96                 CPbk2PresentationContact& aContact,
       
    97                 MPbk2ContactEditorFieldArray& aFieldArray, 
       
    98                 TPbk2ContactEditorParams& aParams,
       
    99                 MPbk2ApplicationServices* aAppServices );
       
   100         TReturnValue AddFieldsToUiAndContactL(
       
   101                 const TPbk2AddItemWrapper& aWrapper );
       
   102         TReturnValue RunDialogAndAddFieldsL(
       
   103                 RArray<TPbk2AddItemWrapper>& aWrappers,
       
   104                 TInt& aFieldTypeResId,
       
   105                 TPtrC& aFieldTypeXspName );
       
   106         void AddPhoneMemoryFieldTypesL(
       
   107                 CArrayPtr<const MPbk2FieldProperty>& aProperties );
       
   108         TReturnValue DoAddFieldsL(
       
   109                 CArrayPtr<const MPbk2FieldProperty>& aProperties,
       
   110                 TInt& aFieldTypeResId,
       
   111                 TPtrC& aFieldTypeXspName );
       
   112         TBool IsFieldAdditionPossibleL(
       
   113                 const CPbk2PresentationContact& aContact,
       
   114                 const MPbk2FieldProperty& aProperty );
       
   115         void MakePhoneContactL(
       
   116                 const CPbk2PresentationContact& aContact );
       
   117 
       
   118     private: // Data
       
   119         /// Ref: The contact to add fields
       
   120         CPbk2PresentationContact* iContact;
       
   121         /// Ref: The UI field array for adding new fields
       
   122         MPbk2ContactEditorFieldArray* iFieldArray;
       
   123         /// Ref: The field properties
       
   124         const MPbk2FieldPropertyArray* iProperties;
       
   125         /// Own: Temporary phone memory presentation contact
       
   126         CPbk2PresentationContact* iTemporaryPresentationContact;
       
   127         /// Own: Temporary phone memory store contact
       
   128         MVPbkStoreContact* iTemporaryStoreContact;
       
   129         /// Own: field group properties
       
   130         CPbk2FieldGroupPropertyArray* iGroupProperties;
       
   131         /// Own: field type xSP name
       
   132         HBufC* iXSpName;
       
   133         /// Ref: Editor parameters
       
   134         TPbk2ContactEditorParams& iParams;
       
   135         // Ref: Pbk2 application services
       
   136         MPbk2ApplicationServices* iAppServices;
       
   137     };
       
   138 
       
   139 #endif // CPBK2ADDITEMMANAGER_H
       
   140             
       
   141 // End of File