|
1 /* |
|
2 * Copyright (c) 2005 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 to create to profile using wizard |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ASPPROFILEWIZARDDIALOG_H |
|
20 #define ASPPROFILEWIZARDDIALOG_H |
|
21 |
|
22 // BackGround Context |
|
23 #include <AknsBasicBackgroundControlContext.h> |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32base.h> |
|
27 #include <akntextsettingpage.h> // CAknIntegerSettingPage |
|
28 #include <aknpasswordsettingpage.h> // CAknAlphaPasswordSettingPage |
|
29 #include <aknradiobuttonsettingpage.h> // CAknRadioButtonSettingPage |
|
30 #include <AknInfoPopupNoteController.h> // CAknInfoPopupNoteController |
|
31 |
|
32 #include "AspProfileWizard.h" |
|
33 |
|
34 |
|
35 // CONSTANTS |
|
36 |
|
37 //const TInt KMsToWaitBeforePopup = 1000; |
|
38 const TInt KMsToWaitBeforePopup = 3000; |
|
39 const TInt KMsToWaitBeforeRePopup = 6000; |
|
40 const TInt KMsTimePopupInView = 60*1000; |
|
41 |
|
42 /** |
|
43 * MAspEditorPageObserver |
|
44 * |
|
45 * Observer interface function. |
|
46 */ |
|
47 NONSHARABLE_CLASS (MAspEditorPageObserver) |
|
48 { |
|
49 public: |
|
50 enum TEditorEventType |
|
51 { |
|
52 EKeyEvent, |
|
53 EContentCountEvent |
|
54 }; |
|
55 |
|
56 public: |
|
57 /** |
|
58 * Editor page call this when editor is about to close. |
|
59 * @param aText Editor text. |
|
60 * @return ETrue if input is ok, EFalse otherwise. |
|
61 */ |
|
62 virtual TBool CheckValidity(const TDesC& aText, TInt aSettingType) = 0; |
|
63 |
|
64 /** |
|
65 * Editor page call this to inform observer about editor event. |
|
66 * @param aEvent. |
|
67 * @param aValue. |
|
68 * @return None. |
|
69 */ |
|
70 virtual void HandleEditorEvent(TInt aEvent, TInt aValue) = 0; |
|
71 |
|
72 /** |
|
73 * Editor page call this to inform observer about editor event. |
|
74 * @param aEvent. |
|
75 * @param aValue. |
|
76 * @return None. |
|
77 */ |
|
78 virtual void GetNavipaneText(TDes& aText, TInt aContentCount) = 0; |
|
79 }; |
|
80 |
|
81 |
|
82 /** |
|
83 * TAspSettingPageParam |
|
84 * |
|
85 * This class is used as general parameter type. |
|
86 */ |
|
87 NONSHARABLE_CLASS (TAspSettingPageParam) |
|
88 { |
|
89 public: |
|
90 TInt iCommandId; |
|
91 TBuf<KBufSize> iPageText; |
|
92 MAspEditorPageObserver* iObserver; |
|
93 TInt iSettingType; |
|
94 }; |
|
95 |
|
96 |
|
97 /** |
|
98 * CAspTextSettingPage |
|
99 * |
|
100 * Setting page that returns command button id. |
|
101 */ |
|
102 NONSHARABLE_CLASS (CAspTextSettingPage) : public CAknTextSettingPage |
|
103 { |
|
104 public: |
|
105 CAspTextSettingPage(TInt aResourceID, TDes& aText, TInt aTextSettingPageFlags, |
|
106 TAspSettingPageParam& aParam); |
|
107 ~CAspTextSettingPage(); |
|
108 |
|
109 protected: // From CCoeControl |
|
110 void ProcessCommandL(TInt aCommandId); |
|
111 TBool PostDisplayCheckL(); |
|
112 TBool OkToExitL(TBool aAccept); |
|
113 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
114 |
|
115 private: |
|
116 void UpdateNaviPaneL(); |
|
117 |
|
118 private: |
|
119 TAspSettingPageParam& iParam; |
|
120 CAspNaviPaneHandler* iNaviPaneHandler; |
|
121 }; |
|
122 |
|
123 |
|
124 /** |
|
125 * CAspRadioButtonSettingPage |
|
126 * |
|
127 * Setting page that returns command button id. |
|
128 */ |
|
129 NONSHARABLE_CLASS (CAspRadioButtonSettingPage) : public CAknRadioButtonSettingPage ,public MEikListBoxObserver |
|
130 { |
|
131 public: |
|
132 CAspRadioButtonSettingPage(TInt aResourceID, TInt& aCurrentSelectionIndex, |
|
133 const MDesCArray* aItemArray, TAspSettingPageParam& aParam); |
|
134 ~CAspRadioButtonSettingPage(); |
|
135 |
|
136 protected: // From CCoeControl |
|
137 void ProcessCommandL(TInt aCommandId); |
|
138 TBool PostDisplayCheckL(); |
|
139 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
140 //from MEikListBoxObserver for Touch event Handling |
|
141 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
142 |
|
143 private: |
|
144 void UpdateNaviPaneL(); |
|
145 |
|
146 private: |
|
147 TAspSettingPageParam& iParam; |
|
148 CAspNaviPaneHandler* iNaviPaneHandler; |
|
149 const MDesCArray* iItemArray; |
|
150 }; |
|
151 |
|
152 |
|
153 /** |
|
154 * CAspCheckBoxSettingPage |
|
155 * |
|
156 * Setting page that returns command button id. |
|
157 */ |
|
158 NONSHARABLE_CLASS (CAspCheckBoxSettingPage) : public CAknCheckBoxSettingPage,public MEikListBoxObserver |
|
159 { |
|
160 public: |
|
161 CAspCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray, TAspSettingPageParam& aParam); |
|
162 |
|
163 ~CAspCheckBoxSettingPage(); |
|
164 |
|
165 protected: // From CCoeControl |
|
166 void ProcessCommandL(TInt aCommandId); |
|
167 TBool PostDisplayCheckL(); |
|
168 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
169 //from MEikListBoxObserver for touch event handling |
|
170 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
171 |
|
172 private: |
|
173 void UpdateNaviPaneL(); |
|
174 |
|
175 private: |
|
176 TAspSettingPageParam& iParam; |
|
177 CAspNaviPaneHandler* iNaviPaneHandler; |
|
178 TInt iSelectionCount; |
|
179 CSelectionItemList* iSelectionItemList; |
|
180 }; |
|
181 |
|
182 |
|
183 /** |
|
184 * CAspAlphaPasswordSettingPage |
|
185 * |
|
186 * Setting page that returns command button id. |
|
187 */ |
|
188 NONSHARABLE_CLASS (CAspAlphaPasswordSettingPage) : public CAknAlphaPasswordSettingPage |
|
189 { |
|
190 public: |
|
191 CAspAlphaPasswordSettingPage(TInt aResourceID, TDes& aNewPassword, const TDesC& aOldPassword, TAspSettingPageParam& aParam); |
|
192 |
|
193 ~CAspAlphaPasswordSettingPage(); |
|
194 |
|
195 protected: // From CCoeControl |
|
196 void ProcessCommandL(TInt aCommandId); |
|
197 TBool PostDisplayCheckL(); |
|
198 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
199 |
|
200 private: |
|
201 void UpdateNaviPaneL(); |
|
202 |
|
203 private: |
|
204 TAspSettingPageParam& iParam; |
|
205 CAspNaviPaneHandler* iNaviPaneHandler; |
|
206 |
|
207 }; |
|
208 |
|
209 |
|
210 // Forward Declaration |
|
211 class CAknsBasicBackgroundControlContext; |
|
212 |
|
213 /** |
|
214 * CAspProfileWizardDialog |
|
215 * |
|
216 * Dialog for editing profile name, data and connection. |
|
217 */ |
|
218 NONSHARABLE_CLASS (CAspProfileWizardDialog) : public CAknDialog, |
|
219 public MAspActiveCallerObserver, |
|
220 public MAspEditorPageObserver |
|
221 { |
|
222 enum TAspProfileDialogListIndex |
|
223 { |
|
224 EIndexProfileName = 0, |
|
225 EIndexProfileContent = 1, |
|
226 EIndexProfileConnection = 2 |
|
227 }; |
|
228 |
|
229 public: |
|
230 /** |
|
231 * Launches profile dialog for editing profile name, data and connection. |
|
232 * @param aParam Class that contains dialog parameters. |
|
233 * @return Completion code. |
|
234 */ |
|
235 static TBool ShowDialogL(TAspParam& aParam); |
|
236 |
|
237 |
|
238 public:// Constructors and destructor |
|
239 |
|
240 /** |
|
241 * Two-phased constructor. |
|
242 */ |
|
243 static CAspProfileWizardDialog* NewL(TAspParam& aParam); |
|
244 |
|
245 /** |
|
246 * Destructor. |
|
247 */ |
|
248 virtual ~CAspProfileWizardDialog(); |
|
249 |
|
250 private: |
|
251 |
|
252 /** |
|
253 * C++ default constructor. |
|
254 */ |
|
255 CAspProfileWizardDialog(TAspParam& aParam); |
|
256 |
|
257 /** |
|
258 * By default Symbian OS constructor is private. |
|
259 */ |
|
260 void ConstructL(); |
|
261 |
|
262 |
|
263 private: |
|
264 /** |
|
265 * From the base class. |
|
266 * Called by framework before exiting the dialog. |
|
267 * @param Button id. |
|
268 * @return ETrue to exit\ EFalse to not to exit. |
|
269 */ |
|
270 TBool OkToExitL(TInt aButtonId); |
|
271 |
|
272 /** |
|
273 * From the base class. |
|
274 * Called by framework before the dialog is shown. |
|
275 * @param None |
|
276 * @return None |
|
277 */ |
|
278 void PreLayoutDynInitL(); |
|
279 |
|
280 /** |
|
281 * From the base class. |
|
282 * Handles menu events. |
|
283 * @param aCommandId Command id. |
|
284 * @return None. |
|
285 */ |
|
286 void ProcessCommandL(TInt aCommandId); |
|
287 |
|
288 /** |
|
289 * From the base class. |
|
290 * Called by framework for key event handling. |
|
291 * @param aKeyEvent. |
|
292 * @param TEventCode. |
|
293 * @return Return code. |
|
294 */ |
|
295 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
296 |
|
297 /** |
|
298 * From the base class. |
|
299 * Called when dialog is activated. |
|
300 * @return None. |
|
301 */ |
|
302 void ActivateL(); |
|
303 |
|
304 /** |
|
305 * Method to get context sensitive help topic. |
|
306 * @param aContext Help topic to open. |
|
307 * @return None. |
|
308 */ |
|
309 //void GetHelpContext(TCoeHelpContext& aContext) const; |
|
310 |
|
311 /** |
|
312 * From base class. |
|
313 * Called when UI layout changes. |
|
314 * @param aType. |
|
315 * @return None. |
|
316 */ |
|
317 void HandleResourceChange(TInt aType); |
|
318 |
|
319 |
|
320 private: // from MAspActiveCallerObserver |
|
321 |
|
322 /** |
|
323 * From MAspActiveCallerObserver |
|
324 * Called when CAspActiveCaller completes. |
|
325 * @param aCallId. |
|
326 * @return None. |
|
327 */ |
|
328 void HandleActiveCallL(TInt aCallId); |
|
329 |
|
330 |
|
331 private: // from MAspEditorPageObserver |
|
332 |
|
333 /** |
|
334 * From MAspEditorPageObserver |
|
335 * Check setting page input. |
|
336 * @param aText. |
|
337 * @param aSettingType. |
|
338 * @return ETrue is input is valid, EFalse othherwise. |
|
339 */ |
|
340 TBool CheckValidity(const TDesC& aText, TInt aSettingType); |
|
341 |
|
342 /** |
|
343 * Check setting page input. |
|
344 * @param aText. |
|
345 * @param aSettingType. |
|
346 * @return ETrue is input is valid, EFalse othherwise. |
|
347 */ |
|
348 TBool CheckValidityL(const TDesC& aText, TInt aSettingType); |
|
349 |
|
350 /** |
|
351 * Handle editor event. |
|
352 * @param aEvent. |
|
353 * @param aValue. |
|
354 * @return None. |
|
355 */ |
|
356 void HandleEditorEvent(TInt aEvent, TInt aValue); |
|
357 |
|
358 /** |
|
359 * Get navipane text. |
|
360 * @param aText. |
|
361 * @param aContentCount. |
|
362 * @return None. |
|
363 */ |
|
364 void GetNavipaneText(TDes& aText, TInt aContentCount); |
|
365 |
|
366 |
|
367 private: |
|
368 /** |
|
369 * Utility function, updates dialog cba. |
|
370 * @param aResourceId. |
|
371 * @return None. |
|
372 */ |
|
373 void UpdateCbaL(TInt aResourceId); |
|
374 |
|
375 /** |
|
376 * Utility function, sets text editor text. |
|
377 * @param aResourceId. |
|
378 * @return None. |
|
379 */ |
|
380 void SetTextEditorTextL(TInt aResource); |
|
381 |
|
382 /** |
|
383 * For setting the background Screen |
|
384 */ |
|
385 void SetBackgroundContextL(); |
|
386 |
|
387 /** |
|
388 * Update color and font |
|
389 */ |
|
390 void UpdateTextColorL(); |
|
391 |
|
392 |
|
393 private: |
|
394 |
|
395 /** |
|
396 * Edit setting item. |
|
397 * @param aItem Setting item data. |
|
398 * @return Return code. |
|
399 */ |
|
400 TInt EditSettingItemL(CAspWizardItem* aItem); |
|
401 |
|
402 /** |
|
403 * Edit setting item. |
|
404 * @param aItem Setting item data. |
|
405 * @return Return code. |
|
406 */ |
|
407 TInt EditSettingItemTextL(CAspWizardItem* aItem); |
|
408 |
|
409 /** |
|
410 * Edit setting item. |
|
411 * @param aItem Setting item data. |
|
412 * @return Return code. |
|
413 */ |
|
414 TInt EditSettingItemBearerTypeL(CAspWizardItem* aItem); |
|
415 |
|
416 /** |
|
417 * Edit setting item. |
|
418 * @param aItem Setting item data. |
|
419 * @return Return code. |
|
420 */ |
|
421 TInt EditSettingItemProtocolVersionL(CAspWizardItem* aItem); |
|
422 |
|
423 /** |
|
424 * Edit setting item. |
|
425 * @param aItem Setting item data. |
|
426 * @return Return code. |
|
427 */ |
|
428 TInt EditSettingItemLocalDatabaseL(CAspWizardItem* aItem); |
|
429 |
|
430 /** |
|
431 * Edit setting item. |
|
432 * @param aItem Setting item data. |
|
433 * @return Return code. |
|
434 */ |
|
435 TInt EditSettingItemSecretL(CAspWizardItem* aItem); |
|
436 |
|
437 /** |
|
438 * Edit setting item. |
|
439 * @param aItem Setting item data. |
|
440 * @return Return code. |
|
441 */ |
|
442 TInt EditSettingItemProfileNameL(CAspWizardItem* aItem); |
|
443 |
|
444 /** |
|
445 * Edit setting item. |
|
446 * @param aItem Setting item data. |
|
447 * @return Return code. |
|
448 */ |
|
449 TInt EditSettingItemHostAddressL(CAspWizardItem* aItem); |
|
450 |
|
451 /** |
|
452 * Edit setting item. |
|
453 * @param aItem Setting item data. |
|
454 * @return Return code. |
|
455 */ |
|
456 TInt EditSettingItemContentSelectionL(CAspWizardItem* aItem); |
|
457 |
|
458 /** |
|
459 * Edit setting item. |
|
460 * @param aItem Setting item data. |
|
461 * @return Return code. |
|
462 */ |
|
463 TInt ShowTextEditorL(TInt aResourceId, TDes& aText, const TDesC& aTitle, |
|
464 TBool aMandatory, TBool aLatinInput, TInt aMaxLength, TInt aSettingType); |
|
465 |
|
466 private: |
|
467 |
|
468 /** |
|
469 * Get navi pane text. |
|
470 * @param aText. |
|
471 * @param aCurrent. |
|
472 * @param aFinal. |
|
473 * @return Return code. |
|
474 */ |
|
475 void GetNaviPaneText(TDes& aText, TInt aCurrent, TInt aFinal); |
|
476 |
|
477 /** |
|
478 * Get navi pane text. |
|
479 * @param aText. |
|
480 * @param aItem. |
|
481 * @return Return code. |
|
482 */ |
|
483 void GetNaviPaneText(TDes& aText, CAspWizardItem* aItem); |
|
484 |
|
485 /** |
|
486 * Set default setting values. |
|
487 * @param None. |
|
488 * @return None. |
|
489 */ |
|
490 void SetDefaultValuesL(); |
|
491 |
|
492 |
|
493 /** |
|
494 * Show one proifle wizard editor. |
|
495 * @param None. |
|
496 * @return Return code. |
|
497 */ |
|
498 void RunWizardL(); |
|
499 |
|
500 /** |
|
501 * Show one proifle wizard editor. |
|
502 * @param None. |
|
503 * @return Return code. |
|
504 */ |
|
505 TInt RunWizard(); |
|
506 |
|
507 void ShowPopupNoteL(TInt aResource, TInt aDelay); |
|
508 void HidePopupNote(); |
|
509 void ShowErrorNoteL(TInt aError); |
|
510 |
|
511 |
|
512 private: |
|
513 // text editor |
|
514 CEikRichTextEditor* iTextEditor; |
|
515 |
|
516 // text editor text |
|
517 HBufC* iTextEditorText; |
|
518 |
|
519 // handles profile setting data and profile creation |
|
520 CAspProfileWizard* iWizard; |
|
521 |
|
522 // dialog parameter for returning value to caller |
|
523 TAspParam* iDialogParam; |
|
524 |
|
525 // id of the calling application |
|
526 TInt iApplicationId; |
|
527 |
|
528 // sync session |
|
529 RSyncMLSession* iSyncSession; |
|
530 |
|
531 // long buffer for string handling |
|
532 TBuf<KBufSize255> iBuf; |
|
533 |
|
534 // for title and icon handling |
|
535 CStatusPaneHandler* iStatusPaneHandler; |
|
536 |
|
537 // for making function call via active scheduler |
|
538 CAspActiveCaller* iActiveCaller; |
|
539 |
|
540 // for bearer type list construction |
|
541 CAspBearerHandler* iBearerHandler; |
|
542 |
|
543 // format string from resource file |
|
544 TBuf<KBufSize> iNaviPaneTextFormat; |
|
545 |
|
546 // popup note |
|
547 CAknInfoPopupNoteController* iPopupNote; |
|
548 |
|
549 // needed for unique server id check |
|
550 CAspProfileList* iProfileList; |
|
551 |
|
552 // Background context |
|
553 CAknsBasicBackgroundControlContext* iBgContext; |
|
554 |
|
555 // Flag for checking whether moving in Backward direction or not |
|
556 TBool iMoveBack; |
|
557 }; |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 #endif // ASPPROFILEWIZARDDIALOG_h |
|
564 |
|
565 // End of File |