|
1 /* |
|
2 * Copyright (c) 2004 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: this class handles the operation for performing contact list base synhronization |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CPEngCntLstBaseSyncOp.h" |
|
21 #include "CPEngNWSessionSlotStorageProxy.h" |
|
22 #include "MPEngAdvTransactionStatus2.h" |
|
23 |
|
24 #include <CPEngContactListTransaction2.h> |
|
25 #include <MPEngContactListTransactionObserver2.h> |
|
26 |
|
27 |
|
28 |
|
29 // ================= MEMBER FUNCTIONS ======================= |
|
30 |
|
31 // Two-phased constructor. |
|
32 CPEngCntLstBaseSyncOp* CPEngCntLstBaseSyncOp::NewL( TInt aPriority, |
|
33 CPEngContactListTransaction2& aInterface, |
|
34 CPEngNWSessionSlotStorageProxy& aUsedSlot, |
|
35 MPEngContactListTransactionObserver2& aObserver, |
|
36 RPEngManagerClient& aServer, |
|
37 TBool aNeedToUnsubscribe ) |
|
38 { |
|
39 CPEngCntLstBaseSyncOp* self = new ( ELeave ) CPEngCntLstBaseSyncOp( aPriority, |
|
40 aInterface, |
|
41 aObserver, |
|
42 aServer, |
|
43 aNeedToUnsubscribe ); |
|
44 |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL( aUsedSlot ); |
|
47 CleanupStack::Pop(); |
|
48 |
|
49 return self; |
|
50 } |
|
51 |
|
52 |
|
53 // Destructor |
|
54 CPEngCntLstBaseSyncOp::~CPEngCntLstBaseSyncOp() |
|
55 { |
|
56 CActive::Cancel(); |
|
57 } |
|
58 |
|
59 |
|
60 // C++ default constructor can NOT contain any code, that |
|
61 // might leave. |
|
62 // |
|
63 CPEngCntLstBaseSyncOp::CPEngCntLstBaseSyncOp( TInt aPriority, |
|
64 CPEngContactListTransaction2& aInterface, |
|
65 MPEngContactListTransactionObserver2& aObserver, |
|
66 RPEngManagerClient& aServer, |
|
67 TBool aNeedToUnsubscribe ) |
|
68 : CPEngAsyncOperation( aPriority, aServer ), |
|
69 iInterface( aInterface ), |
|
70 iObserver( aObserver ), |
|
71 iUnsubscribe( aNeedToUnsubscribe ) |
|
72 { |
|
73 } |
|
74 |
|
75 |
|
76 |
|
77 // EPOC default constructor can leave. |
|
78 void CPEngCntLstBaseSyncOp::ConstructL( CPEngNWSessionSlotStorageProxy& aUsedSlot ) |
|
79 { |
|
80 BaseConstructL( aUsedSlot ); |
|
81 |
|
82 //Contact list base sync has empty data |
|
83 if ( iUnsubscribe ) |
|
84 { |
|
85 _LIT( KUnsubscribe, "UNSUB" ); |
|
86 HBufC* unSubs = KUnsubscribe().AllocLC(); |
|
87 |
|
88 InitTransaction( unSubs, EPEngTransOpCntListBaseSync ); |
|
89 CleanupStack::Pop( unSubs ); |
|
90 } |
|
91 else |
|
92 { |
|
93 InitTransaction( NULL, EPEngTransOpCntListBaseSync ); |
|
94 } |
|
95 } |
|
96 |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CPEngCntLstBaseSyncOp::BaseSync() |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CPEngCntLstBaseSyncOp::BaseSync() |
|
103 { |
|
104 IssueTransaction(); |
|
105 } |
|
106 |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CPEngCntLstBaseSyncOp::DoHandleOpSuccessL() |
|
110 // ----------------------------------------------------------------------------- |
|
111 void CPEngCntLstBaseSyncOp::DoHandleOpSuccessL( |
|
112 MPEngAdvTransactionStatus2& /*aStatus*/, |
|
113 TInt /*aTransactionOperation*/ ) |
|
114 |
|
115 { |
|
116 } |
|
117 |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CPEngCntLstBaseSyncOp::DoHandleOpFailure() |
|
121 // ----------------------------------------------------------------------------- |
|
122 void CPEngCntLstBaseSyncOp::DoHandleOpFailure( |
|
123 MPEngAdvTransactionStatus2& /*aStatus*/, |
|
124 TInt /*aTransactionOperation*/ ) |
|
125 { |
|
126 } |
|
127 |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // CPEngCntLstBaseSyncOp::DoNotifyObserver() |
|
131 // ----------------------------------------------------------------------------- |
|
132 TPEngAsyncOpResult CPEngCntLstBaseSyncOp::DoNotifyObserver( |
|
133 MPEngAdvTransactionStatus2& aStatus, |
|
134 TInt aTransactionOperation ) |
|
135 { |
|
136 TRAPD( err, iObserver.HandleContactListTransactionCompleteL( |
|
137 aStatus, |
|
138 iInterface, |
|
139 aTransactionOperation ) ); |
|
140 if ( err != KErrNone ) |
|
141 { |
|
142 iObserver.HandleContactListTransactionError( err, |
|
143 iInterface, |
|
144 aTransactionOperation ); |
|
145 } |
|
146 |
|
147 return EPEngAsyncOpCompleted; |
|
148 } |
|
149 |
|
150 |
|
151 //End of file |
|
152 |
|
153 |