pimprotocols/phonebooksync/inc/DeleteContactFromICC.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Header file for the Active Object responsible for deleting an ICC Contact.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef __DELETECONTACTFROMICC_H__
       
    24 #define __DELETECONTACTFROMICC_H__
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <mpbutil.h>
       
    28 
       
    29 #include "SyncEngineServer.h"
       
    30 
       
    31 
       
    32 /**
       
    33  *  This class is responsible for implementing the state machine required to delete
       
    34  *  a phonebook entry from ICC.
       
    35  */
       
    36 class CDeleteContactFromICC : public CActive
       
    37 	{
       
    38 private:
       
    39 	enum TDeleteContactFromICCState
       
    40 		{
       
    41 		EDeleteContactFromICCStateIdle,
       
    42 		EDeleteContactFromICCStateWaitForDelete,
       
    43 		EDeleteContactFromICCStateWaitForCancel
       
    44 		};
       
    45 
       
    46 public:
       
    47 	static CDeleteContactFromICC* NewL(CSyncEngineSession& aSession,
       
    48 									   CPhoneBookManager& aPhonebookManager,
       
    49 									   CContactDatabase& aDb,
       
    50 									   RMobilePhone& aPhone,
       
    51 									   TUid aPhonebookUid,
       
    52 									   const RMessage2& aClientMessage);
       
    53 	~CDeleteContactFromICC();
       
    54 	void ConstructL();
       
    55 
       
    56 	void DoIccDelete(TContactItemId aContactId);
       
    57 
       
    58 	inline TUid PhonebookUid() const;
       
    59 	inline const RMessage2& ClientMessage() const;
       
    60 	
       
    61 	void DoCancel();
       
    62 
       
    63 protected:
       
    64 	void RunL();
       
    65 	TInt RunError(TInt aError);
       
    66 
       
    67 private:
       
    68 	CDeleteContactFromICC(CSyncEngineSession& aSession,
       
    69 						  CPhoneBookManager& aPhonebookManager,
       
    70 						  CContactDatabase& aDb,
       
    71 						  RMobilePhone& aPhone,
       
    72 						  TUid aPhonebookUid,
       
    73 						  const RMessage2& aClientMessage);
       
    74 
       
    75 	CSyncEngineSession&  iSession;
       
    76 	CPhoneBookManager&  iPhonebookManager;
       
    77 	CContactDatabase&  iDb;
       
    78 	RMobilePhone&  iPhone;
       
    79 	TUid  iPhonebookUid;
       
    80 	RMessage2  iClientMessage;
       
    81 
       
    82 	RMobilePhoneBookStore  iPhonebookStore;
       
    83 	TDeleteContactFromICCState  iState;
       
    84 	TContactItemId  iContactId;
       
    85 	TInt  iSlotNum;
       
    86 	};
       
    87 
       
    88 
       
    89 /**
       
    90  *  Return the ICC phonebook UID. 
       
    91  *
       
    92  *  @return The UID of the phonebook being used by this Active Object.
       
    93  */
       
    94 inline TUid CDeleteContactFromICC::PhonebookUid() const
       
    95 	{
       
    96 	return iPhonebookUid;
       
    97 	} // CDeleteContactFromICC::PhonebookUid
       
    98 
       
    99 
       
   100 /**
       
   101  *  Return the client message handle. 
       
   102  *
       
   103  *  @return  A reference to the client message request being used by this
       
   104  *  Active Object.
       
   105  */
       
   106 inline const RMessage2& CDeleteContactFromICC::ClientMessage() const
       
   107 	{
       
   108 	return iClientMessage;
       
   109 	} // CDeleteContactFromICC::ClientMessage
       
   110 
       
   111 
       
   112 #endif // __DELETECONTACTFROMICC_H__