phonebookui/Phonebook2/CommandsExtension/inc/CPbk2MergeConflict.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2  * Copyright (c) 2009 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 merge conflict.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CPBK2MERGECONFLICT_H_
       
    19 #define CPBK2MERGECONFLICT_H_
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <MVPbkStoreContactField.h>
       
    23 #include <Pbk2FieldProperty.hrh>
       
    24 #include <MPbk2MergeConflict.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CPbk2PresentationContact;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 
       
    31 /**
       
    32  * Phonebook 2 merge conflict.
       
    33  */
       
    34 class CPbk2MergeConflict : public CBase,
       
    35                             public MPbk2MergeConflict
       
    36     {
       
    37 public: // Construction and destruction
       
    38     /**
       
    39      * Creates a new instance of this class.
       
    40      *
       
    41      * @return  A new instance of this class.
       
    42      */
       
    43     static CPbk2MergeConflict* NewL();
       
    44     
       
    45     /**
       
    46      * Destructor.
       
    47      */
       
    48     ~CPbk2MergeConflict();
       
    49     
       
    50 private: // Construction
       
    51     CPbk2MergeConflict();
       
    52     
       
    53 public: // Implementation
       
    54     /**
       
    55      * Adds fields into conflict.
       
    56      *
       
    57      * @param aFieldFirst     First field.
       
    58      * @param aFieldSecond    Second field.
       
    59      */
       
    60     void AddFields(  
       
    61             const MVPbkStoreContactField& aFieldFirst, 
       
    62             const MVPbkStoreContactField& aFieldSecond );
       
    63 
       
    64     /**
       
    65      * Adds display fields into conflict. For special fields, normally not needed.
       
    66      * If not provided normal field values used for display. Takes ownership.
       
    67      *
       
    68      * @param aDisplayFieldFirst     First display field.
       
    69      * @param aDisplayFieldSecond    Second display field.
       
    70      */
       
    71     void AddDisplayFields(  
       
    72             HBufC* aDisplayFieldFirst, 
       
    73             HBufC* aDisplayFieldSecond );
       
    74     
       
    75     /**
       
    76      * Gets fields from conflict.
       
    77      *
       
    78      * @param aFieldFirst     First field.
       
    79      * @param aFieldSecond    Second field.
       
    80      */
       
    81     void GetFieldsL(  
       
    82             const MVPbkStoreContactField*& aFieldFirst, 
       
    83             const MVPbkStoreContactField*& aFieldSecond );
       
    84     
       
    85 public: // CPbk2MergeConflictBase
       
    86     EPbk2ConflictType GetConflictType();
       
    87     HBufC* GetLabelLC();
       
    88     HBufC* GetTextLC( EPbk2ConflictedNumber aNumber );
       
    89     void ResolveConflict( EPbk2ConflictedNumber aNumber );
       
    90     void GetChosenFieldsL( RPointerArray<MVPbkStoreContactField>& aAddressFields );
       
    91 
       
    92 private: // methods
       
    93     void CustomizeTextValueL( const MVPbkStoreContactField& aField, TDes& aBuf );
       
    94     HBufC* GetContentTextLC( 
       
    95             EPbk2ConflictedNumber aNumber, 
       
    96             const MVPbkStoreContactField* aField );
       
    97     
       
    98 private: //Data
       
    99     // Not own: First field
       
   100     const MVPbkStoreContactField* iFieldFirst;
       
   101     // Not own: Second field
       
   102     const MVPbkStoreContactField* iFieldSecond;
       
   103     //own: optional display value 
       
   104     HBufC* iDisplayFieldFirst;
       
   105     //own: optional display value 
       
   106     HBufC* iDisplayFieldSecond;    
       
   107     // Not own: Chosen field
       
   108     const MVPbkStoreContactField* iChosenField;
       
   109     // Own: Conflict type
       
   110     EPbk2ConflictType iConflictType;
       
   111     };
       
   112 
       
   113 /**
       
   114  * Phonebook 2 merge addresses conflict.
       
   115  */
       
   116 class CPbk2MergeConflictAddress : public CBase,
       
   117                             public MPbk2MergeConflict
       
   118     {
       
   119 public: // Construction and destruction
       
   120     /**
       
   121      * Creates a new instance of this class.
       
   122      *
       
   123      * @return  A new instance of this class.
       
   124      */
       
   125     static CPbk2MergeConflictAddress* NewL();
       
   126     
       
   127 private: // Construction
       
   128     CPbk2MergeConflictAddress();
       
   129     
       
   130 public: // Implementation
       
   131     /**
       
   132      * Adds addresses into conflict.
       
   133      *
       
   134      * @param aContactFirst     First contact.
       
   135      * @param aContactSecond    Second contact.
       
   136      * @param aAddressGroup     Address group.
       
   137      */
       
   138     void AddAddress( 
       
   139             CPbk2PresentationContact& aContactFirst, 
       
   140             CPbk2PresentationContact& aContactSecond, 
       
   141             TPbk2FieldGroupId aAddressGroup );
       
   142     
       
   143 public: // CPbk2MergeConflictBase
       
   144     EPbk2ConflictType GetConflictType();
       
   145     HBufC* GetLabelLC();
       
   146     HBufC* GetTextLC( EPbk2ConflictedNumber aNumber );
       
   147     void ResolveConflict( EPbk2ConflictedNumber aNumber );
       
   148     void GetChosenFieldsL( RPointerArray<MVPbkStoreContactField>& aAddressFields );
       
   149     
       
   150 private: //Data
       
   151     // Own: Address group
       
   152     TPbk2FieldGroupId iAddressGroup;
       
   153     // Not Own: First contact
       
   154     CPbk2PresentationContact* iContactFirst;
       
   155     // Not Own: Second contact
       
   156     CPbk2PresentationContact* iContactSecond;
       
   157     // Not own: Contact who owns chosen address
       
   158     const CPbk2PresentationContact* iContactChosenAddress;
       
   159     // Own: Conflict type
       
   160     EPbk2ConflictType iConflictType;
       
   161     };
       
   162 
       
   163 
       
   164 #endif /* CPBK2MERGECONFLICT_H_ */