phonebookui/Phonebook/View/inc/TPbkAddItemManager.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *    Phonebook add item manager.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __TPbkAddItemManager_H__
       
    21 #define __TPbkAddItemManager_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>        // CBase
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CPbkFieldInfoGroup;
       
    28 class CPbkContactItem;
       
    29 class CPbkFieldsInfo;
       
    30 class TPbkAddItemWrapper;
       
    31 class MPbkContactEditorCreateField;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36  * Manages the add field operation for a contact item. Uses 
       
    37  * CPbkMemoryEntrySelectAddItemDlg for querying the field(s)
       
    38  * to add.
       
    39  */
       
    40 NONSHARABLE_CLASS(TPbkAddItemManager)
       
    41     {
       
    42     public:  // Constructors and destructor        
       
    43         /**
       
    44          * C++ Constructor.
       
    45          * @param aItem   Contact item, which is the target for
       
    46          *                field adding operation.
       
    47 		 * @param aAddField	managerial object that does the field adding.
       
    48          */        
       
    49         TPbkAddItemManager(CPbkContactItem& aItem,
       
    50 			MPbkContactEditorCreateField& aAddField);
       
    51 
       
    52         /**
       
    53          * Destructor.
       
    54          */
       
    55         ~TPbkAddItemManager();
       
    56     
       
    57     public:  // implementation
       
    58          /**
       
    59          * Queries for the field to add and adds the selected 
       
    60          * field(s) to the contact.
       
    61          * @param aFieldsInfo   Fieldsinfo instance.
       
    62          * @param aAddedItemsControlIds As return contains
       
    63 		 *        all the control id of the controls
       
    64          *        which were added to the dialog.
       
    65          */
       
    66         void AddFieldsL(
       
    67             const CPbkFieldsInfo& aFieldsInfo,
       
    68             RArray<TInt>& aAddedItemsControlIds);
       
    69 
       
    70     private:  // Implementation
       
    71         TBool ContactHasGroupItems(
       
    72             const CPbkFieldInfoGroup& aGroup) const;
       
    73         void AddFieldsToContactL(
       
    74             const TPbkAddItemWrapper& aItemWrapper,
       
    75             RArray<TInt>& aAddedItemsControlIds);       
       
    76         void CreateAddItemArrayL(
       
    77             const CPbkFieldsInfo& aFieldsInfo,
       
    78             RArray<TPbkAddItemWrapper>& aAddItems) const;
       
    79 
       
    80     private:  // Data
       
    81         /// Ref: to the contact item where fields are added
       
    82         const CPbkContactItem&    iContactItem;
       
    83 		/// Ref: the field adding managerial class
       
    84 		MPbkContactEditorCreateField& iAddField;
       
    85     };
       
    86 
       
    87 #endif // __TPbkAddItemManager_H__
       
    88 
       
    89 // End of File