plugins/contacts/symbian/contactsmodel/cntplsql/inc/cntmetadataoperation.h
author Markku Kaurila <markku.kaurila@nokia.com>
Fri, 03 Sep 2010 15:27:00 +0100
changeset 2 81ad59d81c0f
parent 0 876b1a06bc25
permissions -rw-r--r--
Revise header exports in contactsmodel.pro, to fix Bug 3312

/*
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/


#ifndef CNTMETADATAOPERATION_H
#define CNTMETADATAOPERATION_H

// Forward declarations
class RColumboSession;
class CMetadataDocument;

/**
 * This class is a listener for the asynchronous operations used
 * to keep the metadata cache for contact items up to date.
 * 
 * Calling either the save or delete function will contact the
 * metadata service asynchronously and the object will be destroyed
 * on the completion of the operation. Therefore, do NOT maintain
 * references/pointers to CCntMetadataOperation objects as member
 * data.
 * 
 * Failed metadata operations are not considered fatal.
 */
class CCntMetadataOperation : public CActive
    {
public:
    ~CCntMetadataOperation();

    static CCntMetadataOperation* NewL(RColumboSession& aSession);
    static CCntMetadataOperation* NewLC(RColumboSession& aSession);

    void SaveContactLD(const CContactItem& aContact);
    void DeleteContactLD(TInt aContactId);
    
private:
    CCntMetadataOperation(RColumboSession& aSession);
    void ConstructL();
    
    CMetadataDocument* DocumentFromContactL(const CContactItem& aContact);
    HBufC* ContactMetadataKeyLC(TInt aContactId);
    
private:
    // From CActive
    void RunL();
    void DoCancel();

    TInt RunError(TInt aError);

private:
    RColumboSession& iSession;
    CMetadataDocument* iDocument;
    TInt iContactId;
    HBufC* iKey;
    };

#endif // CNTMETADATAOPERATION_H