contactextensions/predefinedcontacts/inc/pdcdata.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 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:    Interacts with the central respository, and the internal data 
       
    15 *                file to store and restore data.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef C_PDCDATA_H
       
    20 #define C_PDCDATA_H
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>        // CBase
       
    24 #include <sysutil.h>        // KSysUtilVersionTextLength
       
    25 
       
    26 // Forward declarations
       
    27 class RFs;
       
    28 class CRepository;
       
    29 class RReadStream;
       
    30 class RWriteStream;
       
    31 class CVPbkContactLinkArray;
       
    32 
       
    33 /**
       
    34  *  Predefined Contacts engine
       
    35  *  This class is the reponsible for
       
    36  *  deciding if predefined contacts need to be added,
       
    37  *  and persisting the ids of any contacts added.
       
    38  */
       
    39 NONSHARABLE_CLASS( CPdcData ): public CBase
       
    40     {
       
    41 public:    
       
    42     /**
       
    43     * Symbian 1st phase constructor
       
    44     * @return Self pointer to CPdcData pushed to
       
    45     * the cleanup stack.
       
    46     * @param    aFs file system
       
    47     * @param    aContactIds ids of any predefined contacts that
       
    48     *                       have been added.
       
    49     */
       
    50     static CPdcData* NewL( RFs& aFs,  CVPbkContactLinkArray& aLinkArray );
       
    51 
       
    52     /**
       
    53     * Destructor.
       
    54     */
       
    55     virtual ~CPdcData();
       
    56 
       
    57 public:
       
    58 
       
    59     /**
       
    60     * Checks if the predefined contacts need to be added.
       
    61     * @return ETrue if the predefined contacts need to be added
       
    62     */
       
    63     TBool ContactsUpToDateL(); 
       
    64     
       
    65     /**
       
    66     * Stores the most recent info about the firmware etc, plus 
       
    67     * the ids of any contacts that have been added.
       
    68     */
       
    69     void StoreL();
       
    70 
       
    71     /**
       
    72     *  Gets the location of the vCards and XML file
       
    73     *  @return  file location
       
    74     */
       
    75     HBufC* GetFileLocationL();
       
    76     
       
    77     /**
       
    78      * Gets the buffer of contact links
       
    79      * @return  buffer of contact links
       
    80      */
       
    81     HBufC8* LinkArrayBuffer();
       
    82 
       
    83 private: // C++ constructor and the Symbian second-phase constructor
       
    84     CPdcData( RFs& aFs, CVPbkContactLinkArray& aLinkArray );
       
    85     void ConstructL();
       
    86 
       
    87 private: // private member functions
       
    88     void InternalizeL( RReadStream& aStream );
       
    89 	void ExternalizeL( RWriteStream& aStream ) const;
       
    90 
       
    91 private: // data
       
    92     /// Ref: File system.
       
    93     RFs& iFs;
       
    94     /// Central repository
       
    95     CRepository* iRepository;
       
    96     /// Ref: Contacts link array
       
    97     CVPbkContactLinkArray& iLinkArray;
       
    98     /// Own: Buffer containing list of contact links
       
    99     HBufC8* iLinkBuffer;
       
   100     };
       
   101 
       
   102 #endif // C_PDCDATA_H