|
1 /* |
|
2 * Copyright (c) 2002-2008 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: View handling for Call Divert. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFCALLDIVERTVIEW_H |
|
20 #define CFCALLDIVERTVIEW_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "GSLocalBaseView.h" |
|
24 #include "CallDivertPlugin.hrh" |
|
25 |
|
26 #include <aknlists.h> |
|
27 #include <AiwContactAssignDataTypes.h> |
|
28 #include <AiwCommon.h> |
|
29 #include <MVPbkSingleContactOperationObserver.h> |
|
30 #include <MVPbkContactStoreListObserver.h> |
|
31 #include <nwdefs.h> |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CAiwServiceHandler; |
|
35 class CGSCallDivertModel; |
|
36 class CGSCallDivertPluginContainer; |
|
37 class CGSCallDivertQuery; |
|
38 class CVPbkContactLinkArray; |
|
39 class CVPbkContactManager; |
|
40 class MVPbkContactLink; |
|
41 |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * CGSCallDivertView view class. |
|
47 */ |
|
48 class CGSCallDivertView : public CGSLocalBaseView, |
|
49 public MAiwNotifyCallback, |
|
50 public MVPbkSingleContactOperationObserver, |
|
51 public MVPbkContactStoreListObserver |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * Symbian OS default constructor |
|
57 */ |
|
58 void ConstructL(); |
|
59 |
|
60 /** |
|
61 * Destructor |
|
62 */ |
|
63 ~CGSCallDivertView(); |
|
64 |
|
65 |
|
66 /** |
|
67 * Symbian OS two-phase Constructor |
|
68 * @return pointer to CGSCallDivertView object |
|
69 */ |
|
70 static CGSCallDivertView* NewLC( CGSCallDivertModel* aModel ); |
|
71 |
|
72 |
|
73 |
|
74 public: // Functions from base class CAknView |
|
75 |
|
76 /* C++ Constructor */ |
|
77 CGSCallDivertView( CGSCallDivertModel* aModel ); |
|
78 |
|
79 /** |
|
80 * From CAknView, gives the id of the view. |
|
81 * |
|
82 * @return Returns the TUid of the view. |
|
83 */ |
|
84 TUid Id() const; |
|
85 |
|
86 /** |
|
87 * From MEikCommandObserver, handles the commands. |
|
88 * |
|
89 * @param aCommand identifies the command given. |
|
90 */ |
|
91 void HandleCommandL( TInt aCommand ); |
|
92 /** |
|
93 * From MEikCommandObserver, handles the commands. |
|
94 * |
|
95 * @param aCommand identifies the command given. |
|
96 */ |
|
97 void ProcessCommandL( TInt aCommand ); |
|
98 |
|
99 public: // MAiwNotifyCallback |
|
100 |
|
101 /** |
|
102 * From MAiwNotifyCallback. Handles notifications caused by an |
|
103 * asynchronous Execute*CmdL call or an event. |
|
104 * |
|
105 * @param aCmdId The service command associated to the event. |
|
106 * @param aEventId Occured event, see AiwCommon.hrh. |
|
107 * @param aEventParamList Event parameters, if any, as defined per |
|
108 * each event. |
|
109 * @param aInParamList Input parameters, if any, given in the |
|
110 * related HandleCommmandL. |
|
111 * @return Error code for the callback. |
|
112 */ |
|
113 TInt HandleNotifyL( |
|
114 TInt aCmdId, |
|
115 TInt aEventId, |
|
116 CAiwGenericParamList& aEventParamList, |
|
117 const CAiwGenericParamList& aInParamList); |
|
118 |
|
119 public: // From MVPbkSingleContactOperationObserver |
|
120 |
|
121 /** |
|
122 * This is called when user has selected a contact from pbk2 |
|
123 * contacts-dialog. |
|
124 * @param aOperation pbk2 related operation. Not used here. |
|
125 * @param aContact Selected contact data. |
|
126 */ |
|
127 void VPbkSingleContactOperationComplete( |
|
128 MVPbkContactOperationBase& aOperation, |
|
129 MVPbkStoreContact* aContact ); |
|
130 /** |
|
131 * See MVPbkSingleContactOperationObserver. |
|
132 */ |
|
133 void VPbkSingleContactOperationFailed( |
|
134 MVPbkContactOperationBase& aOperation, |
|
135 TInt aError ); |
|
136 |
|
137 public: // From MVPbkContactStoreListObserver |
|
138 |
|
139 /** |
|
140 * See MVPbkContactStoreListObserver. |
|
141 */ |
|
142 void OpenComplete(); |
|
143 |
|
144 /** |
|
145 * See MVPbkContactStoreListObserver. |
|
146 */ |
|
147 void StoreReady( MVPbkContactStore& aContactStore ); |
|
148 |
|
149 /** |
|
150 * See MVPbkContactStoreListObserver. |
|
151 */ |
|
152 void StoreUnavailable( MVPbkContactStore& aContactStore, |
|
153 TInt aReason ); |
|
154 |
|
155 /** |
|
156 * See MVPbkContactStoreListObserver. |
|
157 */ |
|
158 void HandleStoreEventL( MVPbkContactStore& aContactStore, |
|
159 TVPbkContactStoreEvent aStoreEvent ); |
|
160 |
|
161 public: // New |
|
162 |
|
163 /** |
|
164 * Creates time list to be used in "not available" cf service. |
|
165 * @return Returns user keypress of the list |
|
166 */ |
|
167 TInt CreateTimeListL(); |
|
168 |
|
169 private: // From base class CGSBaseView |
|
170 |
|
171 /** |
|
172 * See CGSBaseView. |
|
173 */ |
|
174 void NewContainerL(); |
|
175 |
|
176 /** |
|
177 * See CGSBaseView. |
|
178 */ |
|
179 void HandleListBoxSelectionL(); |
|
180 |
|
181 private: //new |
|
182 |
|
183 /** |
|
184 * Executes divert query dialog. |
|
185 * --> voice calls -> all voice calls -> activate -> this popup. |
|
186 * OR |
|
187 * --> data calls -> all data calls -> activate -> this popup. |
|
188 * |
|
189 * @param aTelNumber user selected existing divert-to number |
|
190 * @param aTitle gives title to the list |
|
191 * @param aVmbxValidNumber divert is to a voicemail box number |
|
192 * @return Returns TTelnumber to be the target for operation. |
|
193 */ |
|
194 void ExecuteDivertQueryL( TTelNumber& aTelNumber, |
|
195 const TPtrC& aTitle, |
|
196 TBool& aVmbxValidNumber ); |
|
197 |
|
198 /** |
|
199 * Displays a query for divert number. Used for all divert types: |
|
200 * - voice |
|
201 * - data |
|
202 * - fax |
|
203 * diverts. |
|
204 * |
|
205 * @param aValue text in the editor |
|
206 * @param aType Dataquery resource ID text |
|
207 * @return Returns the number. |
|
208 */ |
|
209 void ExecuteDivertNumberQueryL( TDes& aValue, TInt aType ); |
|
210 |
|
211 /** |
|
212 * Single item fetch from the phonebook |
|
213 * @param aNumber fetched phonenumber |
|
214 */ |
|
215 void StartAsyncPhoneNumberFetchL( /*TDes& aNumber*/ ); |
|
216 |
|
217 |
|
218 /** |
|
219 * Checks if the user given telephone number contain |
|
220 * illegal ('#', 'p', 'w', ...) characters |
|
221 * |
|
222 * @param aDivertTo user given telephone number |
|
223 */ |
|
224 static TInt ValidatePhoneNumberL( const TDesC& aDivertTo ); |
|
225 |
|
226 /** |
|
227 * Appends to array a delay time in steps of five (5,10,15,...). |
|
228 * Delay time is figured out by multiplying index by five. |
|
229 * |
|
230 * @param aArrayToAppend |
|
231 * @param aIndex |
|
232 */ |
|
233 void AppendDelayItemL( CDesCArrayFlat& aArrayToAppend, TInt aIndex ); |
|
234 |
|
235 |
|
236 /** |
|
237 * Seeks '+' from given number. |
|
238 * @param aDivertTo the number checked for |
|
239 * @return Either KErrNone (no plus) or KCFErrIllegalNumber. |
|
240 */ |
|
241 static TInt FindPlus( const TDesC& aDivertTo ); |
|
242 |
|
243 /** |
|
244 * Sets prompt text to a query. |
|
245 */ |
|
246 void SetPromptToQueryL( CGSCallDivertQuery& aQuery, |
|
247 const TInt& aType ); |
|
248 |
|
249 /** |
|
250 * Creates items for Delay time list |
|
251 */ |
|
252 void CreateDelayTimeItemsL( CDesCArrayFlat& aItems ); |
|
253 |
|
254 /** |
|
255 * Creates items for Delay time list for restricted call divert |
|
256 */ |
|
257 void CreateRestrictedCallDivertDelayTimeItemsL( CDesCArrayFlat& aItems ); |
|
258 |
|
259 /** |
|
260 * Displays invalid number note. |
|
261 */ |
|
262 static void ShowErrorNoteL(); |
|
263 |
|
264 /** |
|
265 * Updates most recently used voice divert numbers to cenrep |
|
266 * |
|
267 * @param aItems array in which all items are |
|
268 * @param aNumber telNumber to be updated |
|
269 */ |
|
270 void UpdateDefaultVoiceDivertNumbersL( TDes& aNumber ); |
|
271 |
|
272 /** |
|
273 * Reads 3 previously used voice divert numbers. |
|
274 * |
|
275 * @param aItems array in which the items are put into |
|
276 * @param aDefaultNumbers array from which default items are read |
|
277 */ |
|
278 void ReadDefaultVoiceDivertNumbersL( CDesCArray& aItems, |
|
279 CDesC16ArrayFlat& aDefaultNumbers ); |
|
280 |
|
281 /** |
|
282 * Creates items for the target list ('To voicemailbox', ...) |
|
283 * |
|
284 * @param aItems array in which the items are put into |
|
285 * @param aDefaultNumbers array from which default items are read |
|
286 */ |
|
287 void CreateVoiceDivertItemsL( CDesCArray& aItems, |
|
288 CDesC16ArrayFlat& aDefaultNumbers ); |
|
289 |
|
290 /** |
|
291 * Creates items for the target list ('To voicemailbox', ...) |
|
292 * |
|
293 * @param aItems array in which the items are put into |
|
294 */ |
|
295 void CreateVideoDivertItemsL( CDesCArray& aItems ); |
|
296 |
|
297 /** |
|
298 * Handles users selection from Target menu |
|
299 */ |
|
300 TTelNumber HandleVoiceDivertSelectionL( |
|
301 CAknSinglePopupMenuStyleListBox& aList, |
|
302 CDesC16ArrayFlat& aDefNumbers, |
|
303 TBool& aVmbxDivert ); |
|
304 |
|
305 /** |
|
306 * Handles users selection from Target menu |
|
307 */ |
|
308 TTelNumber HandleVideoDivertSelectionL( |
|
309 CAknSinglePopupMenuStyleListBox& aList ); |
|
310 |
|
311 /** |
|
312 * Displays data call number query and activates data divert |
|
313 * @param aTelNumber Phone number for call divert |
|
314 */ |
|
315 void DisplayDataCallDivertNumberQueryL( TTelNumber& aTelNumber ); |
|
316 |
|
317 /** |
|
318 * Remove invalid " ", "()" which were sync with PC suite. |
|
319 * Make sure the call divert behavior is the same as user making a phone call. |
|
320 * Illegal ('#', 'p', 'w', ...) characters are handled in ValidatePhoneNumberL(). |
|
321 * @param aNumber Phone number for call divert |
|
322 * @param aInvalidChars the invalid chars to remove |
|
323 */ |
|
324 void RemoveInvalidChars( TDes& aNumber ); |
|
325 |
|
326 private: |
|
327 |
|
328 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
329 |
|
330 private: |
|
331 // Has selection key been pressed |
|
332 TBool iRockerPress; |
|
333 |
|
334 // Array of setting item titles |
|
335 CDesCArray* iTitles; |
|
336 |
|
337 /** |
|
338 * Member variables related to AIW service handler used by pbk2 contact |
|
339 * selection functionality. Former functionality was synchronous dialog |
|
340 * based but pbk2 framework required refactoring this to asynchronous. |
|
341 * As a result a bucket load of observers and functionality otherwise |
|
342 * unused is needed here. Basically the call divert plugin is now |
|
343 * changed into a state machine because of pbk2 requirement. |
|
344 */ |
|
345 // AIW service for pbk2. |
|
346 CAiwServiceHandler* iServiceHandler; |
|
347 // Handles contact stores. |
|
348 CVPbkContactManager* iContactManager; |
|
349 // Pointer to both a contact and a contact field |
|
350 CVPbkContactLinkArray* iContactLinks; |
|
351 // Pbk stores are opened. |
|
352 TBool iStoresOpened; |
|
353 // Stores pbk2 operations. |
|
354 MVPbkContactOperationBase* iRetrieveOperation; |
|
355 // Used pbk2 number query which is asynchronously. |
|
356 TBool iNumberFetchedAsynchronously; |
|
357 |
|
358 |
|
359 // Call divert request is for voice mailbox. |
|
360 TBool iVoiceMailboxDivert; |
|
361 |
|
362 //Context menu items for call forwarding |
|
363 CDesCArrayFlat* iContextMenuItems; |
|
364 |
|
365 // Reference to call divert model. NOT owned. |
|
366 CGSCallDivertModel* iModel; |
|
367 TBool iVideoMailboxSupported; |
|
368 |
|
369 }; |
|
370 |
|
371 |
|
372 |
|
373 #endif //CFCALLDIVERTVIEW_H |
|
374 // End of File |