|
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 prepare single assign phase. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2PREPARESINGLEASSIGNPHASE_H |
|
20 #define CPBK2PREPARESINGLEASSIGNPHASE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MPbk2ContactRelocatorObserver.h> |
|
25 #include <CPbk2ContactRelocator.h> |
|
26 #include <MPbk2KeyEventHandler.h> |
|
27 #include "MPbk2ServicePhase.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CVPbkContactLinkArray; |
|
31 class MPbk2ServicePhaseObserver; |
|
32 class MVPbkContactLinkArray; |
|
33 class MPbk2SelectFieldProperty; |
|
34 class MVPbkStoreContact; |
|
35 class CPbk2KeyEventDealer; |
|
36 class CEikonEnv; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 /** |
|
41 * Phonebook 2 server app prepare single assign phase. |
|
42 * Responsible for preparing contact for assign. |
|
43 */ |
|
44 class CPbk2PrepareSingleAssignPhase : |
|
45 public CActive, |
|
46 public MPbk2ServicePhase, |
|
47 private MPbk2ContactRelocatorObserver, |
|
48 private MPbk2KeyEventHandler |
|
49 { |
|
50 public: // Construction |
|
51 |
|
52 /** |
|
53 * Creates a new instance of this class. |
|
54 * |
|
55 * @param aObserver Observer. |
|
56 * @param aStoreContact Contact to operate with, |
|
57 * ownership is taken. |
|
58 * @param aSelectFieldProperty Select field property. |
|
59 * @param aSelectFieldResult Result from the select field dialog. |
|
60 * @param aFieldIndex Index of the field to assign data to. |
|
61 * @param aNoteFlags Information note flags. |
|
62 * @param aRelocationFlags Relocation flags. |
|
63 * @return A new instance of this class. |
|
64 */ |
|
65 static CPbk2PrepareSingleAssignPhase* NewL( |
|
66 MPbk2ServicePhaseObserver& aObserver, |
|
67 MVPbkStoreContact* aStoreContact, |
|
68 MPbk2SelectFieldProperty* aSelectFieldProperty, |
|
69 TInt aSelectFieldResult, |
|
70 TInt& aFieldIndex, |
|
71 TUint& aNoteFlags, |
|
72 TUint aRelocationFlags ); |
|
73 |
|
74 /** |
|
75 * Destructor. |
|
76 */ |
|
77 ~CPbk2PrepareSingleAssignPhase(); |
|
78 |
|
79 public: // From MPbk2ServicePhase |
|
80 void LaunchServicePhaseL(); |
|
81 void CancelServicePhase(); |
|
82 void RequestCancelL( |
|
83 TInt aExitCommandId ); |
|
84 void AcceptDelayedL( |
|
85 const TDesC8& aContactLinkBuffer ); |
|
86 MVPbkContactLinkArray* Results() const; |
|
87 TInt ExtraResultData() const; |
|
88 MVPbkStoreContact* TakeStoreContact(); |
|
89 HBufC* FieldContent() const; |
|
90 |
|
91 private: // From CActive |
|
92 void RunL(); |
|
93 void DoCancel(); |
|
94 TInt RunError( |
|
95 TInt aError ); |
|
96 |
|
97 private: // From MPbk2ContactRelocatorObserver |
|
98 void ContactRelocatedL( |
|
99 MVPbkStoreContact* aRelocatedContact ); |
|
100 void ContactRelocationFailed( |
|
101 TInt aReason, |
|
102 MVPbkStoreContact* aContact ); |
|
103 void ContactsRelocationFailed( |
|
104 TInt aReason, |
|
105 CVPbkContactLinkArray* aContacts ); |
|
106 void RelocationProcessComplete(); |
|
107 |
|
108 private: // From MPbk2KeyEventHandler |
|
109 TBool Pbk2ProcessKeyEventL( |
|
110 const TKeyEvent& aKeyEvent, |
|
111 TEventCode aType ); |
|
112 |
|
113 private: // Implementation |
|
114 CPbk2PrepareSingleAssignPhase( |
|
115 MPbk2ServicePhaseObserver& aObserver, |
|
116 MVPbkStoreContact* aStoreContact, |
|
117 MPbk2SelectFieldProperty* aSelectFieldProperty, |
|
118 TInt aSelectFieldResult, |
|
119 TInt& aFieldIndex, |
|
120 TUint& aNoteFlags, |
|
121 TUint aRelocationFlags ); |
|
122 void ConstructL(); |
|
123 TBool RelocateContactL( |
|
124 Pbk2ContactRelocator::TPbk2ContactRelocationQueryPolicy aPolicy, |
|
125 TBool& aThisDestroyed ); |
|
126 TInt QueryForDataReplaceL(); |
|
127 TInt QueryForRelocationL(); |
|
128 void PrepareForAssignL(); |
|
129 TBool IsContactFromPhoneMemoryL( |
|
130 const MVPbkStoreContact& aStoreContact ); |
|
131 void AppendResultL( |
|
132 const MVPbkStoreContact* aStoreContact ); |
|
133 void IssueRequest(); |
|
134 |
|
135 private: // Data |
|
136 /// Ref: Observer |
|
137 MPbk2ServicePhaseObserver& iObserver; |
|
138 /// Own: Store contact |
|
139 MVPbkStoreContact* iStoreContact; |
|
140 /// Own: Select field dialog result |
|
141 TInt iSelectFieldResult; |
|
142 /// Ref: Select field property |
|
143 MPbk2SelectFieldProperty* iSelectFieldProperty; |
|
144 /// Ref: Index of the field to assign data to |
|
145 TInt& iFieldIndex; |
|
146 /// Ref: Information note flags |
|
147 TUint& iNoteFlags; |
|
148 /// Own: Contact relocator |
|
149 CPbk2ContactRelocator* iContactRelocator; |
|
150 /// Own: Indicates is this destroyed |
|
151 TBool* iDestroyedPtr; |
|
152 /// Own: Relocation flags |
|
153 TUint iRelocationFlags; |
|
154 /// Own: Results |
|
155 CVPbkContactLinkArray* iResults; |
|
156 /// Own: Key event dealer |
|
157 CPbk2KeyEventDealer* iDealer; |
|
158 /// Ref: Eikon enviroment |
|
159 CEikonEnv* iEikEnv; |
|
160 }; |
|
161 |
|
162 #endif // CPBK2PREPARESINGLEASSIGNPHASE_H |
|
163 |
|
164 // End of File |