epoc32/include/app/CVPbkContactCopier.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/CVPbkContactCopier.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Virtual Phonebook contact copier
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#ifndef CVPBKCONTACTCOPIER_H
    1.23 +#define CVPBKCONTACTCOPIER_H
    1.24 +
    1.25 +#include <e32base.h>
    1.26 +
    1.27 +class MVPbkContactOperationBase;
    1.28 +class MVPbkContactLinkArray;
    1.29 +class MVPbkContactStore;
    1.30 +class MVPbkBatchOperationObserver;
    1.31 +class CVPbkContactManager;
    1.32 +class CVPbkContactLinkArray;
    1.33 +
    1.34 +/**
    1.35 + * Virtual Phonebook contact copier. Copies source
    1.36 + * contacts to the target store according to copying rules.
    1.37 + *
    1.38 + * @lib VPbkEng.lib
    1.39 + */
    1.40 +class CVPbkContactCopier : public CBase
    1.41 +    {
    1.42 +    public:
    1.43 +        /**
    1.44 +         * A set of flags for copying. Fastest copy is EVPbkSimpleContactCopy.
    1.45 +         */
    1.46 +        enum TVPbkContactCopyFlags
    1.47 +            {
    1.48 +            /// Copies a field if the target store supports the field type.
    1.49 +            /// Does not perform additional checks. 
    1.50 +            EVPbkSimpleContactCopy                      = 0,
    1.51 +            /// Uses a store specific copy policy if found for the target store.
    1.52 +            /// Can do e.g field type conversion between source and target field
    1.53 +            /// types. Falls back to simple copy if the copy policy was not found
    1.54 +            /// for the store.
    1.55 +            EVPbkUseStoreSpecificCopyPolicy             = 0x01,
    1.56 +            /// Finds duplicates before saving a contact if there is a copy policy
    1.57 +            /// for the store that can handle the possible merge of
    1.58 +            /// new and existing contact data. Falls back to simple copy if
    1.59 +            /// the copy policy was not found for the store.
    1.60 +            EVPbkUsePlatformSpecificDuplicatePolicy     = 0x02
    1.61 +            };
    1.62 +
    1.63 +        /**
    1.64 +         * Creates a new copier instance. Remember to open the stores first
    1.65 +         * before starting any copy operation.
    1.66 +         *
    1.67 +         * @param aContactManager   The contact manager for getting stores.
    1.68 +         * @return A new instance of this class
    1.69 +         */        
    1.70 +        IMPORT_C static CVPbkContactCopier* NewL( 
    1.71 +            CVPbkContactManager& aContactManager );
    1.72 +        
    1.73 +        /**
    1.74 +         * Destructor.
    1.75 +         */
    1.76 +        ~CVPbkContactCopier();
    1.77 +
    1.78 +        /**
    1.79 +         * Copies a set of contacts to the target store.
    1.80 +         *
    1.81 +         * @param aContactCopyFlags     A set of TVPbkContactCopyFlags
    1.82 +         * @param aSourceContactLinks   Source contact links
    1.83 +         * @param aTargetStore          Target of the copy operation.
    1.84 +         *                              If NULL this behaves like duplicate.
    1.85 +         * @param aCopiedContactLinks   The results of the copy. Copied contacts
    1.86 +         *                              are added to this array.
    1.87 +         * @param aObserver             An observer for asynchronous operation
    1.88 +         * @return A copy contact operation
    1.89 +         */
    1.90 +        IMPORT_C MVPbkContactOperationBase* CopyContactsL(
    1.91 +            TUint32 aContactCopyFlags,
    1.92 +            const MVPbkContactLinkArray& aSourceContactLinks,
    1.93 +            MVPbkContactStore* aTargetStore,
    1.94 +            CVPbkContactLinkArray& aCopiedContactLinks,
    1.95 +            MVPbkBatchOperationObserver& aObserver );
    1.96 +
    1.97 +    private:
    1.98 +
    1.99 +        CVPbkContactCopier( CVPbkContactManager& aContactManager );
   1.100 +    
   1.101 +    private: // data
   1.102 +        /// Ref: The contact manager for accessing stores
   1.103 +        CVPbkContactManager& iContactManager;
   1.104 +    };
   1.105 +
   1.106 +#endif // CVPBKCONTACTCOPIER_H