1 /* |
|
2 * Copyright (c) 2006 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: Declaration of application selection dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CMCONNSETTINGSUIIMPL_H |
|
19 #define C_CMCONNSETTINGSUIIMPL_H |
|
20 |
|
21 #include <e32def.h> |
|
22 #include <e32base.h> |
|
23 #include <ConeResLoader.h> |
|
24 #include <badesca.h> // CDesCArrayFlat |
|
25 #include <cmdefconnvalues.h> |
|
26 #include <hlplch.h> |
|
27 |
|
28 #include "cmmanager.hrh" |
|
29 #include "cmapplicationsettingsui.h" |
|
30 |
|
31 class TCmDCSettingSelection; |
|
32 class CCmManagerImpl; |
|
33 class CCmDestinationImpl; |
|
34 class CCmPluginBase; |
|
35 |
|
36 //CONSTS |
|
37 const TInt KCmDefConnIndex = 0; |
|
38 const TInt KCmUserDefinedIndex = 1; |
|
39 |
|
40 namespace CMManager |
|
41 { |
|
42 enum TCmDCSettingSelectionMode |
|
43 { |
|
44 EDCAlwaysAsk, /**< |
|
45 * The user selected Always Ask |
|
46 */ |
|
47 EDCAskOnce, /**< |
|
48 * The user selected Ask Once |
|
49 */ |
|
50 EDCDestination, /**< |
|
51 * The user selected a destination |
|
52 */ |
|
53 EDCConnectionMethod, /**< |
|
54 * The user selected a connection method |
|
55 */ |
|
56 EDCDefaultConnection /**< |
|
57 * The user selected a connection method |
|
58 */ |
|
59 }; |
|
60 } //namespace CmManager |
|
61 |
|
62 /** |
|
63 * Stores the details of a setting selection |
|
64 * |
|
65 * @since S60 3.2 |
|
66 */ |
|
67 NONSHARABLE_STRUCT( TCmDCSettingSelection ) //extended with Ask Once |
|
68 { |
|
69 /** |
|
70 * Selection that the user made |
|
71 */ |
|
72 CMManager::TCmDCSettingSelectionMode iResult; |
|
73 |
|
74 /** |
|
75 * Id of the selected destination or connection method |
|
76 */ |
|
77 TUint iId; |
|
78 // ----------------------------------------------------------------------------- |
|
79 // TCmDCSettingSelection::operator== |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 inline TBool TCmDCSettingSelection::operator==( TCmDCSettingSelection& aDCSettingSelection ) const |
|
83 { |
|
84 return ( (iResult == aDCSettingSelection.iResult) && ( iId == aDCSettingSelection.iId ) ); |
|
85 }; |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // TCmDCSettingSelection::operator!= |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 inline TBool TCmDCSettingSelection::operator!=( TCmDCSettingSelection& aDCSettingSelection ) const |
|
92 { |
|
93 return (!( (iResult == aDCSettingSelection.iResult) && ( iId == aDCSettingSelection.iId ) )); |
|
94 }; |
|
95 // ----------------------------------------------------------------------------- |
|
96 // TCmDCSettingSelection::ConvertToDefConn |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 inline TCmDefConnValue TCmDCSettingSelection::ConvertToDefConn( ) const |
|
100 { |
|
101 TCmDefConnValue defConnValue; |
|
102 defConnValue.iType = ECmDefConnAlwaysAsk; |
|
103 defConnValue.iId = 0; |
|
104 switch ( iResult ) |
|
105 { |
|
106 case CMManager::EDCAlwaysAsk : |
|
107 { |
|
108 defConnValue.iType = ECmDefConnAlwaysAsk; |
|
109 break; |
|
110 } |
|
111 case CMManager::EDCAskOnce : |
|
112 { |
|
113 defConnValue.iType = ECmDefConnAskOnce; |
|
114 break; |
|
115 } |
|
116 case CMManager::EDCDestination : |
|
117 { |
|
118 defConnValue.iType = ECmDefConnDestination; |
|
119 defConnValue.iId = iId; |
|
120 break; |
|
121 } |
|
122 case CMManager::EDCConnectionMethod : |
|
123 { |
|
124 defConnValue.iType = ECmDefConnConnectionMethod; |
|
125 defConnValue.iId = iId; |
|
126 break; |
|
127 } |
|
128 case CMManager::EDCDefaultConnection : |
|
129 { |
|
130 defConnValue.iType = ECmDefConnAlwaysAsk; //default value |
|
131 break; |
|
132 } |
|
133 default: |
|
134 { |
|
135 defConnValue.iType = ECmDefConnAlwaysAsk; //default value |
|
136 break; |
|
137 } |
|
138 }; |
|
139 return defConnValue; |
|
140 }; |
|
141 }; |
|
142 |
|
143 |
|
144 |
|
145 /** |
|
146 * Implementation of application setting UI. |
|
147 * |
|
148 * @lib cmmanage.lib |
|
149 * @since S60 v3.2 |
|
150 */ |
|
151 NONSHARABLE_CLASS(CCmConnSettingsUiImpl) : public CBase |
|
152 { |
|
153 |
|
154 public: |
|
155 |
|
156 IMPORT_C static CCmConnSettingsUiImpl* NewL( CCmManagerImpl* aCCmManagerImpl = NULL ); |
|
157 static CCmConnSettingsUiImpl* NewWithoutTablesL(); |
|
158 |
|
159 virtual ~CCmConnSettingsUiImpl(); |
|
160 |
|
161 //========================================================================= |
|
162 // UI API |
|
163 // |
|
164 public: |
|
165 |
|
166 /** |
|
167 * Launches the 'easy to use' Settings UI provided for applications |
|
168 * for handling Destinations and Connection Methods |
|
169 * |
|
170 * @since 3.2 |
|
171 * @param aSelection If initialised to a valid value, sets the higlight to the |
|
172 * corresponding list item at startup. If a list of Destinations is displayed, and |
|
173 * the initial highlight is set to a Connection Method, the parent Destination |
|
174 * gets highlighted. On return, holds user selection. |
|
175 * @param aListItems A bit field which indicates which items shoud be |
|
176 * shown in the selection dialog. The bitmasks are |
|
177 * defined in the TCmSelectionDialogItems enum. |
|
178 * |
|
179 * The function leaves with KErrNotSupported if all the items which |
|
180 * were set to be shown are not supported/enabled. |
|
181 * E.g. Default Connection availability/support is controlled by the |
|
182 * Feature Manager so if only EShowDefaultConnection is set and the |
|
183 * Default Connection feature is not enabled than the function leaves |
|
184 * with KErrNotSupported. |
|
185 * |
|
186 * In other cases (when an item or items are not supported/enabled but |
|
187 * not all) the selected but not supported/enabled items are not added |
|
188 * to the list. The request to show such an item is silently ignored. |
|
189 * |
|
190 * |
|
191 * Special note about the EShowDestinations and EShowConnectionMethods |
|
192 * bitmasks: |
|
193 * The following enumerations controls how how destinations and |
|
194 * Connection Methods are presented in the selection UI. |
|
195 * General rule about the EShowDestinations: |
|
196 * Destinations which does not contain any Connection Methods are |
|
197 * not shown in the selection dialog. The same rule is applied if |
|
198 * the Destination containes Connection Methods but all of them |
|
199 * are filtered out by the filtering criteria. |
|
200 * EShowDestinations is set and EShowConnectionMethods is set: |
|
201 * Destination list is added to the selection UI and a Connection |
|
202 * Method can be selected inside a Destination. |
|
203 * EShowDestinations is set and EShowConnectionMethods is not set: |
|
204 * Destination list is added to the selection UI and no Connection |
|
205 * Method can be selected inside a Destination. |
|
206 * EShowDestinations is not set and EShowConnectionMethods is set: |
|
207 * Connection Method list is added to the selection UI. Connection |
|
208 * Methods are ordered according to the global bearer type |
|
209 * priorities. Destination cannot be selected. |
|
210 * EShowDestinations is not set and EShowConnectionMethods is not set: |
|
211 * The selection UI will not contain any Destination or Connection |
|
212 * Method. E.g. If EShowAlwaysAsk and EShowDefaultConnection was |
|
213 * set then the selection UI will contain two entries (AlwaysAsk |
|
214 * and DefaultConnection). |
|
215 * |
|
216 * @param aFilterArray Only Connection Methods with bearer types from |
|
217 * the aFilterArray will be showed. |
|
218 * All Connection Methods will be listed if the |
|
219 * array has no element. |
|
220 * @return TBool seleceted or not. |
|
221 * |
|
222 * @leave KErrArgument If the selection dialog would have zero |
|
223 * elements based on the aListItems bitmask |
|
224 * (aListItems is equal to zero). |
|
225 * |
|
226 * @leave KErrNotSupported |
|
227 * If the selection dialog would have zero |
|
228 * elements based on the aListItems bitmask |
|
229 * (all the selected elements in aListItems |
|
230 * are not supported/disabled). |
|
231 * E.g. aListItems = EShowDefaultConnection but |
|
232 * Default Connection feature is not enabled. |
|
233 * |
|
234 * @leave KErrNotFound If the selection dialog would have zero |
|
235 * elements caused by filtering out all the |
|
236 * Connection Methods with the aFilterArray |
|
237 * and not requesting other list elements by |
|
238 * the aListItems bitfield than an error note |
|
239 * is shown and the function call leaves with |
|
240 * KErrNotFound error code. |
|
241 * E.g. |
|
242 * - aListItems = EShowConnectionMethods |
|
243 * but all Connection Methods are filtered |
|
244 * out by the aFilterArray. |
|
245 */ |
|
246 IMPORT_C TBool RunApplicationSettingsL( |
|
247 TCmSettingSelection& aSelection, |
|
248 TUint aListItems, |
|
249 TBearerFilterArray& aFilterArray); |
|
250 |
|
251 /** |
|
252 * Launches the Default Connection Radio Button Page |
|
253 * for use in Destinations View |
|
254 * @since 3.1U |
|
255 * @params aSelection User selection. |
|
256 * @returns ETrue if a selection was made |
|
257 */ |
|
258 TBool RunDefaultConnecitonRBPageL ( TCmDCSettingSelection& aSelection ); |
|
259 |
|
260 /** |
|
261 * Creates and returns a string which contains the default connection name |
|
262 * for use in Destinations View |
|
263 * @since 3.1U |
|
264 * @params aSelection User selection. |
|
265 * @returns the default connection name |
|
266 */ |
|
267 HBufC* CreateDefaultConnectionNameL( TCmDefConnValue aSelection ); |
|
268 |
|
269 /** |
|
270 * Enables/Disables AlwaysAsk |
|
271 * |
|
272 * @param ETrue enables |
|
273 * @since S60 3.2 |
|
274 */ |
|
275 inline void EnableAlwaysAsk( TBool aEnable ) |
|
276 { iShowAlwaysAsk = aEnable; } |
|
277 |
|
278 /** |
|
279 * Enables/Disables EasyWlan |
|
280 * |
|
281 * @param ETrue enables |
|
282 * @since S60 3.2 |
|
283 */ |
|
284 inline void EnableEasyWlan( TBool aEnable ) |
|
285 { iShowEasyWlan = aEnable; } |
|
286 |
|
287 /** |
|
288 * Enables/Disables VirtualCMs |
|
289 * |
|
290 * @param ETrue enables |
|
291 * @since S60 3.2 |
|
292 */ |
|
293 inline void EnableVirtualCMs( TBool aEnable ) |
|
294 { iShowVirtualCMs = aEnable; } |
|
295 |
|
296 /** |
|
297 * Enables/Disables EmptyDestinations |
|
298 * |
|
299 * @param ETrue enables |
|
300 * @since S60 3.2 |
|
301 */ |
|
302 inline void EnableEmptyDestinations( TBool aEnable ) |
|
303 { iShowEmptyDestinations = aEnable; } |
|
304 |
|
305 /** |
|
306 * Sets a destination id which should be omitted from the list |
|
307 * typically this will be the parent destination of a virtual CM |
|
308 * |
|
309 * @param aDestinationId |
|
310 * @since S60 3.2 |
|
311 */ |
|
312 inline void SetDestinationToOmit( TUint32 aDestinationId ) |
|
313 { iDestinationToOmit = aDestinationId; } |
|
314 |
|
315 /** |
|
316 * Enables/Disables Ask Once |
|
317 * |
|
318 * @param ETrue enables |
|
319 * @since S60 3.2 |
|
320 */ |
|
321 inline void EnableAskOnce( TBool aEnable ) |
|
322 { iShowAskOnce = aEnable; } |
|
323 |
|
324 /** |
|
325 * Enables/Disables Uncategorised item |
|
326 * |
|
327 * @param ETrue enables |
|
328 * @since S60 3.2 |
|
329 */ |
|
330 inline void EnableUncat( TBool aEnable ) |
|
331 { iShowUncat = aEnable; } |
|
332 |
|
333 /** |
|
334 * Enables/Disables Default Connection item |
|
335 * |
|
336 * @param ETrue enables |
|
337 * @since S60 3.2 |
|
338 */ |
|
339 inline void EnableDefConn( TBool aEnable ) |
|
340 { iShowDefConn = aEnable; } |
|
341 |
|
342 |
|
343 |
|
344 /** |
|
345 * Sets the array of destinations to be used. |
|
346 * Typically this routine will be used by plugins having |
|
347 * restrictions on possible destinations. |
|
348 * |
|
349 * @param aDestinationArray |
|
350 * @since S60 3.2 |
|
351 */ |
|
352 IMPORT_C void SetDestinationArrayToUseL( RArray<TUint32> aDestinationArray ); |
|
353 |
|
354 /** |
|
355 * Clear previously passed destinations and return to normal use. |
|
356 * |
|
357 * @since S60 3.2 |
|
358 */ |
|
359 IMPORT_C void ClearDestinationArrayToUse(); |
|
360 |
|
361 private: |
|
362 |
|
363 CCmConnSettingsUiImpl(); |
|
364 |
|
365 void ConstructL( CCmManagerImpl* aCCmManagerImpl = NULL ); |
|
366 |
|
367 TInt LoadResourceL (); |
|
368 |
|
369 /** |
|
370 * Displays a set of destinations for selecting a network connection |
|
371 * |
|
372 * @param aSelection If initialised to a valid value, sets the higlight to the |
|
373 * corresponding list item at startup. If a list of Destinations is displayed, and |
|
374 * the initial highlight is set to a Connection Method, the parent Destination |
|
375 * gets highlighted. On return, holds user selection. |
|
376 * @return soft key selection |
|
377 */ |
|
378 TBool ShowConnSelectRadioPageL( TCmDCSettingSelection& aSelection, |
|
379 const TInt aTitleStringResource, |
|
380 TBearerFilterArray& aFilterArray ); |
|
381 |
|
382 /** |
|
383 * Displays a the Default Connection/User Defined radio button page |
|
384 * |
|
385 * @param aSelection If initialised to a valid value, sets the higlight to the |
|
386 * corresponding list item at startup. If a list of Destinations is displayed, and |
|
387 * the initial highlight is set to a Connection Method, the parent Destination |
|
388 * gets highlighted. On return, holds user selection. |
|
389 * @return soft key selection |
|
390 */ |
|
391 // TBool ShowDefConnRadioPageL( TInt& aSelection ); |
|
392 |
|
393 |
|
394 /** |
|
395 * Return array of destination of which have at least connection method |
|
396 * @param aItems array of destination names |
|
397 */ |
|
398 void BuildDestinationArrayL( CDesCArrayFlat* aItems, |
|
399 TBearerFilterArray& aFilterArray ); |
|
400 |
|
401 /** |
|
402 * Return array of CMs of which have at least connection method |
|
403 * @param aItems array of destination names |
|
404 */ |
|
405 void BuildCMArrayL( CDesCArrayFlat* aItems, |
|
406 TBearerFilterArray& aFilterArray ); |
|
407 |
|
408 /** |
|
409 * Put the array of CMs into iConnMethods |
|
410 */ |
|
411 void GetCMArrayL( ); |
|
412 |
|
413 /** |
|
414 * Build uncategorized connection method array and append |
|
415 * 'Uncategorized' item if there's any. |
|
416 * @param aUncatArray array of uncategorized connection method ids. |
|
417 * @param aItems array of destination names |
|
418 */ |
|
419 void BuildUncatArrayL( RPointerArray<CCmPluginBase>& aUncatArray, |
|
420 CDesCArrayFlat* aItems, |
|
421 TBearerFilterArray& aFilterArray ); |
|
422 /** |
|
423 * Show destination selection dialog. |
|
424 * @param aDestSelected index of selected destination |
|
425 * @param aItems array of destination names |
|
426 * @param aSelection If initialised to a valid value, sets the higlight to the |
|
427 * corresponding list item at startup. If a list of Destinations is displayed, and |
|
428 * the initial highlight is set to a Connection Method, the parent Destination |
|
429 * gets highlighted. On return, holds user selection. |
|
430 * @return ETrue if a selection was made |
|
431 */ |
|
432 TBool UserSelectionDlgL( TInt& aDestSelected, |
|
433 CDesCArrayFlat* aItems, |
|
434 TCmDCSettingSelection& aSelection, |
|
435 const TInt aTitleStringResource, |
|
436 TBool aOpenDestination ); |
|
437 |
|
438 /** |
|
439 * Show uncategorized connection method selection dialog |
|
440 * @param aUncatArray list of uncategorized connection methods. |
|
441 * @param aSelection If initialised to a valid value, sets the higlight to the |
|
442 * corresponding list item at startup. On return, holds user selection. |
|
443 * @return softkey selection. |
|
444 */ |
|
445 TBool UserSelectedUncatItemL( RPointerArray<CCmPluginBase>& aUncatArray, |
|
446 TCmDCSettingSelection& aSelection, |
|
447 const TInt aTitleStringResource ); |
|
448 |
|
449 /** |
|
450 * A radio button page of all the connection methods belonging to |
|
451 * a the specified destination |
|
452 * |
|
453 * @param aDestinationId the destination from which a connection |
|
454 * method will be selected |
|
455 * @param aSelection If initialised to a valid value, sets the higlight to the |
|
456 * corresponding list item at startup. On return, holds user selection. |
|
457 * @return soft key selection |
|
458 */ |
|
459 TBool ShowConnectionMethodsL( RPointerArray<CCmPluginBase>& aCmArray, |
|
460 TCmDCSettingSelection& aSelection, |
|
461 const TInt aTitleStringResource, |
|
462 TBearerFilterArray& aFilterArray ); |
|
463 |
|
464 /** |
|
465 * Checks if a Connection method is virtual |
|
466 * |
|
467 * @since S60 3.2 |
|
468 * @param aCmIapId the iap id of the CM |
|
469 * @return ETrue if virtual |
|
470 */ |
|
471 TBool IsCmVirtualL( TUint32 aCmIapId ); |
|
472 |
|
473 private: // data |
|
474 |
|
475 /** |
|
476 * pointer to the CmManager - OWNED |
|
477 */ |
|
478 CCmManagerImpl* iCmManagerImpl; |
|
479 |
|
480 /** |
|
481 * resource loader |
|
482 */ |
|
483 RConeResourceLoader iResourceReader; |
|
484 |
|
485 /** |
|
486 * List of destination or CM IDs to show |
|
487 */ |
|
488 RArray<TUint32> iItems; |
|
489 /** |
|
490 * Indicates whether iItems holds destinatos or CMs |
|
491 */ |
|
492 TBool iAreDestinations; |
|
493 |
|
494 /** |
|
495 * Indicates whether Always Ask should be shown in the page |
|
496 */ |
|
497 TBool iShowAlwaysAsk; |
|
498 |
|
499 /** |
|
500 * Indicates whether EasyWlan should be shown in the page |
|
501 */ |
|
502 TBool iShowEasyWlan; |
|
503 |
|
504 /** |
|
505 * Indicates whether virtual iaps should be shown in the page |
|
506 */ |
|
507 TBool iShowVirtualCMs; |
|
508 |
|
509 /** |
|
510 * Indicates whether Empty destinations should be shown in the page |
|
511 */ |
|
512 TBool iShowEmptyDestinations; |
|
513 |
|
514 /** |
|
515 * Indicates the id of destination to specifically omit (usually a parent destination) |
|
516 * if zero, it can be ignored |
|
517 */ |
|
518 TUint iDestinationToOmit; |
|
519 |
|
520 /** |
|
521 * Indicates whether Ask Once item should be shown in the page |
|
522 */ |
|
523 TBool iShowAskOnce; |
|
524 |
|
525 /** |
|
526 * Indicates whether Uncategorized item should be shown in the page |
|
527 */ |
|
528 TBool iShowUncat; |
|
529 |
|
530 /** |
|
531 * Indicates whether Default Connection item should be shown in the page |
|
532 */ |
|
533 TBool iShowDefConn; |
|
534 |
|
535 /** |
|
536 * Indicates whether we have an own CmManager that we have to create and destroy |
|
537 */ |
|
538 TBool iOwnCmManager; |
|
539 |
|
540 /** |
|
541 * Indicates whether the selected destinaton should be opened |
|
542 */ |
|
543 TBool iOpenDestination; |
|
544 |
|
545 /** |
|
546 * Indicates whether to use a passed list of destinations |
|
547 * or use our own algorithm to get the list of possible destinations. |
|
548 */ |
|
549 TBool iUsePassedDestinationArray; |
|
550 |
|
551 /** |
|
552 * An Array to hold the passed destinations. |
|
553 */ |
|
554 RArray<TUint32> iPassedDestinations; |
|
555 |
|
556 /** |
|
557 * help context |
|
558 */ |
|
559 TCoeContextName iHelpContext; |
|
560 |
|
561 /** |
|
562 * Indicates whether the tables should be created |
|
563 */ |
|
564 TBool iCreateTables; |
|
565 }; |
|
566 #endif // C_CMCONNSETTINGSUIIMPL_H |
|