|
1 /* |
|
2 * Copyright (c) 2005-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: Phonebook 2 server app contact attribute assign phase. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2ASSIGNATTRIBUTEPHASE_H |
|
20 #define CPBK2ASSIGNATTRIBUTEPHASE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <Pbk2ServerAppIPC.h> |
|
25 #include <MVPbkSingleContactOperationObserver.h> |
|
26 #include <MVPbkContactObserver.h> |
|
27 #include "MPbk2ServicePhase.h" |
|
28 #include "MPbk2ContactAssignerObserver.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CVPbkContactLinkArray; |
|
32 class MPbk2ServicePhaseObserver; |
|
33 class MVPbkContactLinkArray; |
|
34 class MVPbkContactOperationBase; |
|
35 class MPbk2ContactAssigner; |
|
36 class MVPbkStoreContact; |
|
37 class MVPbkStoreContactField; |
|
38 class CEikonEnv; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * Phonebook 2 server app contact attribute assign phase. |
|
44 * Responsible for assigning given attribute to given contact. |
|
45 */ |
|
46 class CPbk2AssignAttributePhase : public CBase, |
|
47 public MPbk2ServicePhase, |
|
48 private MPbk2ContactAssignerObserver, |
|
49 private MVPbkContactObserver, |
|
50 private MVPbkSingleContactOperationObserver |
|
51 { |
|
52 public: // Construction |
|
53 |
|
54 /** |
|
55 * Creates a new instance of this class. |
|
56 * |
|
57 * @param aObserver Observer. |
|
58 * @param aStoreContact Contact to operate with, |
|
59 * ownership is taken. |
|
60 * @param aAttributeData Attribute data to assign. |
|
61 * @param aRemoveAttribute Remove attribute indicator. |
|
62 * @return A new instance of this class. |
|
63 */ |
|
64 static CPbk2AssignAttributePhase* NewL( |
|
65 MPbk2ServicePhaseObserver& aObserver, |
|
66 MVPbkContactLinkArray* aContactLinks, |
|
67 TPbk2AttributeAssignData aAttributeData, |
|
68 TBool aRemoveAttribute ); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 ~CPbk2AssignAttributePhase(); |
|
74 |
|
75 public: // From MPbk2ServicePhase |
|
76 void LaunchServicePhaseL(); |
|
77 void CancelServicePhase(); |
|
78 void RequestCancelL( |
|
79 TInt aExitCommandId ); |
|
80 void AcceptDelayedL( |
|
81 const TDesC8& aContactLinkBuffer ); |
|
82 MVPbkContactLinkArray* Results() const; |
|
83 TInt ExtraResultData() const; |
|
84 MVPbkStoreContact* TakeStoreContact(); |
|
85 HBufC* FieldContent() const; |
|
86 |
|
87 private: // From MPbk2ContactAssignerObserver |
|
88 void AssignComplete( |
|
89 MPbk2ContactAssigner& aAssigner, |
|
90 TInt aIndex ); |
|
91 void AssignFailed( |
|
92 MPbk2ContactAssigner& aAssigner, |
|
93 TInt aErrorCode ); |
|
94 |
|
95 private: // From MVPbkSingleContactOperationObserver |
|
96 void VPbkSingleContactOperationComplete( |
|
97 MVPbkContactOperationBase& aOperation, |
|
98 MVPbkStoreContact* aContact ); |
|
99 void VPbkSingleContactOperationFailed( |
|
100 MVPbkContactOperationBase& aOperation, |
|
101 TInt aError ); |
|
102 |
|
103 private: // From MVPbkContactObserver |
|
104 void ContactOperationCompleted( |
|
105 TContactOpResult aResult ); |
|
106 void ContactOperationFailed( |
|
107 TContactOp aOpCode, |
|
108 TInt aErrorCode, |
|
109 TBool aErrorNotified ); |
|
110 |
|
111 private: // Implementation |
|
112 CPbk2AssignAttributePhase( |
|
113 MPbk2ServicePhaseObserver& aObserver, |
|
114 TPbk2AttributeAssignData aAttributeData, |
|
115 TBool aRemoveAttribute ); |
|
116 void ConstructL( |
|
117 const MVPbkContactLinkArray* aContactLinks ); |
|
118 void RetrieveContactL(); |
|
119 void RetrieveContactFieldL(); |
|
120 void AppendResultL(); |
|
121 void FinalizeL(); |
|
122 void AssignAttributeL(); |
|
123 |
|
124 private: // Data |
|
125 /// Ref: Observer |
|
126 MPbk2ServicePhaseObserver& iObserver; |
|
127 /// Own: Contact attribute assigner |
|
128 MPbk2ContactAssigner* iContactAttributeAssigner; |
|
129 /// Own: Contact links to operate with |
|
130 CVPbkContactLinkArray* iContactLinks; |
|
131 /// Own: Results |
|
132 CVPbkContactLinkArray* iResults; |
|
133 /// Own: Attribute data to assign |
|
134 TPbk2AttributeAssignData iAttributeData; |
|
135 /// Own: Contact retrieve operation |
|
136 MVPbkContactOperationBase* iRetrieveOperation; |
|
137 /// Own: Remove attribute indicator |
|
138 TBool iRemoveAttribute; |
|
139 /// Own: Store contact |
|
140 MVPbkStoreContact* iStoreContact; |
|
141 /// Own: Store contact field |
|
142 MVPbkStoreContactField* iStoreContactField; |
|
143 /// Ref: Eikon enviroment |
|
144 CEikonEnv* iEikEnv; |
|
145 }; |
|
146 |
|
147 #endif // CPBK2ASSIGNATTRIBUTEPHASE_H |
|
148 |
|
149 // End of File |