PECengine/JanitorPlugin2/Src/CPEngContact.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Container of one contact item. It includes contact ID and WV IDs
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __CPENGCONTACT_H__
       
    22 #define __CPENGCONTACT_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <badesca.h>
       
    27 #include <cntitem.h>
       
    28 #include <cntdef.h>
       
    29 
       
    30 // CONSTANTS
       
    31 static const TUid KPbkFieldWVIdMapping = { KIntContactFieldVCardMapWV };
       
    32 static const TUid KPbkFieldIMAddress   = { KUidContactFieldIMAddressValue };
       
    33 
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CPEngNWSessionSlotID2;
       
    37 class CPEngContactListNotifier2;
       
    38 class CPEngContactListStore2;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 /**
       
    42  *  Container of the one contact item
       
    43  *  Container of one contact item. It includes, contact Id and wv IDs
       
    44  *  Which are in for that Contact ID in the database
       
    45  *
       
    46  *  @lib PEngJanitor2
       
    47  *  @since 3.0
       
    48  */
       
    49 NONSHARABLE_CLASS( CPEngContact ) : public CBase
       
    50     {
       
    51 public:  // Constructors and destructor
       
    52 
       
    53     /**
       
    54     * Two-phased constructor.
       
    55     */
       
    56     static CPEngContact* NewL(
       
    57         CContactItem* aContactItem );
       
    58 
       
    59     /**
       
    60      * Two-phased constructor.
       
    61      */
       
    62     static CPEngContact* NewLC(
       
    63         CContactItem* aContactItem );
       
    64 
       
    65     /**
       
    66      * Two-phased constructor - creates empty object, for Find purposes
       
    67      */
       
    68     static CPEngContact* NewL(
       
    69         TContactItemId& aContactId );
       
    70 
       
    71     /**
       
    72      * Destructor.
       
    73      */
       
    74     virtual ~CPEngContact();
       
    75 
       
    76 public: // Function to manipulate with contact
       
    77 
       
    78     /**
       
    79      * Get Contact Item ID
       
    80      *
       
    81      * @since 3.0
       
    82      * @return TContactItemId of the contact
       
    83      */
       
    84     TContactItemId ContactId() const;
       
    85 
       
    86     /**
       
    87      * Get list of WV Ids of the contact
       
    88      *
       
    89      * @since 3.0
       
    90      * @return reference to the array of the WV IDs
       
    91      */
       
    92     const MDesCArray& WvIds() const ;
       
    93 
       
    94     /**
       
    95      * Compare two Contacts based on the Contact Item ID
       
    96      *
       
    97      * @since 3.0
       
    98      * @param aContactA contact to compare with
       
    99      * @param aContactB contact to compare with
       
   100      * @return -1 if contactID B is bigger than contactID A,
       
   101                 0 if it match,
       
   102                 1 if contactID B is smaller than contactID A
       
   103      */
       
   104     static TInt Compare(
       
   105         const CPEngContact& aContactA,
       
   106         const CPEngContact& aContactB );
       
   107 
       
   108     /**
       
   109      * Compare Contact Id if it match to the passed one
       
   110      *
       
   111      * @since 3.0
       
   112      * @param aContact contact to compare with
       
   113      * @return -1 if it is bigger
       
   114      *          0 if it match
       
   115      *          1 if passed Contact ID is smaller,
       
   116      */
       
   117     TInt Compare( const CPEngContact& aContact ) const;
       
   118 
       
   119     /**
       
   120      * Search if WV ID is presented in the contact
       
   121      *
       
   122      * @since 3.0
       
   123      * @param aWVId WV ID to look for
       
   124      * @return ETrue if WV Id is in the contact, otherwise EFalse
       
   125      */
       
   126     TBool ValidateWVId( const TDesC& aWVId ) const;
       
   127 
       
   128     /**
       
   129      * Count of the WV IDs in the contact
       
   130      *
       
   131      * @since 3.0
       
   132      * @param
       
   133      * @return number on the WV IDs in the contact
       
   134      */
       
   135     TInt WVIdsCount();
       
   136 
       
   137 
       
   138     /**
       
   139      * Update contact content from the contact database
       
   140      *
       
   141      * @since 3.0
       
   142      * @param aContactDatabase contact database
       
   143      */
       
   144     void UpdateContactL( CContactDatabase& aContactDatabase );
       
   145 
       
   146 private:
       
   147 
       
   148     /**
       
   149     * C++ default constructor.
       
   150     */
       
   151     CPEngContact( TContactItemId& aContactId );
       
   152 
       
   153     /**
       
   154     * By default Symbian 2nd phase constructor is private.
       
   155     */
       
   156     void ConstructL( CContactItem* aContactItem );
       
   157 
       
   158 private:    // Data
       
   159 
       
   160     /// OWN: Array of the WV IDs
       
   161     CDesCArrayFlat                  iWVIds;
       
   162 
       
   163     // OWN: Contat db Id
       
   164     TContactItemId                  iContactItemId;
       
   165     };
       
   166 
       
   167 #endif      // __CPENGCONTACT_H__
       
   168 
       
   169 // End of File