63
|
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 data assign phase.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CPBK2MULTIASSIGNDATAPHASE_H
|
|
20 |
#define CPBK2MULTIASSIGNDATAPHASE_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <MVPbkContactObserver.h>
|
|
25 |
#include <MVPbkSingleContactOperationObserver.h>
|
|
26 |
#include <MVPbkBatchOperationObserver.h>
|
|
27 |
#include <MPbk2KeyEventHandler.h>
|
|
28 |
#include "MPbk2ServicePhase.h"
|
|
29 |
#include "MPbk2ContactAssignerObserver.h"
|
|
30 |
|
|
31 |
// FORWARD DECLARATIONS
|
|
32 |
class CVPbkContactLinkArray;
|
|
33 |
class MPbk2ServicePhaseObserver;
|
|
34 |
class MVPbkContactLinkArray;
|
|
35 |
class MVPbkContactOperationBase;
|
|
36 |
class MPbk2SelectFieldProperty;
|
|
37 |
class MPbk2ContactAssigner;
|
|
38 |
class MVPbkStoreContactField;
|
|
39 |
class CPbk2KeyEventDealer;
|
|
40 |
class CEikonEnv;
|
|
41 |
|
|
42 |
// CLASS DECLARATION
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Phonebook 2 server app contact data assign phase.
|
|
46 |
* Responsible for assigning given data to given contacts.
|
|
47 |
*/
|
|
48 |
class CPbk2MultiAssignDataPhase : public CBase,
|
|
49 |
public MPbk2ServicePhase,
|
|
50 |
private MPbk2ContactAssignerObserver,
|
|
51 |
private MVPbkContactObserver,
|
|
52 |
private MVPbkSingleContactOperationObserver,
|
|
53 |
private MVPbkBatchOperationObserver,
|
|
54 |
private MPbk2KeyEventHandler
|
|
55 |
{
|
|
56 |
public: // Construction
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Creates a new instance of this class.
|
|
60 |
*
|
|
61 |
* @param aObserver Observer.
|
|
62 |
* @param aContactLinks Contacts to operate with.
|
|
63 |
* @param aSelectFieldProperty Selected field property.
|
|
64 |
* @param aDataBuffer Textual data to assign.
|
|
65 |
* @param aMimeType Mime type of the data to assign.
|
|
66 |
* @param aNoteFlags Information note flags.
|
|
67 |
* @return A new instance of this class.
|
|
68 |
*/
|
|
69 |
static CPbk2MultiAssignDataPhase* NewL(
|
|
70 |
MPbk2ServicePhaseObserver& aObserver,
|
|
71 |
MVPbkContactLinkArray* aContactLinks,
|
|
72 |
MPbk2SelectFieldProperty* aSelectedFieldProperty,
|
|
73 |
HBufC* aDataBuffer,
|
|
74 |
TInt aMimeType,
|
|
75 |
TUint aNoteFlags );
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Destructor.
|
|
79 |
*/
|
|
80 |
~CPbk2MultiAssignDataPhase();
|
|
81 |
|
|
82 |
public: // From MPbk2ServicePhase
|
|
83 |
void LaunchServicePhaseL();
|
|
84 |
void CancelServicePhase();
|
|
85 |
void RequestCancelL(
|
|
86 |
TInt aExitCommandId );
|
|
87 |
void AcceptDelayedL(
|
|
88 |
const TDesC8& aContactLinkBuffer );
|
|
89 |
MVPbkContactLinkArray* Results() const;
|
|
90 |
TInt ExtraResultData() const;
|
|
91 |
MVPbkStoreContact* TakeStoreContact();
|
|
92 |
HBufC* FieldContent() const;
|
|
93 |
|
|
94 |
private: // From MPbk2ContactAssignerObserver
|
|
95 |
void AssignComplete(
|
|
96 |
MPbk2ContactAssigner& aAssigner,
|
|
97 |
TInt aIndex );
|
|
98 |
void AssignFailed(
|
|
99 |
MPbk2ContactAssigner& aAssigner,
|
|
100 |
TInt aErrorCode );
|
|
101 |
|
|
102 |
private: // From MVPbkContactObserver
|
|
103 |
void ContactOperationCompleted(
|
|
104 |
TContactOpResult aResult );
|
|
105 |
void ContactOperationFailed(
|
|
106 |
TContactOp aOpCode,
|
|
107 |
TInt aErrorCode,
|
|
108 |
TBool aErrorNotified );
|
|
109 |
|
|
110 |
private: // From MVPbkSingleContactOperationObserver
|
|
111 |
void VPbkSingleContactOperationComplete(
|
|
112 |
MVPbkContactOperationBase& aOperation,
|
|
113 |
MVPbkStoreContact* aContact );
|
|
114 |
void VPbkSingleContactOperationFailed(
|
|
115 |
MVPbkContactOperationBase& aOperation,
|
|
116 |
TInt aError );
|
|
117 |
|
|
118 |
private: // From MVPbkBatchOperationObserver
|
|
119 |
void StepComplete(
|
|
120 |
MVPbkContactOperationBase& aOperation,
|
|
121 |
TInt aStepSize );
|
|
122 |
TBool StepFailed(
|
|
123 |
MVPbkContactOperationBase& aOperation,
|
|
124 |
TInt aStepSize,
|
|
125 |
TInt aError );
|
|
126 |
void OperationComplete(
|
|
127 |
MVPbkContactOperationBase& aOperation );
|
|
128 |
|
|
129 |
private: // From MPbk2KeyEventHandler
|
|
130 |
TBool Pbk2ProcessKeyEventL(
|
|
131 |
const TKeyEvent& aKeyEvent,
|
|
132 |
TEventCode aType );
|
|
133 |
|
|
134 |
private: // Implementation
|
|
135 |
CPbk2MultiAssignDataPhase(
|
|
136 |
MPbk2ServicePhaseObserver& aObserver,
|
|
137 |
MPbk2SelectFieldProperty* aSelectedFieldProperty,
|
|
138 |
HBufC* aDataBuffer,
|
|
139 |
TInt aMimeType,
|
|
140 |
TUint aNoteFlags );
|
|
141 |
void ConstructL(
|
|
142 |
MVPbkContactLinkArray* aContactLinks );
|
|
143 |
void AssignDataL();
|
|
144 |
TBool SelectContactFieldL(
|
|
145 |
MVPbkStoreContactField*& aField );
|
|
146 |
void AppendResultL(
|
|
147 |
MVPbkStoreContact* aStoreContact );
|
|
148 |
void DisplayNotesL();
|
|
149 |
void AppendResultAndContinueL(
|
|
150 |
MVPbkStoreContact* aContact );
|
|
151 |
void RetrieveContactL();
|
|
152 |
void CommitContactsL();
|
|
153 |
void ContinueL();
|
|
154 |
void Finalize();
|
|
155 |
|
|
156 |
private: // Data
|
|
157 |
/// Ref: Observer
|
|
158 |
MPbk2ServicePhaseObserver& iObserver;
|
|
159 |
/// Own: Contacts to operate with
|
|
160 |
CVPbkContactLinkArray* iContactLinks;
|
|
161 |
/// Own: Results
|
|
162 |
CVPbkContactLinkArray* iResults;
|
|
163 |
/// Own: Store contact
|
|
164 |
MVPbkStoreContact* iStoreContact;
|
|
165 |
/// Own: Array of store contacts
|
|
166 |
CArrayPtrFlat<MVPbkStoreContact>* iStoreContacts;
|
|
167 |
/// Own: To check is this destroyed
|
|
168 |
TBool* iDestroyedPtr;
|
|
169 |
/// Own: Contact retrieve operation
|
|
170 |
MVPbkContactOperationBase* iRetrieveOperation;
|
|
171 |
/// Own: Commit operation
|
|
172 |
MVPbkContactOperationBase* iCommitOperation;
|
|
173 |
/// Own: Contact data assigner
|
|
174 |
MPbk2ContactAssigner* iContactDataAssigner;
|
|
175 |
/// Ref: Select field property
|
|
176 |
MPbk2SelectFieldProperty* iSelectedFieldProperty;
|
|
177 |
/// Own: Textual data to assign
|
|
178 |
HBufC* iDataBuffer;
|
|
179 |
/// Own: Mime type
|
|
180 |
TInt iMimeType;
|
|
181 |
/// Own: Note flags
|
|
182 |
TUint iNoteFlags;
|
|
183 |
/// Own: Contacts processed
|
|
184 |
TInt iContactsProcessed;
|
|
185 |
/// Own: Key event dealer
|
|
186 |
CPbk2KeyEventDealer* iDealer;
|
|
187 |
/// Own: Indicates cancellation
|
|
188 |
TBool iOperationCancelled;
|
|
189 |
/// Ref: Eikon enviroment
|
|
190 |
CEikonEnv* iEikenv;
|
|
191 |
};
|
|
192 |
|
|
193 |
#endif // CPBK2MULTIASSIGNDATAPHASE_H
|
|
194 |
|
|
195 |
// End of File
|