PECengine/ListLibrary2/ContactListSrc/CPEngContactListModChangeMonitor.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:  Monitors contact list changes.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CPENGCONTACTLISTMODCHANGEMONITOR_H__
       
    20 #define __CPENGCONTACTLISTMODCHANGEMONITOR_H__
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class RWriteStream;
       
    29 class RReadStream;
       
    30 class MPEngContactListModStore;
       
    31 
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36  * Monitor the contact list changes.
       
    37  * Stores changes which were commited on the network server
       
    38  *
       
    39  * @lib PEngListLib2
       
    40  * @since 3.0
       
    41  */
       
    42 NONSHARABLE_CLASS( CPEngContactListModChangeMonitor ) : public CBase
       
    43     {
       
    44 public:  // Constructors and destructor
       
    45 
       
    46     /**
       
    47      * Two-phased constructor.
       
    48      */
       
    49     static CPEngContactListModChangeMonitor* NewL(
       
    50         MPEngContactListModStore& aStoreEntry );
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     virtual ~CPEngContactListModChangeMonitor();
       
    56 
       
    57 
       
    58 
       
    59 public: // New functions
       
    60 
       
    61     /**
       
    62      * Returns list of Contact Ids wich were added
       
    63      * to the contact lists with the last transaction
       
    64      *
       
    65      * @since 3.0
       
    66      * @return Array of the added Contact Ids
       
    67      */
       
    68     const MDesCArray& AddedContactIds() const;
       
    69 
       
    70 
       
    71     /**
       
    72      * Returns list of Contact Ids wich were removed from
       
    73      * the contact lists with the last transaction
       
    74      *
       
    75      * @since 3.0
       
    76      * @return Array of the removed Contact Ids
       
    77      */
       
    78     const MDesCArray& RemovedContactIds() const;
       
    79 
       
    80 
       
    81     /**
       
    82      * Returns count of added Contact Ids
       
    83      *
       
    84      * @since 3.0
       
    85      * @return count of Contact Ids
       
    86      */
       
    87     TInt CountAddedContactIds() const;
       
    88 
       
    89 
       
    90     /**
       
    91      * Returns count of removed Contact Ids
       
    92      *
       
    93      * @since 3.0
       
    94      * @return count of Contact Ids
       
    95      */
       
    96     TInt CountRemovedContactIds() const;
       
    97 
       
    98 
       
    99     /**
       
   100      * Find Contact Id in the Added Contact Ids
       
   101      *
       
   102      * @since 3.0
       
   103      * @param aContactId contact id to find
       
   104      * @param aUserDomain user domain
       
   105      * @return the position of found Contact Id, else KErrNotFound.
       
   106      */
       
   107     TInt FindContactIdInAdded( const TDesC& aContactId,
       
   108                                const TDesC& aUserDomain ) const;
       
   109 
       
   110 
       
   111     /**
       
   112      * Find Contact Id in the Removed Contact Ids
       
   113      *
       
   114      * @since 3.0
       
   115      * @param aContactId The Contact Id to find
       
   116      * @param aUserDomain user domain
       
   117      * @return the position of found Contact Id, else KErrNotFound.
       
   118      */
       
   119     TInt FindContactIdInRemoved( const TDesC& aContactId,
       
   120                                  const TDesC& aUserDomain ) const;
       
   121 
       
   122     /**
       
   123      * Externalizes whole presence list to stream
       
   124      *
       
   125      * @since 3.0
       
   126      * @param aStream Stream to write to.
       
   127      */
       
   128     void ExternalizeArrayL( RWriteStream& aStream ) const;
       
   129 
       
   130 
       
   131     /**
       
   132      * Internalizes whole presence list from stream
       
   133      *
       
   134      * @since 3.0
       
   135      * @param aStream stream to read from
       
   136      * @return
       
   137      */
       
   138     void InternalizeArrayL( RReadStream& aStream );
       
   139 
       
   140 
       
   141     /**
       
   142      * Add Contact Id to the list of added Contact Ids,
       
   143      * Does not leave if Contact Id already exists
       
   144      *
       
   145      * @since 3.0
       
   146      * @param aContactId to add to the list
       
   147      * @return KErrNone if it was OK, else system wide error code
       
   148      */
       
   149     TInt InsertAddedContactIdL( const TDesC& aContactId );
       
   150 
       
   151     /**
       
   152      * Remove Contact Id to the list of added Contact Ids
       
   153      *
       
   154      * @since 3.0
       
   155      * @param aContactId Contact Id to be removed
       
   156      * @return KErrNone if it was OK, else system wide error code
       
   157      */
       
   158     void RemoveAddedContactId( const TDesC& aContactId );
       
   159 
       
   160 
       
   161     /**
       
   162      * Reset content of the list of Added Contact Ids,
       
   163      *
       
   164      * @since 3.0
       
   165      */
       
   166     void ResetAddedContactId();
       
   167 
       
   168 
       
   169     /**
       
   170      * Add Contact Id to the list of removed Contact Ids,
       
   171      * Does not leave if Contact Id already exists
       
   172      *
       
   173      * @since 3.0
       
   174      * @param aContactId to add to the list
       
   175      * @return KErrNone if it was OK, else system wide error code
       
   176      */
       
   177     TInt InsertRemovedContactIdL( const TDesC& aContactId );
       
   178 
       
   179 
       
   180     /**
       
   181      * Remove Contact Id to the list of removed Contact Ids,
       
   182      *
       
   183      * @since 3.0
       
   184      * @param aContactId Contact Id to be removed
       
   185      * @return KErrNone if it was OK, else system wide error code
       
   186      */
       
   187     void RemoveRemovedContactId( const TDesC& aContactId );
       
   188 
       
   189 
       
   190     /**
       
   191      * Reset content of the list of removed Contact Id,
       
   192      *
       
   193      * @since 3.0
       
   194      */
       
   195     void ResetRemovedContactIds();
       
   196 
       
   197 
       
   198     /**
       
   199      * Reset the content of the list
       
   200      *
       
   201      * @since 3.0
       
   202      */
       
   203     void Reset();
       
   204 
       
   205 
       
   206 protected:  // New functions
       
   207 
       
   208     /**
       
   209      * C++ constructor.
       
   210      */
       
   211     CPEngContactListModChangeMonitor(
       
   212         MPEngContactListModStore& aStoreEntry );
       
   213 
       
   214 
       
   215 private:    // Data
       
   216 
       
   217     // OWN: List of added ContactIds
       
   218     CDesC16ArraySeg                 iAddedContactIds;
       
   219 
       
   220     // OWN: List of removed ContactIds
       
   221     CDesC16ArraySeg                 iRemovedContactIds;
       
   222 
       
   223     // REF: Store entry of the whole model
       
   224     MPEngContactListModStore&       iStoreEntry;
       
   225 
       
   226     };
       
   227 
       
   228 #endif      // __CPENGCONTACTLISTMODCHANGEMONITOR_H__
       
   229 
       
   230 
       
   231 //  End of File
       
   232