63
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: The virtual phonebook asynchronous contact operation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef VPBKCNTMODEL_CASYNCCONTACTOPERATION_H
|
|
20 |
#define VPBKCNTMODEL_CASYNCCONTACTOPERATION_H
|
|
21 |
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <cntdef.h>
|
|
26 |
#include <MVPbkContactObserver.h>
|
|
27 |
|
|
28 |
|
|
29 |
// FORWARD DECLARATIONS
|
|
30 |
class CContactDatabase;
|
|
31 |
class CContactItem;
|
|
32 |
class CContactItemViewDef;
|
|
33 |
|
|
34 |
namespace VPbkEngUtils {
|
|
35 |
class CVPbkDiskSpaceCheck;
|
|
36 |
} /// namespace
|
|
37 |
|
|
38 |
namespace VPbkCntModel {
|
|
39 |
|
|
40 |
// FORWARD DECLARATIONS
|
|
41 |
class CContactStore;
|
|
42 |
class CContact;
|
|
43 |
|
|
44 |
// CLASS DECLARATIONS
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Asynchronous contact operation.
|
|
48 |
*/
|
|
49 |
NONSHARABLE_CLASS( CAsyncContactOperation ): public CAsyncOneShot
|
|
50 |
{
|
|
51 |
public: // Constructor and destructor
|
|
52 |
/**
|
|
53 |
* Creates a new instance of this class.
|
|
54 |
*
|
|
55 |
* @param aContactStore contact store.
|
|
56 |
*/
|
|
57 |
static CAsyncContactOperation* NewL
|
|
58 |
( CContactStore& aContactStore );
|
|
59 |
|
|
60 |
~CAsyncContactOperation();
|
|
61 |
|
|
62 |
public: // New functions
|
|
63 |
/**
|
|
64 |
* Prepares an asynchronous contact operation.
|
|
65 |
*
|
|
66 |
* @param aOpCode the operation to perform.
|
|
67 |
* @param aContact target contact of the operation.
|
|
68 |
* @param aObserver observer of the operation.
|
|
69 |
* @exception KErrInUse if an operation is currently executing.
|
|
70 |
* @precond aOpCode is EContactSave or EContactCommit.
|
|
71 |
*/
|
|
72 |
void PrepareL
|
|
73 |
( MVPbkContactObserver::TContactOp aOpCode,
|
|
74 |
const CContact& aContact,
|
|
75 |
MVPbkContactObserver& aObserver );
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Prepares an asynchronous contact operation.
|
|
79 |
*
|
|
80 |
* @param aOpCode the operation to perform.
|
|
81 |
* @param aContactId id of the target contact of the operation.
|
|
82 |
* @param aObserver observer of the operation.
|
|
83 |
* @exception KErrInUse if an operation is currently executing.
|
|
84 |
* @precond aOpCode is EContactSave or EContactCommit.
|
|
85 |
*/
|
|
86 |
void PrepareL
|
|
87 |
( MVPbkContactObserver::TContactOp aOpCode,
|
|
88 |
TContactItemId aContactId,
|
|
89 |
MVPbkContactObserver& aObserver );
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Executes the prepared operation. Calls the observer passed to
|
|
93 |
* PrepareL when the operation completes.
|
|
94 |
*/
|
|
95 |
void Execute() { CAsyncOneShot::Call(); }
|
|
96 |
|
|
97 |
/**
|
|
98 |
* Overloaded Cancel. Determines if an async operation has finished.
|
|
99 |
*
|
|
100 |
* @param aContact contact item for comparison against
|
|
101 |
* iClientContact.
|
|
102 |
*/
|
|
103 |
void Cancel( CContactItem* aContact );
|
|
104 |
|
|
105 |
private: // from CAsyncOneShot
|
|
106 |
void DoCancel();
|
|
107 |
void RunL();
|
|
108 |
TInt RunError( TInt aError );
|
|
109 |
|
|
110 |
private: // Implementation
|
|
111 |
CAsyncContactOperation( CContactStore& aContactStore );
|
|
112 |
void ConstructL();
|
|
113 |
|
|
114 |
private: // Data
|
|
115 |
///Ref: contact store
|
|
116 |
CContactStore& iContactStore;
|
|
117 |
///Own: contact operation code
|
|
118 |
MVPbkContactObserver::TContactOp iOpCode;
|
|
119 |
///Ref: client contact
|
|
120 |
const CContact* iClientContact;
|
|
121 |
///Own: contact item id
|
|
122 |
TContactItemId iTargetContactId;
|
|
123 |
///Ref: contact observer
|
|
124 |
MVPbkContactObserver* iObserver;
|
|
125 |
///Own: file system session
|
|
126 |
RFs iFs;
|
|
127 |
///Own: Disk Space Checker
|
|
128 |
VPbkEngUtils::CVPbkDiskSpaceCheck* iDiskSpaceChecker;
|
|
129 |
|
|
130 |
///Own: for giving CContactItemViewDef to OpenContactLX
|
|
131 |
CContactItemViewDef* iViewDef;
|
|
132 |
};
|
|
133 |
|
|
134 |
|
|
135 |
} // namespace VPbkCntModel
|
|
136 |
|
|
137 |
#endif // VPBKCNTMODEL_CASYNCCONTACTOPERATION_H
|
|
138 |
//End of file
|
|
139 |
|
|
140 |
|