|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CNTMETADATAOPERATION_H |
|
20 #define CNTMETADATAOPERATION_H |
|
21 |
|
22 // Forward declarations |
|
23 class RColumboSession; |
|
24 class CMetadataDocument; |
|
25 |
|
26 /** |
|
27 * This class is a listener for the asynchronous operations used |
|
28 * to keep the metadata cache for contact items up to date. |
|
29 * |
|
30 * Calling either the save or delete function will contact the |
|
31 * metadata service asynchronously and the object will be destroyed |
|
32 * on the completion of the operation. Therefore, do NOT maintain |
|
33 * references/pointers to CCntMetadataOperation objects as member |
|
34 * data. |
|
35 * |
|
36 * Failed metadata operations are not considered fatal. |
|
37 */ |
|
38 class CCntMetadataOperation : public CActive |
|
39 { |
|
40 public: |
|
41 ~CCntMetadataOperation(); |
|
42 |
|
43 static CCntMetadataOperation* NewL(RColumboSession& aSession); |
|
44 static CCntMetadataOperation* NewLC(RColumboSession& aSession); |
|
45 |
|
46 void SaveContactLD(const CContactItem& aContact); |
|
47 void DeleteContactLD(TInt aContactId); |
|
48 |
|
49 private: |
|
50 CCntMetadataOperation(RColumboSession& aSession); |
|
51 void ConstructL(); |
|
52 |
|
53 CMetadataDocument* DocumentFromContactL(const CContactItem& aContact); |
|
54 HBufC* ContactMetadataKeyLC(TInt aContactId); |
|
55 |
|
56 private: |
|
57 // From CActive |
|
58 void RunL(); |
|
59 void DoCancel(); |
|
60 |
|
61 TInt RunError(TInt aError); |
|
62 |
|
63 private: |
|
64 RColumboSession& iSession; |
|
65 CMetadataDocument* iDocument; |
|
66 TInt iContactId; |
|
67 HBufC* iKey; |
|
68 }; |
|
69 |
|
70 #endif // CNTMETADATAOPERATION_H |