|
1 /* |
|
2 * Copyright (c) 2003 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: Dialog for defining new server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CWVSETTINGSUIDEFINENEWSERVERDIALOG_H |
|
20 #define CWVSETTINGSUIDEFINENEWSERVERDIALOG_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "CWVSettingsUINGDialog.h" |
|
24 #include <eiklbo.h> |
|
25 #include <akndialog.h> |
|
26 #include <aknsettingpage.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CAknSettingItemArray; |
|
30 class CAknSettingStyleListBox; |
|
31 class CIMPSSAPSettingsStore; |
|
32 class CIMPSSAPSettings; |
|
33 class CCommsDatabase; |
|
34 class CApUtils; |
|
35 class CApSettingsHandler; |
|
36 class MWVSettingsUICaller; |
|
37 class CWVSettingsUIDialogTitlePaneHandler; |
|
38 class CWVSettingsUIDialogImp; |
|
39 class CIMPSPresenceConnectionUi; |
|
40 class CPEngNWSessionSlotID2; |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * New server definition dialog |
|
45 * Implements the dialog, that is used when user is creating new server |
|
46 * |
|
47 * @lib WVServiceSettingsUi.dll |
|
48 * @since 2.1 |
|
49 */ |
|
50 |
|
51 NONSHARABLE_CLASS( CWVSettingsUIDefineNewServerDialog ) : |
|
52 public CAknDialog, |
|
53 public MEikListBoxObserver, |
|
54 public MAknSettingPageObserver |
|
55 { |
|
56 public: // Enumerations |
|
57 |
|
58 enum TEditMode |
|
59 { |
|
60 ENewServer = 1, |
|
61 EEditServer |
|
62 }; |
|
63 |
|
64 private: // Enumerations |
|
65 |
|
66 enum TItemType |
|
67 { |
|
68 ETextItem = 1, |
|
69 EPasswordItem |
|
70 }; |
|
71 |
|
72 // TSettingsListLayout is used for indexing items to array, so first |
|
73 // enumeration's value must be 0, and next must be 1 and so on... |
|
74 enum TSettingsListLayout |
|
75 { |
|
76 EServerName = 0, |
|
77 ESAP, |
|
78 EURL, |
|
79 EWVId, |
|
80 EPassword, |
|
81 ELastItemMarker // This has to be the last one!!!! |
|
82 }; |
|
83 |
|
84 // TCompValues is used for telling which settings values |
|
85 // are compulsory |
|
86 enum TCompValues |
|
87 { |
|
88 EWVSettingsViewServerName = 1, |
|
89 EWVSettingsViewIAPName = 2, |
|
90 EWVSettingsViewURL = 4, |
|
91 EWVSettingsViewWVUserId = 8, |
|
92 EWVSettingsViewPassword = 16 |
|
93 }; |
|
94 |
|
95 // TValueOrder is an index for the settings items |
|
96 // this is used when editing different values |
|
97 enum TValueOrder |
|
98 { |
|
99 EWVSettingsViewServerNameIndex = 0, |
|
100 EWVSettingsViewIAPNameIndex, |
|
101 EWVSettingsViewURLIndex, |
|
102 EWVSettingsViewWVUserIdIndex, |
|
103 EWVSettingsViewPasswordIndex |
|
104 }; |
|
105 |
|
106 public: // Constructors and destructor |
|
107 |
|
108 /** |
|
109 * C++ default constructor. |
|
110 * @param aExitReason This will hold the exit reason after this dialog |
|
111 * has been dismissed |
|
112 * @param aSAPSettingsStore Pointer to SAP settings store |
|
113 * @param aEditMode Edit mode |
|
114 * @param aCaller Pointer to the dialog observer |
|
115 * @param aTitlePaneHandler Pointer to the title pane handler |
|
116 * @param aDialog Pointer to the service settings UI dialog |
|
117 * @param aNewUid Uid of a created server |
|
118 * @param aConnectionUi pointer to connection ui |
|
119 * @param aServer Server, that is being edited. This is NULL in case of |
|
120 * creating new server |
|
121 */ |
|
122 CWVSettingsUIDefineNewServerDialog( TInt& aExitReason, |
|
123 CIMPSSAPSettingsStore& aSAPSettingsStore, |
|
124 TEditMode aEditMode, |
|
125 MWVSettingsObserver& aObserver, |
|
126 CWVSettingsUIDialogTitlePaneHandler& aTitlePaneHandler, |
|
127 CWVSettingsUIDialogImp* aDialog, |
|
128 TUint32& aNewUid, |
|
129 CIMPSPresenceConnectionUi* aConnectionUi, |
|
130 CIMPSSAPSettings* aServer = NULL ); |
|
131 |
|
132 |
|
133 /** |
|
134 * Destructor. |
|
135 */ |
|
136 virtual ~CWVSettingsUIDefineNewServerDialog(); |
|
137 |
|
138 private: //New functions |
|
139 |
|
140 /** |
|
141 * Launches IAP selector |
|
142 * @since 2.1 |
|
143 * @return Return flags of the dialog, to check if Exit was chosen |
|
144 */ |
|
145 TInt EditSapSettingsL(); |
|
146 |
|
147 /** |
|
148 * Stores all items to persistent storage |
|
149 * @since 2.1 |
|
150 */ |
|
151 void StoreAllItemsL(); |
|
152 |
|
153 /** |
|
154 * Adds setting item to setting-items array |
|
155 * @since 2.1 |
|
156 * @param aBuffer Buffer that is used to store the text in item |
|
157 * @param aId Resource identifier for this setting item |
|
158 * @param aTitleResource Resource for title text |
|
159 * @param aDlgResource Settings editor resource |
|
160 * @param aCompulsory Is this compulsory item |
|
161 * @param aItemType Setting item type |
|
162 */ |
|
163 void AddItemL( TDes& aBuffer, |
|
164 TInt aId, |
|
165 TInt aTitleResource, |
|
166 TInt aDlgResource, |
|
167 TBool aCompulsory = EFalse, |
|
168 TBool aIconNeeded = EFalse, |
|
169 TItemType aItemType = ETextItem ); |
|
170 |
|
171 /** |
|
172 * Loads given servers information to internal buffers |
|
173 * @since 2.1 |
|
174 */ |
|
175 void LoadExistingItemL(); |
|
176 |
|
177 /** |
|
178 * Checks if all the compulsory items are filled correctly |
|
179 * @since 2.1 |
|
180 * @return Are compulsory items filled correctly |
|
181 */ |
|
182 TBool CompulsoryItemsFilled(); |
|
183 |
|
184 /** |
|
185 * Externalizes all items internal states |
|
186 * @since 2.1 |
|
187 */ |
|
188 void SignalStoreLToAllL() const; |
|
189 |
|
190 /** |
|
191 * Creates a unique server name to internal buffer |
|
192 * @since 2.1 |
|
193 * @return Did it succeed |
|
194 */ |
|
195 TBool FormUniqueServerNameL(); |
|
196 |
|
197 /** |
|
198 * Created a unique server name from given data |
|
199 * @since 2.1 |
|
200 * @param aExistingNames an array of existing names |
|
201 * @param aNameToForm a reference to the name to be formed |
|
202 * @return Did it succeed |
|
203 */ |
|
204 TBool FormUniqueNameL( const CDesCArray& aExistingNames, TDes& aNameToForm ); |
|
205 |
|
206 /** |
|
207 * Transfers the focus to invalid field |
|
208 * @since 2.1 |
|
209 */ |
|
210 void ChangeFocusToInvalidCompulsoryField() const; |
|
211 |
|
212 /** |
|
213 * Generates safe flag value from given seed (enum) |
|
214 * @since 2.1 |
|
215 * @param aSeed Seed value |
|
216 * @return Safe flag value |
|
217 */ |
|
218 TInt GenerateFlagValue( TInt aSeed ) const; |
|
219 |
|
220 /** |
|
221 * Get server-list |
|
222 * Ownership is transferred to caller!!! |
|
223 * @since 2.1 |
|
224 * @return List of servers available |
|
225 */ |
|
226 CDesCArrayFlat* ServerListL() const; |
|
227 |
|
228 /** |
|
229 * Creates unique server name from internal server-list and places it |
|
230 * to internal buffer |
|
231 * @since 2.1 |
|
232 */ |
|
233 void FormUniqueServerL(); |
|
234 |
|
235 /** |
|
236 * Edits the server name settings item |
|
237 * @since 2.1 |
|
238 * @param Index of the setting item |
|
239 */ |
|
240 TInt EditServerNameL( TInt aIndex ); |
|
241 |
|
242 /** |
|
243 * Edits the user id settings item |
|
244 * @since 2.1 |
|
245 * @param Index of the setting item |
|
246 */ |
|
247 void EditUserIdL ( TInt aIndex ); |
|
248 |
|
249 /** |
|
250 * Edits the password settings item |
|
251 * @since 2.1 |
|
252 * @param Index of the setting item |
|
253 */ |
|
254 void EditPasswordL ( TInt aIndex ); |
|
255 |
|
256 /** |
|
257 * Returns the compulsory setting items |
|
258 * @since 2.1 |
|
259 * @return The compulsory setting items |
|
260 */ |
|
261 TInt GetCompulsoryItems () const; |
|
262 |
|
263 /** |
|
264 * Called when editing user ID and the length of user ID is zero. |
|
265 * Checks if login type is automatic and shows an error note if so |
|
266 * @since 2.1 |
|
267 * @return ETrue if login type is automatic |
|
268 */ |
|
269 TBool CheckAutoLoginValuesL(); |
|
270 |
|
271 /** |
|
272 * Asks for confirmation about logout and performs it if accepted |
|
273 * @since 2.1 |
|
274 * @return ETrue if logged out, EFalse if we stayed logged in |
|
275 */ |
|
276 TBool ConfirmLogoutL(); |
|
277 |
|
278 /** |
|
279 * Loads icon array |
|
280 * @since 3.0 |
|
281 */ |
|
282 void LoadIconArrayL(); |
|
283 |
|
284 /** |
|
285 * Help key support - GetHelpContext is called by the framework on |
|
286 * event EAknCmdHelp |
|
287 * -------------------------------------------------------------------------------- |
|
288 * CWVSettingsUIDefineNewServerDialog::GetHelpContext |
|
289 * @param aContext The context dependent on the current view is passed by the framework. |
|
290 */ |
|
291 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
292 |
|
293 private: // From CAknDialog |
|
294 |
|
295 /** |
|
296 * From CAknDialog, Handles menu commands |
|
297 * @param aCommandId Command event received |
|
298 */ |
|
299 void ProcessCommandL( TInt aCommand ); |
|
300 |
|
301 |
|
302 |
|
303 private: // From MEikListBoxObserver |
|
304 |
|
305 /** |
|
306 * From MEikListBoxObserver Callback for listbox events |
|
307 * @since 1.2 |
|
308 * @param aListBox Originating listbox |
|
309 * @param aEventType Event type |
|
310 */ |
|
311 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
312 |
|
313 private: // From MAknSettingPageObserver |
|
314 |
|
315 /** |
|
316 * Used to observe editor state when domain selection |
|
317 * query is variated on. |
|
318 * @since S60 v3.2 |
|
319 * @see MAknSettingPageObserver |
|
320 */ |
|
321 void HandleSettingPageEventL( CAknSettingPage* aSettingPage, |
|
322 TAknSettingPageEvent aEventType ); |
|
323 |
|
324 public: // From Uikon framework |
|
325 |
|
326 /** |
|
327 * From Uikon framework. Dynamically initialises a menu pane. |
|
328 * @param aResourceId Resource ID identifying the menu pane to initialise |
|
329 * @param aMenuPane The in-memory representation of the menu pane |
|
330 */ |
|
331 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
332 |
|
333 private: // from CCoeControl |
|
334 /** |
|
335 * From CCoeControl. Handles the keyevents |
|
336 * @param aKeyEvent The key event. |
|
337 * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown. |
|
338 * @return Indicates whether or not the key event was used by this control |
|
339 */ |
|
340 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
341 |
|
342 |
|
343 private: |
|
344 /** |
|
345 * The function to fetch the setting value given the ID, which could be in CENREP or Variation file |
|
346 */ |
|
347 TInt IntResourceValueL( TInt aResourceId ); |
|
348 /** |
|
349 * Static TCallBack method |
|
350 * to async exit dialog |
|
351 * @see TCallBack |
|
352 */ |
|
353 static TInt LaunchDlgCallback( TAny* aDlg ); |
|
354 |
|
355 /** |
|
356 * close dialog using callback function |
|
357 * to async exit dialog |
|
358 * @see TCallBack |
|
359 */ |
|
360 void CloseDialogL(); |
|
361 protected: // From CEikDialog |
|
362 |
|
363 /** |
|
364 * From CEikDialog @see CEikDialog for more information |
|
365 */ |
|
366 void PreLayoutDynInitL(); |
|
367 |
|
368 /** |
|
369 * From CEikDialog @see CEikDialog for more information |
|
370 */ |
|
371 void PostLayoutDynInitL(); |
|
372 |
|
373 /** |
|
374 * From CEikDialog @see CEikDialog for more information |
|
375 */ |
|
376 TBool OkToExitL( TInt aButtonId ); |
|
377 |
|
378 /** |
|
379 * From CEikDialog @see CEikDialog for more information |
|
380 */ |
|
381 TInt MappedCommandId( TInt aButtonId ); |
|
382 |
|
383 |
|
384 private: // Data |
|
385 |
|
386 // an exit reason for the dialog |
|
387 TInt& iExitReason; |
|
388 |
|
389 // Doesn't own. |
|
390 CIMPSSAPSettingsStore* iSAPSettingsStore; |
|
391 |
|
392 // edit mode for the dialog, new server or edit old |
|
393 TEditMode iEditMode; |
|
394 |
|
395 // owns: wvsapsettings for a server |
|
396 CIMPSSAPSettings* iSAP; |
|
397 |
|
398 // internet access point name pointer |
|
399 TPtr iIAPNamePtr; |
|
400 // server name pointer |
|
401 TPtr iServerNamePtr; |
|
402 // wvuserid pointer |
|
403 TPtr iWVUserIdPtr; |
|
404 // password pointer |
|
405 TPtr iPasswordPtr; |
|
406 // url pointer |
|
407 TPtr iURLPtr; |
|
408 |
|
409 // caller type of the dialog |
|
410 // Doesn't own |
|
411 MWVSettingsObserver* iObserver; |
|
412 |
|
413 // access point settings handler |
|
414 // Owns. |
|
415 CApSettingsHandler* iAPSettingsHandler; |
|
416 // comms database |
|
417 // Owns. |
|
418 CCommsDatabase* iCommsDb; |
|
419 // access point utilities |
|
420 // Owns. |
|
421 CApUtils* iAPUtils; |
|
422 // settings listbox |
|
423 // Doesn't own |
|
424 CAknSettingStyleListBox* iListbox; |
|
425 // Owns: settings item array |
|
426 CAknSettingItemArray* iSettingItemArray; |
|
427 // title pane handler, changes the text |
|
428 // Doesn't own |
|
429 CWVSettingsUIDialogTitlePaneHandler* iTitlePaneHandler; |
|
430 |
|
431 // ordinal of the setting items added |
|
432 TInt iOrdinal; |
|
433 |
|
434 // index of the array of servers |
|
435 TInt iServerArrayIndex; |
|
436 |
|
437 // internet access point name |
|
438 // Owns. |
|
439 HBufC* iIAPName; |
|
440 // server name |
|
441 // Owns. |
|
442 HBufC* iServerName; |
|
443 // wvuserid |
|
444 // Owns. |
|
445 HBufC* iWVUserId; |
|
446 // password |
|
447 // Owns. |
|
448 HBufC* iPassword; |
|
449 // url |
|
450 // Owns. |
|
451 HBufC* iURL; |
|
452 // tells if the internet access point setting has a value or not |
|
453 TBool iIAPHasValue; |
|
454 // internet access point id |
|
455 TUint32 iIAP; |
|
456 // invalid data in these setting items |
|
457 TInt iFailedFields; |
|
458 |
|
459 // user id before editing |
|
460 // owns. |
|
461 HBufC* iOldUserId; |
|
462 |
|
463 // the base dialog of service settings view |
|
464 // Doesn't own |
|
465 CWVSettingsUIDialogImp* iDialog; |
|
466 |
|
467 // tells if we should store old user id or not when editing |
|
468 TBool iStoreOldId; |
|
469 |
|
470 // pointer to the old user id |
|
471 TPtr iOldUserIdPtr; |
|
472 |
|
473 // Owns: old password |
|
474 HBufC* iOldPassword; |
|
475 |
|
476 // tells if we should save the SAP or not |
|
477 TBool iEdited; |
|
478 |
|
479 // the uid of the new server |
|
480 TUint32& iNewUid; |
|
481 |
|
482 TBool iProtected; |
|
483 |
|
484 // Pointer to a presence connection UI, owned if |
|
485 // iConnectionUIOwned is ETrue |
|
486 CIMPSPresenceConnectionUi* iConnectionUI; |
|
487 |
|
488 // iConnectionUI owhership |
|
489 TBool iConnectionUIOwned; |
|
490 |
|
491 // Is this dialog already deleted |
|
492 TBool iIsDeleted; |
|
493 |
|
494 ///<Cached pointer to control environment, not owned |
|
495 CCoeEnv* iCoeEnv; |
|
496 |
|
497 // previous server name (which was active before loading brand for |
|
498 // editable server), owned |
|
499 HBufC* iOldServerName; |
|
500 |
|
501 TBool iDomainSelectionQuery; |
|
502 // Async dialog launcher |
|
503 CAsyncCallBack* iDlgLauncher; |
|
504 |
|
505 TBool isDisplayedSubDialog; |
|
506 }; |
|
507 |
|
508 #endif // CWVSETTINGSUIDEFINENEWSERVERDIALOG_H |
|
509 |
|
510 // End of File |