phonebookui/Phonebook2/USIMExtension/inc/CPsu2ContactCopyPolicy.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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:  A copy policy for copying to sim store
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPSU2CONTACTCOPYPOLICY_H
       
    20 #define CPSU2CONTACTCOPYPOLICY_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <CVPbkContactCopyPolicy.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CPbk2FieldPropertyArray;
       
    27 class CPsu2CopyToSimFieldInfoArray;
       
    28 class CPsu2SimContactProcessor;
       
    29 class CPbk2SortOrderManager;
       
    30 class MPbk2ContactNameFormatter;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  A copy policy for copying to sim store
       
    36 *
       
    37 */
       
    38 class CPsu2ContactCopyPolicy : public CVPbkContactCopyPolicy
       
    39     {
       
    40     public:  // Constructors and destructor        
       
    41         /**
       
    42          * Two-phased constructor.
       
    43          * @param aParam parameters defined in virtual phonebook
       
    44          * @return a new instance of this class
       
    45          */
       
    46         static CPsu2ContactCopyPolicy* NewL(TParam* aParam);
       
    47         
       
    48         /**
       
    49         * Destructor.
       
    50         */
       
    51         ~CPsu2ContactCopyPolicy();
       
    52     
       
    53     public: // New functions
       
    54     
       
    55         /**
       
    56         * Returns the phonebook2 field properties
       
    57         * @return the phonebook2 field properties
       
    58         */
       
    59         inline CPbk2FieldPropertyArray& FieldProperties() const;
       
    60         
       
    61         /**
       
    62         * Returns the copy to sim field information
       
    63         * @return the copy to sim field information
       
    64         */
       
    65         inline CPsu2CopyToSimFieldInfoArray& SimFieldInfos() const;
       
    66         
       
    67         /**
       
    68         * Returns the sim contact processor
       
    69         * @return the sim contact processor
       
    70         */
       
    71         inline CPsu2SimContactProcessor& SimContactProcessor() const;
       
    72         
       
    73     public: // Functions from base classes
       
    74 
       
    75         /**
       
    76         * From MVPbkContactCopyPolicy
       
    77         */
       
    78         MVPbkContactOperationBase* AddFieldToContactL(
       
    79                 MVPbkStoreContact& aContact, 
       
    80                 const MVPbkFieldType& aFieldType,
       
    81                 const TDateTime& aFieldData,
       
    82                 const TDesC* aFieldLabel,
       
    83                 const MVPbkContactAttribute* aContactAttribute,
       
    84                 MVPbkContactFieldCopyObserver& aCopyObserver);
       
    85 
       
    86         /**
       
    87         * From MVPbkContactCopyPolicy
       
    88         */
       
    89         MVPbkContactOperationBase* AddFieldToContactL(
       
    90                 MVPbkStoreContact& aContact, 
       
    91                 const MVPbkFieldType& aFieldType,
       
    92                 const TDesC& aFieldData,
       
    93                 const TDesC* aFieldLabel,
       
    94                 const MVPbkContactAttribute* aContactAttribute,
       
    95                 MVPbkContactFieldCopyObserver& aCopyObserver);
       
    96 
       
    97         /**
       
    98         * From MVPbkContactCopyPolicy
       
    99         */
       
   100         MVPbkContactOperationBase* AddFieldToContactL(
       
   101                 MVPbkStoreContact& aContact, 
       
   102                 const MVPbkFieldType& aFieldType,
       
   103                 const TDesC8& aFieldData,
       
   104                 const TDesC* aFieldLabel,
       
   105                 const MVPbkContactAttribute* aContactAttribute,
       
   106                 MVPbkContactFieldCopyObserver& aCopyObserver);
       
   107 
       
   108         /**
       
   109         * From MVPbkContactCopyPolicy
       
   110         */
       
   111         MVPbkContactOperationBase* CopyTitleFieldsL(
       
   112                 const MVPbkStoreContact& aSourceContact,
       
   113                 MVPbkStoreContact& aTargetContact,
       
   114                 MVPbkContactFieldsCopyObserver& aCopyObserver); 
       
   115                 
       
   116         /**
       
   117         * From MVPbkContactCopyPolicy
       
   118         */
       
   119         MVPbkContactOperationBase* CommitContactL(
       
   120                 MVPbkStoreContact* aContact,
       
   121                 MVPbkContactCopyObserver& aCopyObserver);
       
   122 
       
   123         /**
       
   124         * From MVPbkContactCopyPolicy
       
   125         */
       
   126         MVPbkContactOperationBase* CopyContactL(
       
   127                 MVPbkStoreContact& aContact,
       
   128                 MVPbkContactStore& aTargetStore,
       
   129                 MVPbkContactCopyObserver& aCopyObserver);
       
   130         
       
   131         /**
       
   132         * From MVPbkContactCopyPolicy
       
   133         */
       
   134         TBool SupportsContactMerge() const;
       
   135         
       
   136         /**
       
   137         * From MVPbkContactCopyPolicy
       
   138         */
       
   139         MVPbkContactOperationBase* MergeAndSaveContactsL(
       
   140             RPointerArray<MVPbkStoreContact>& aSourceContacts, 
       
   141             MVPbkStoreContact& aTarget,
       
   142             MVPbkContactCopyObserver& aCopyObserver );
       
   143 
       
   144     private: // Construction
       
   145 
       
   146         /**
       
   147         * C++ constructor.
       
   148         */
       
   149         CPsu2ContactCopyPolicy(CVPbkContactManager& aContactManager);
       
   150 
       
   151         /**
       
   152         * By default Symbian 2nd phase constructor is private.
       
   153         */
       
   154         void ConstructL();
       
   155 
       
   156     private:    // New functions
       
   157         void ReplaceSimContactProcessorL(MVPbkContactStore& aTargetStore);
       
   158             
       
   159     private: // Data
       
   160         /// Ref: Contact manager
       
   161         CVPbkContactManager& iContactManager;
       
   162         /// Own: UI field properties
       
   163         CPbk2FieldPropertyArray* iPropertyArray;
       
   164         /// Own: an array of field information about copying rules
       
   165         CPsu2CopyToSimFieldInfoArray* iSimFieldInfos;
       
   166         /// Own: a class that handles sim contact splitting
       
   167         CPsu2SimContactProcessor* iSimContactProcessor;
       
   168         /// Own: sort order manager for createing name formatter
       
   169         CPbk2SortOrderManager* iSortOrderManager;
       
   170         /// Own: the name formatter for setting name field for sim contact
       
   171         MPbk2ContactNameFormatter* iNameFormatter;
       
   172     };
       
   173 
       
   174 // INLINE FUNCTIONS
       
   175 inline CPbk2FieldPropertyArray& CPsu2ContactCopyPolicy::FieldProperties() const
       
   176     {
       
   177     return *iPropertyArray;
       
   178     }
       
   179             
       
   180 inline CPsu2CopyToSimFieldInfoArray& 
       
   181         CPsu2ContactCopyPolicy::SimFieldInfos() const
       
   182     {
       
   183     return *iSimFieldInfos;
       
   184     }
       
   185 
       
   186 #endif // CPSU2CONTACTCOPYPOLICY_H
       
   187             
       
   188 // End of File