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 address select phase.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CPBK2COMMADDRESSSELECTPHASE_H
|
|
20 |
#define CPBK2COMMADDRESSSELECTPHASE_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <badesca.h>
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <MVPbkSingleContactOperationObserver.h>
|
|
26 |
#include <MPbk2KeyEventHandler.h>
|
|
27 |
#include "MPbk2ServicePhase.h"
|
|
28 |
#include <VPbkFieldTypeSelectorFactory.h>
|
|
29 |
#include <MVPbkOperationObserver.h>
|
|
30 |
#include <mcontactpresenceobs.h>
|
|
31 |
#include <MVPbkContactStoreObserver.h>
|
|
32 |
|
|
33 |
// FORWARD DECLARATIONS
|
|
34 |
class MVPbkContactLink;
|
|
35 |
class CVPbkContactLinkArray;
|
|
36 |
class MPbk2DialogEliminator;
|
|
37 |
class MPbk2ServicePhaseObserver;
|
|
38 |
class MVPbkContactOperationBase;
|
|
39 |
class RVPbkContactFieldDefaultPriorities;
|
|
40 |
class MVPbkStoreContact;
|
|
41 |
class MVPbkStoreContactField;
|
|
42 |
class CPbk2KeyEventDealer;
|
|
43 |
class CEikonEnv;
|
|
44 |
class CVPbkxSPContacts;
|
|
45 |
class MContactPresence;
|
|
46 |
class CPbk2PresenceIconInfo;
|
|
47 |
|
|
48 |
// CLASS DECLARATION
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Phonebook 2 server app address select phase.
|
|
52 |
* Responsible for performing address select.
|
|
53 |
*/
|
|
54 |
class CPbk2CommAddressSelectPhase : public CBase,
|
|
55 |
public MPbk2ServicePhase,
|
|
56 |
private MVPbkSingleContactOperationObserver,
|
|
57 |
private MPbk2KeyEventHandler,
|
|
58 |
public MVPbkOperationErrorObserver,
|
|
59 |
public MVPbkOperationResultObserver<MVPbkContactLinkArray*>,
|
|
60 |
public MContactPresenceObs,
|
|
61 |
public MVPbkContactStoreObserver
|
|
62 |
{
|
|
63 |
private:
|
|
64 |
|
|
65 |
enum TState
|
|
66 |
{
|
|
67 |
// EInitialState -> EMainContactRetrieved
|
|
68 |
EInitialState,
|
|
69 |
// EMainContactRetrieved -> ExSPLinksRetrieved
|
|
70 |
// EMainContactRetrieved -> EAddressSelectDone
|
|
71 |
EMainContactRetrieved,
|
|
72 |
// ExSPLinksRetrieved -> ExSPContactRetrieved
|
|
73 |
// ExSPLinksRetrieved -> EPresenceIconInfoRetrieved
|
|
74 |
// ExSPLinksRetrieved -> EAddressSelectDone
|
|
75 |
ExSPLinksRetrieved,
|
|
76 |
// ExSPContactRetrieved -> ExSPContactRetrieved
|
|
77 |
// ExSPContactRetrieved -> ExSPContactsRetrieved
|
|
78 |
// ExSPContactRetrieved -> EAddressSelectDone
|
|
79 |
ExSPContactRetrieved,
|
|
80 |
// ExSPContactsRetrieved -> EPresenceIconInfoRetrieved
|
|
81 |
// ExSPContactsRetrieved -> EAddressSelectDone
|
|
82 |
ExSPContactsRetrieved,
|
|
83 |
// EPresenceIconInfoRetrieved -> EPresenceIconRetrieved
|
|
84 |
// EPresenceIconInfoRetrieved -> EAddressSelectDone
|
|
85 |
EPresenceIconInfoRetrieved,
|
|
86 |
// EPresenceIconRetrieved -> EPresenceIconsRetrieved
|
|
87 |
// EPresenceIconRetrieved -> EAddressSelectDone
|
|
88 |
EPresenceIconRetrieved,
|
|
89 |
// EPresenceIconsRetrieved -> EAddressSelectDone
|
|
90 |
EPresenceIconsRetrieved,
|
|
91 |
// EAddressSelectDone -> EAddressSelectError
|
|
92 |
EAddressSelectDone,
|
|
93 |
EAddressSelectError
|
|
94 |
};
|
|
95 |
|
|
96 |
public: // Construction
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Creates a new instance of this class.
|
|
100 |
*
|
|
101 |
* @param aObserver Observer.
|
|
102 |
* @param aContactLink Contact link.
|
|
103 |
* @param aPriorities Address select default priorities.
|
|
104 |
* @param aFieldTypeSelector Field type selector.
|
|
105 |
* @param aCommSelector Enum value for field type selector.
|
|
106 |
* @param aRskBack Indicates whether the RSK should be Back.
|
|
107 |
* @return A new instance of this class.
|
|
108 |
*/
|
|
109 |
static CPbk2CommAddressSelectPhase* NewL(
|
|
110 |
MPbk2ServicePhaseObserver& aObserver,
|
|
111 |
const MVPbkContactLink& aContactLink,
|
|
112 |
RVPbkContactFieldDefaultPriorities& aPriorities,
|
|
113 |
CVPbkFieldTypeSelector& aFieldTypeSelector,
|
|
114 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector
|
|
115 |
aCommSelector,
|
|
116 |
TBool aRskBack );
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Destructor.
|
|
120 |
*/
|
|
121 |
~CPbk2CommAddressSelectPhase();
|
|
122 |
|
|
123 |
public: // From MPbk2ServicePhase
|
|
124 |
void LaunchServicePhaseL();
|
|
125 |
void CancelServicePhase();
|
|
126 |
void RequestCancelL(
|
|
127 |
TInt aExitCommandId );
|
|
128 |
void AcceptDelayedL(
|
|
129 |
const TDesC8& aContactLinkBuffer );
|
|
130 |
MVPbkContactLinkArray* Results() const;
|
|
131 |
TInt ExtraResultData() const;
|
|
132 |
MVPbkStoreContact* TakeStoreContact();
|
|
133 |
HBufC* FieldContent() const;
|
|
134 |
|
|
135 |
public: // From MVPbkSingleContactOperationObserver
|
|
136 |
void VPbkSingleContactOperationComplete(
|
|
137 |
MVPbkContactOperationBase& aOperation,
|
|
138 |
MVPbkStoreContact* aContact );
|
|
139 |
void VPbkSingleContactOperationFailed(
|
|
140 |
MVPbkContactOperationBase& aOperation,
|
|
141 |
TInt aError );
|
|
142 |
|
|
143 |
private: // From MPbk2KeyEventHandler
|
|
144 |
TBool Pbk2ProcessKeyEventL(
|
|
145 |
const TKeyEvent& aKeyEvent,
|
|
146 |
TEventCode aType );
|
|
147 |
|
|
148 |
public: // From MVPbkOperationErrorObserver
|
|
149 |
void VPbkOperationFailed( MVPbkContactOperationBase* aOperation,
|
|
150 |
TInt aError );
|
|
151 |
|
|
152 |
public: // From MVPbkOperationResultObserver
|
|
153 |
void VPbkOperationResultCompleted(
|
|
154 |
MVPbkContactOperationBase* aOperation,
|
|
155 |
MVPbkContactLinkArray* aArray );
|
|
156 |
|
|
157 |
public: //From MContactPresenceObs
|
|
158 |
|
|
159 |
void ReceiveIconInfoL(
|
|
160 |
const TDesC8& aPackedLink,
|
|
161 |
const TDesC8& aBrandId,
|
|
162 |
const TDesC8& aElementId );
|
|
163 |
|
|
164 |
void ReceiveIconFileL(
|
|
165 |
const TDesC8& aBrandId,
|
|
166 |
const TDesC8& aElementId,
|
|
167 |
CFbsBitmap* aBrandedBitmap,
|
|
168 |
CFbsBitmap* aMask );
|
|
169 |
|
|
170 |
void PresenceSubscribeError(
|
|
171 |
const TDesC8& aPackedLink,
|
|
172 |
TInt aStatus );
|
|
173 |
|
|
174 |
void ErrorOccured(
|
|
175 |
TInt aOpId,
|
|
176 |
TInt aStatus );
|
|
177 |
|
|
178 |
void ReceiveIconInfosL(
|
|
179 |
const TDesC8& aPackedLink,
|
|
180 |
RPointerArray <MContactPresenceInfo>& aInfoArray,
|
|
181 |
TInt aOpId );
|
|
182 |
|
|
183 |
private: // From MVPbkContactStoreObserver
|
|
184 |
void StoreReady(
|
|
185 |
MVPbkContactStore& aContactStore );
|
|
186 |
void StoreUnavailable(
|
|
187 |
MVPbkContactStore& aContactStore,
|
|
188 |
TInt aReason );
|
|
189 |
void HandleStoreEventL(
|
|
190 |
MVPbkContactStore& aContactStore,
|
|
191 |
TVPbkContactStoreEvent aEvent );
|
|
192 |
|
|
193 |
private: // Implementation
|
|
194 |
CPbk2CommAddressSelectPhase(
|
|
195 |
MPbk2ServicePhaseObserver& aObserver,
|
|
196 |
RVPbkContactFieldDefaultPriorities& aPriorities,
|
|
197 |
TBool aRskBack,
|
|
198 |
CVPbkFieldTypeSelector& aFieldTypeSelector,
|
|
199 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector
|
|
200 |
aCommSelector );
|
|
201 |
void ConstructL(
|
|
202 |
const MVPbkContactLink& aContactLink );
|
|
203 |
void HandleReceiveIconInfosL(
|
|
204 |
const TDesC8& aPackedLink,
|
|
205 |
RPointerArray <MContactPresenceInfo>& aInfoArray,
|
|
206 |
TInt aOpId );
|
|
207 |
void RetrieveContact();
|
|
208 |
void RetrieveContactL();
|
|
209 |
void DoSelectAddresses();
|
|
210 |
void DoSelectAddressesL();
|
|
211 |
TInt CorrectRSK(
|
|
212 |
TInt aAddressSelectResourceId );
|
|
213 |
void AppendResultL(
|
|
214 |
const MVPbkStoreContactField* aField );
|
|
215 |
void GetImppFieldDataL(CDesC16ArrayFlat & aXspIdArray,
|
|
216 |
MVPbkStoreContact& aContact );
|
|
217 |
void FilterXspContactsL();
|
|
218 |
TBool IsMatchL( MVPbkStoreContact& aXspContact,
|
|
219 |
MVPbkStoreContact& aStoreContact );
|
|
220 |
void StartLoadingxSPContactLinks();
|
|
221 |
void StartLoadingxSPContactLinksL();
|
|
222 |
void StartLoadingxSPContacts( MVPbkContactLinkArray& aArray );
|
|
223 |
void StartLoadingxSPContactsL( MVPbkContactLinkArray& aArray );
|
|
224 |
void StartLoadingPresenceIconInfo();
|
|
225 |
void StartLoadingPresenceIconInfoL();
|
|
226 |
TInt NumOfAddressesL( MVPbkStoreContact& aStoreContact );
|
|
227 |
TInt NumOfAddressesL();
|
|
228 |
void GetPresenceInfoL();
|
|
229 |
|
|
230 |
private: // Data
|
|
231 |
/// Ref: Observer
|
|
232 |
MPbk2ServicePhaseObserver& iObserver;
|
|
233 |
/// Own: Contact links
|
|
234 |
MVPbkContactLink* iContactLink;
|
|
235 |
/// Own: Results array
|
|
236 |
CVPbkContactLinkArray* iResults;
|
|
237 |
/// Ref: Address select default priorities
|
|
238 |
RVPbkContactFieldDefaultPriorities& iPriorities;
|
|
239 |
/// Own: Address select resource id
|
|
240 |
TInt iResourceId;
|
|
241 |
/// Own: Indicates whether the RSK should be Back
|
|
242 |
TBool iRskBack;
|
|
243 |
/// Ref: For address select dialog's exit handling
|
|
244 |
MPbk2DialogEliminator* iAddressSelectEliminator;
|
|
245 |
/// Own: Contact retrieve operation
|
|
246 |
MVPbkContactOperationBase* iRetrieveOperation;
|
|
247 |
/// Own: Store contact
|
|
248 |
MVPbkStoreContact* iStoreContact;
|
|
249 |
/// Own: Key event dealer
|
|
250 |
CPbk2KeyEventDealer* iDealer;
|
|
251 |
/// Own: Title resource id
|
|
252 |
TInt iTitleResId;
|
|
253 |
/// Ref: Eikon enviroment
|
|
254 |
CEikonEnv* iEikenv;
|
|
255 |
/// Ref: Field type selector
|
|
256 |
CVPbkFieldTypeSelector& iFieldTypeSelector;
|
|
257 |
/// Own: xSP stores interface
|
|
258 |
CVPbkxSPContacts* ixSPManager;
|
|
259 |
/// Own: xSP contact retrieve operation
|
|
260 |
MVPbkContactOperationBase* ixSPContactOperation;
|
|
261 |
/// Own: xSP contacts array
|
|
262 |
CVPbkContactLinkArray* ixSPContactsArray;
|
|
263 |
/// Own: xSP store contacts array
|
|
264 |
RPointerArray<MVPbkStoreContact> ixSPStoreContactsArray;
|
|
265 |
/// Own: state
|
|
266 |
TState iState;
|
|
267 |
/// Own: content of the selected field
|
|
268 |
HBufC* iFieldContent;
|
|
269 |
/// Own: contact presence manager
|
|
270 |
MContactPresence* iContactPresence;
|
|
271 |
/// Own: array of presence icons
|
|
272 |
RPointerArray<CPbk2PresenceIconInfo> iPresenceIconArray;
|
|
273 |
/// Own: Communication method
|
|
274 |
VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector iCommMethod;
|
|
275 |
};
|
|
276 |
|
|
277 |
#endif // CPBK2COMMADDRESSSELECTPHASE_H
|
|
278 |
|
|
279 |
// End of File
|