|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * This set of classes implememts setting pages for time, date, and duration |
|
16 * and IP address |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #include "aknmfnesettingpage.h" |
|
23 |
|
24 #include <aknlayoutscalable_avkon.cdl.h> |
|
25 #include <avkon.mbg> |
|
26 #include <aknconsts.h> |
|
27 |
|
28 #include <AknTasHook.h> |
|
29 #if defined( RD_SCALABLE_UI_V2) |
|
30 #include "aknbutton.h" |
|
31 // For MAknMfneCommandObserver |
|
32 #include <aknmfnecommandobserver.h> |
|
33 #endif //if defined( RD_SCALABLE_UI_V2) |
|
34 |
|
35 |
|
36 ////////////////////////////////////////////////////////////////////// |
|
37 // |
|
38 // MFNE SETTING PAGE - virtual class |
|
39 // |
|
40 ////////////////////////////////////////////////////////////////////// |
|
41 |
|
42 |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CAknMfneSettingPage::~CAknMfneSettingPage |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 EXPORT_C CAknMfneSettingPage::~CAknMfneSettingPage() |
|
49 { |
|
50 AKNTASHOOK_REMOVE(); |
|
51 } |
|
52 |
|
53 |
|
54 /** |
|
55 * Simple pass-through constructor for this interim class |
|
56 * |
|
57 */ |
|
58 EXPORT_C CAknMfneSettingPage::CAknMfneSettingPage( TInt aResourceId ) : CAknSettingPage( aResourceId ) |
|
59 { |
|
60 AKNTASHOOK_ADD( this, "CAknMfneSettingPage" ); |
|
61 } |
|
62 |
|
63 /** |
|
64 * Constructor that allows separate setting page and editor resources |
|
65 * |
|
66 */ |
|
67 EXPORT_C CAknMfneSettingPage::CAknMfneSettingPage( |
|
68 const TDesC* aSettingText, |
|
69 TInt aSettingNumber, |
|
70 TInt aControlType, |
|
71 TInt aEditorResourceId, |
|
72 TInt aSettingPageResourceId ) |
|
73 : CAknSettingPage( |
|
74 aSettingText, |
|
75 aSettingNumber, |
|
76 aControlType, |
|
77 aEditorResourceId, |
|
78 aSettingPageResourceId) |
|
79 { |
|
80 AKNTASHOOK_ADD( this, "CAknMfneSettingPage" ); |
|
81 } |
|
82 |
|
83 EXPORT_C void CAknMfneSettingPage::SizeChanged() |
|
84 { |
|
85 StandardSettingPageLayout(); // Must be part of any re-implementation |
|
86 |
|
87 TRect rect( SettingItemContentRect( EFalse ) ); |
|
88 |
|
89 iMfneLayoutRect.LayoutRect( |
|
90 rect, |
|
91 AknLayoutScalable_Avkon::setting_code_pane_copy1() ); |
|
92 TRect editorRect( iMfneLayoutRect.Rect() ); |
|
93 |
|
94 TAknLayoutRect layoutRect; |
|
95 layoutRect.LayoutRect( |
|
96 editorRect, |
|
97 AknLayoutScalable_Avkon::indicator_popup_pane_cp6() ); |
|
98 TRect indicatorRect( layoutRect.Rect() ); |
|
99 |
|
100 layoutRect.LayoutRect( |
|
101 editorRect, |
|
102 AknLayoutScalable_Avkon::input_focus_pane_cp2_copy1() ); |
|
103 TRect editorFrameRect( layoutRect.Rect() ); |
|
104 |
|
105 AknLayoutUtils::LayoutMfne( |
|
106 Mfne(), |
|
107 editorRect, |
|
108 AknLayoutScalable_Avkon::setting_code_pane_t1_copy1() ); |
|
109 |
|
110 layoutRect.LayoutRect( |
|
111 editorFrameRect, |
|
112 AknLayoutScalable_Avkon::set_opt_bg_pane_g1_copy1() ); |
|
113 SetEditedItemFrameRects( editorFrameRect, layoutRect.Rect() ); |
|
114 |
|
115 SetEditorIndicatorRect( indicatorRect ); |
|
116 } |
|
117 |
|
118 EXPORT_C void CAknMfneSettingPage::Draw(const TRect& aRect) const |
|
119 { |
|
120 BaseDraw( aRect ); |
|
121 |
|
122 if ( !IsSkinsHandlingEditorFrameDrawing() ) |
|
123 { |
|
124 // Legacy frame drawing |
|
125 CWindowGc& gc=SystemGc(); |
|
126 iMfneLayoutRect.DrawRect( gc ); |
|
127 iHorizontalShadow.DrawRect( gc ); |
|
128 iVerticalShadow.DrawRect( gc ); |
|
129 iOutlineFrame.DrawOutLineRect( gc ); |
|
130 } |
|
131 } |
|
132 |
|
133 /** |
|
134 * |
|
135 * Type-specific access to the MFNE |
|
136 * |
|
137 */ |
|
138 EXPORT_C CEikMfne* CAknMfneSettingPage::Mfne() const |
|
139 { |
|
140 return STATIC_CAST( CEikMfne*, EditorControl()); |
|
141 } |
|
142 |
|
143 EXPORT_C void CAknMfneSettingPage::HandleControlEventL(CCoeControl* /*aControl*/, |
|
144 MCoeControlObserver::TCoeEvent aEventType) |
|
145 { |
|
146 // Ordering is important here. Need first to do the check on validity because |
|
147 // UpdateSettingL may leave if the data is invalid ! |
|
148 if ( aEventType == EEventStateChanged ) |
|
149 { |
|
150 // This updates the CBA depending on validity of data as reported by mfne |
|
151 CheckAndSetDataValidity(); |
|
152 UpdateCbaL(); |
|
153 |
|
154 if ( iUpdateMode == EUpdateWhenChanged ) |
|
155 UpdateSettingL(); |
|
156 |
|
157 } |
|
158 } |
|
159 |
|
160 EXPORT_C void CAknMfneSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
161 { |
|
162 if(!AknLayoutUtils::PenEnabled()) |
|
163 { |
|
164 CAknSettingPage::HandlePointerEventL(aPointerEvent); |
|
165 } |
|
166 else |
|
167 { |
|
168 CEikMfne* pMfne = Mfne(); |
|
169 if ( pMfne && iMfneLayoutRect.Rect().Contains( aPointerEvent.iPosition ) ) |
|
170 { |
|
171 pMfne->HandlePointerEventL(aPointerEvent); |
|
172 } |
|
173 else |
|
174 { |
|
175 CAknSettingPage::HandlePointerEventL(aPointerEvent); |
|
176 } |
|
177 } |
|
178 } |
|
179 |
|
180 EXPORT_C void* CAknMfneSettingPage::ExtensionInterface( TUid /*aInterface*/ ) |
|
181 { |
|
182 return NULL; |
|
183 } |
|
184 |
|
185 EXPORT_C void CAknMfneSettingPage::CheckAndSetDataValidity() |
|
186 { |
|
187 SetDataValidity( Mfne()->Field(Mfne()->CurrentField())->IsValid() ); |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CAknMfneSettingPage::ConstructL |
|
192 // This second phase constructor should be called by the derived classes |
|
193 // to create touch enabled edit buttons in touch enabled devices |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 EXPORT_C void CAknMfneSettingPage::ConstructL() |
|
197 { |
|
198 BaseConstructL(); |
|
199 #if defined( RD_SCALABLE_UI_V2) |
|
200 if ( AknLayoutUtils::PenEnabled() ) |
|
201 { |
|
202 Mfne()->SetFeature( CEikMfne::EFingerSupport, CEikMfne::EnableWithAllHighlight ); |
|
203 } |
|
204 SizeChanged(); |
|
205 #endif //if defined( RD_SCALABLE_UI_V2) |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CAknMfneSettingPage::ComponentControl |
|
210 // Calls parent class' implementation and then checks if touch buttons are |
|
211 // available to be accessed |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 EXPORT_C CCoeControl* CAknMfneSettingPage::ComponentControl(TInt aIndex) const |
|
215 { |
|
216 return CAknSettingPage::ComponentControl(aIndex); |
|
217 } |
|
218 |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // CAknMfneSettingPage::CountComponentControls |
|
222 // Calls parent class' implementation and then adds touch buttons to the count |
|
223 // if they have been initialzed |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 EXPORT_C TInt CAknMfneSettingPage::CountComponentControls() const |
|
227 { |
|
228 return CAknSettingPage::CountComponentControls(); |
|
229 } |
|
230 |
|
231 ////////////////////////////////////////////////////////////////////// |
|
232 // |
|
233 // DATE SETTING PAGE |
|
234 // |
|
235 ////////////////////////////////////////////////////////////////////// |
|
236 |
|
237 ////////////////////////////////////////////////////////////////////// |
|
238 // Construction/Destruction |
|
239 ////////////////////////////////////////////////////////////////////// |
|
240 |
|
241 /** |
|
242 * Destructor |
|
243 * |
|
244 */ |
|
245 EXPORT_C CAknDateSettingPage::~CAknDateSettingPage() |
|
246 { |
|
247 AKNTASHOOK_REMOVE(); |
|
248 } |
|
249 |
|
250 |
|
251 |
|
252 /** |
|
253 * Constructor using Setting page resource |
|
254 * |
|
255 * |
|
256 * @param aResourceId Setting page resource Id |
|
257 * @param aDateValue Reference to a Time value set to the initial date |
|
258 */ |
|
259 EXPORT_C CAknDateSettingPage::CAknDateSettingPage( TInt aResourceId, TTime& aDateValue ): |
|
260 CAknMfneSettingPage(aResourceId),iDateValue(aDateValue) |
|
261 { |
|
262 iBackupDateValue = iDateValue; |
|
263 AKNTASHOOK_ADD( this, "CAknDateSettingPage" ); |
|
264 } |
|
265 |
|
266 /** |
|
267 * Constructor that allows separate setting page and editor resources |
|
268 * |
|
269 */ |
|
270 EXPORT_C CAknDateSettingPage::CAknDateSettingPage( |
|
271 const TDesC* aSettingText, |
|
272 TInt aSettingNumber, |
|
273 TInt aControlType, |
|
274 TInt aEditorResourceId, |
|
275 TInt aSettingPageResourceId, |
|
276 TTime& aDateValue ) |
|
277 : CAknMfneSettingPage( |
|
278 aSettingText, |
|
279 aSettingNumber, |
|
280 aControlType, |
|
281 aEditorResourceId, |
|
282 aSettingPageResourceId), |
|
283 iDateValue(aDateValue) |
|
284 { |
|
285 iBackupDateValue = iDateValue; |
|
286 AKNTASHOOK_ADD( this, "CAknDateSettingPage" ); |
|
287 } |
|
288 |
|
289 /** |
|
290 * |
|
291 * 2nd stage construction. This uses stored values from the conststuctor to allocate the |
|
292 * required aggregate objects, and then set the Date value. |
|
293 * |
|
294 */ |
|
295 EXPORT_C void CAknDateSettingPage::ConstructL() |
|
296 { |
|
297 CAknMfneSettingPage::ConstructL(); |
|
298 |
|
299 DateEditor()->SetUpAndDownKeysConsumed(ETrue); |
|
300 DateEditor()->SetDate( iDateValue ); |
|
301 |
|
302 DateEditor()->SetSkinTextColorL(EAknsCIQsnTextColorsCG26); |
|
303 |
|
304 // Construct an appropriate control context for the contained editor areas. |
|
305 // Context produced is owned by CAknSettingPage. |
|
306 SetEditedItemFrameIID( KAknsIIDQsnFrInput, KAknsIIDQsnFrInputCenter ); |
|
307 } |
|
308 /** |
|
309 * This framework method is called when the editor changes its value and the mode of |
|
310 * execution of the setting page is a continuous update mode. |
|
311 * |
|
312 */ |
|
313 EXPORT_C void CAknDateSettingPage::UpdateSettingL() |
|
314 { |
|
315 // The following actually leaves if a field is empty or is out of range: |
|
316 iDateValue = DateEditor()->Date(); |
|
317 if( iSettingPageObserver ) |
|
318 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged); |
|
319 |
|
320 } |
|
321 /** |
|
322 * We reload the value once again, in case we were not in |
|
323 * continuous update mode. A special event is generated for the observer to say that the |
|
324 * value is accepted. |
|
325 * |
|
326 */ |
|
327 EXPORT_C void CAknDateSettingPage::AcceptSettingL() |
|
328 { |
|
329 DateEditor()->PrepareForFocusLossL(); |
|
330 iDateValue = DateEditor()->Date(); |
|
331 } |
|
332 /** |
|
333 * The backup value, stored at construction time, is re-loaded into the referenced Date. |
|
334 * An event is sent to the observer saying that the event was dismissed. |
|
335 */ |
|
336 EXPORT_C void CAknDateSettingPage::RestoreOriginalSettingL() |
|
337 { |
|
338 iDateValue = iBackupDateValue; |
|
339 } |
|
340 |
|
341 /** |
|
342 * |
|
343 * Type-specific access to the editor |
|
344 * |
|
345 */ |
|
346 EXPORT_C CEikDateEditor* CAknDateSettingPage::DateEditor() |
|
347 { |
|
348 return STATIC_CAST( CEikDateEditor*, EditorControl()); |
|
349 } |
|
350 |
|
351 /** |
|
352 * Writes the internal state of the control and its components to aStream. |
|
353 * Does nothing in release mode. |
|
354 * Designed to be overidden and base called by subclasses. |
|
355 */ |
|
356 #ifndef _DEBUG |
|
357 EXPORT_C void CAknDateSettingPage::WriteInternalStateL(RWriteStream& /*aWriteStream*/) const |
|
358 {} |
|
359 #else |
|
360 EXPORT_C void CAknDateSettingPage::WriteInternalStateL(RWriteStream& aWriteStream) const |
|
361 { |
|
362 CAknSettingPage::WriteInternalStateL(aWriteStream); |
|
363 } |
|
364 #endif |
|
365 |
|
366 EXPORT_C void CAknDateSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
367 { |
|
368 CAknMfneSettingPage::HandlePointerEventL(aPointerEvent); |
|
369 } |
|
370 |
|
371 EXPORT_C void* CAknDateSettingPage::ExtensionInterface( TUid /*aInterface*/ ) |
|
372 { |
|
373 return NULL; |
|
374 } |
|
375 |
|
376 /** |
|
377 * Reserved method derived from CCoeControl |
|
378 */ |
|
379 EXPORT_C void CAknDateSettingPage::Reserved_2() |
|
380 { |
|
381 } |
|
382 |
|
383 /** |
|
384 * Setting Page reserved methods |
|
385 */ |
|
386 EXPORT_C void CAknDateSettingPage::CAknSettingPage_Reserved_1() |
|
387 { |
|
388 } |
|
389 EXPORT_C void CAknDateSettingPage::CAknSettingPage_Reserved_2() |
|
390 { |
|
391 } |
|
392 ////////////////////////////////////////////////////////////////////// |
|
393 // |
|
394 // TIME SETTING PAGE |
|
395 // |
|
396 ////////////////////////////////////////////////////////////////////// |
|
397 |
|
398 |
|
399 ////////////////////////////////////////////////////////////////////// |
|
400 // Construction/Destruction |
|
401 ////////////////////////////////////////////////////////////////////// |
|
402 |
|
403 /** |
|
404 * Destructor |
|
405 * |
|
406 */ |
|
407 EXPORT_C CAknTimeSettingPage::~CAknTimeSettingPage() |
|
408 { |
|
409 AKNTASHOOK_REMOVE(); |
|
410 } |
|
411 |
|
412 /** |
|
413 * Constructor using Setting page resource |
|
414 * |
|
415 * |
|
416 * @param aResourceId Setting page resource Id |
|
417 * @param aTimeValue Reference to a Time value set to the initial date |
|
418 */ |
|
419 EXPORT_C CAknTimeSettingPage::CAknTimeSettingPage( TInt aResourceId, TTime& aTimeValue ): |
|
420 CAknMfneSettingPage(aResourceId),iTimeValue(aTimeValue) |
|
421 { |
|
422 iBackupTimeValue = iTimeValue; |
|
423 AKNTASHOOK_ADD( this, "CAknTimeSettingPage" ); |
|
424 } |
|
425 /** |
|
426 * Constructor that allows separate setting page and editor resources |
|
427 * |
|
428 */ |
|
429 EXPORT_C CAknTimeSettingPage::CAknTimeSettingPage( |
|
430 const TDesC* aSettingText, |
|
431 TInt aSettingNumber, |
|
432 TInt aControlType, |
|
433 TInt aEditorResourceId, |
|
434 TInt aSettingPageResourceId, |
|
435 TTime& aTimeValue ) |
|
436 : CAknMfneSettingPage( |
|
437 aSettingText, |
|
438 aSettingNumber, |
|
439 aControlType, |
|
440 aEditorResourceId, |
|
441 aSettingPageResourceId), |
|
442 iTimeValue(aTimeValue) |
|
443 { |
|
444 iBackupTimeValue = iTimeValue; |
|
445 AKNTASHOOK_ADD( this, "CAknTimeSettingPage" ); |
|
446 } |
|
447 /** |
|
448 * |
|
449 * 2nd stage construction. This uses stored values from the conststuctor to allocate the |
|
450 * required aggregate objects, and then set the Time value. |
|
451 * |
|
452 */ |
|
453 EXPORT_C void CAknTimeSettingPage::ConstructL() |
|
454 { |
|
455 CAknMfneSettingPage::ConstructL(); |
|
456 |
|
457 TimeEditor()->SetUpAndDownKeysConsumed(ETrue); |
|
458 TimeEditor()->SetTime( iTimeValue ); |
|
459 |
|
460 TimeEditor()->SetSkinTextColorL(EAknsCIQsnTextColorsCG26); |
|
461 |
|
462 // Construct an appropriate control context for the contained editor areas. |
|
463 // Context produced is owned by CAknSettingPage. |
|
464 SetEditedItemFrameIID( KAknsIIDQsnFrInput, KAknsIIDQsnFrInputCenter ); |
|
465 } |
|
466 /** |
|
467 * This framework method is called when the editor changes its value and the mode of |
|
468 * execution of the setting page is a continuous update mode. |
|
469 * |
|
470 */ |
|
471 EXPORT_C void CAknTimeSettingPage::UpdateSettingL() |
|
472 { |
|
473 iTimeValue = TimeEditor()->Time(); |
|
474 if( iSettingPageObserver ) |
|
475 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged); |
|
476 |
|
477 } |
|
478 /** |
|
479 * We reload the event once again, in case we were not in |
|
480 * continuous update mode. A special event is generated for the observer to say that the |
|
481 * value is accepted. |
|
482 * |
|
483 */ |
|
484 EXPORT_C void CAknTimeSettingPage::AcceptSettingL() |
|
485 { |
|
486 iTimeValue = TimeEditor()->Time(); |
|
487 } |
|
488 /** |
|
489 * The backup value, stored at construction time, is re-loaded into the referenced Time. |
|
490 * An event is sent to the observer saying that the event was dismissed. |
|
491 */ |
|
492 EXPORT_C void CAknTimeSettingPage::RestoreOriginalSettingL() |
|
493 { |
|
494 iTimeValue = iBackupTimeValue; |
|
495 } |
|
496 |
|
497 /** |
|
498 * |
|
499 * Type-specific access to the editor |
|
500 * |
|
501 */ |
|
502 EXPORT_C CEikTimeEditor* CAknTimeSettingPage::TimeEditor() |
|
503 { |
|
504 return STATIC_CAST( CEikTimeEditor*, EditorControl()); |
|
505 } |
|
506 |
|
507 /** |
|
508 * Writes the internal state of the control and its components to aStream. |
|
509 * Does nothing in release mode. |
|
510 * Designed to be overidden and base called by subclasses. |
|
511 */ |
|
512 #ifndef _DEBUG |
|
513 EXPORT_C void CAknTimeSettingPage::WriteInternalStateL(RWriteStream& /*aWriteStream*/) const |
|
514 {} |
|
515 #else |
|
516 EXPORT_C void CAknTimeSettingPage::WriteInternalStateL(RWriteStream& aWriteStream) const |
|
517 { |
|
518 CAknSettingPage::WriteInternalStateL(aWriteStream); |
|
519 } |
|
520 #endif |
|
521 |
|
522 EXPORT_C void CAknTimeSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
523 { |
|
524 CAknMfneSettingPage::HandlePointerEventL(aPointerEvent); |
|
525 } |
|
526 |
|
527 EXPORT_C void* CAknTimeSettingPage::ExtensionInterface( TUid /*aInterface*/ ) |
|
528 { |
|
529 return NULL; |
|
530 } |
|
531 |
|
532 /** |
|
533 * Reserved method derived from CCoeControl |
|
534 */ |
|
535 EXPORT_C void CAknTimeSettingPage::Reserved_2() |
|
536 { |
|
537 } |
|
538 |
|
539 /** |
|
540 * Setting Page reserved methods |
|
541 */ |
|
542 EXPORT_C void CAknTimeSettingPage::CAknSettingPage_Reserved_1() |
|
543 { |
|
544 } |
|
545 EXPORT_C void CAknTimeSettingPage::CAknSettingPage_Reserved_2() |
|
546 { |
|
547 } |
|
548 ////////////////////////////////////////////////////////////////////// |
|
549 // |
|
550 // DURATION SETTING PAGE |
|
551 // |
|
552 ////////////////////////////////////////////////////////////////////// |
|
553 |
|
554 |
|
555 ////////////////////////////////////////////////////////////////////// |
|
556 // Construction/Destruction |
|
557 ////////////////////////////////////////////////////////////////////// |
|
558 |
|
559 /** |
|
560 * Destructor |
|
561 * |
|
562 */ |
|
563 EXPORT_C CAknDurationSettingPage::~CAknDurationSettingPage() |
|
564 { |
|
565 AKNTASHOOK_REMOVE(); |
|
566 } |
|
567 |
|
568 /** |
|
569 * Constructor using Setting page resource |
|
570 * |
|
571 * |
|
572 * @param aResourceId Setting page resource Id |
|
573 * @param aDurationValue Reference to a Time value set to the initial date |
|
574 */ |
|
575 EXPORT_C CAknDurationSettingPage::CAknDurationSettingPage( TInt aResourceId, TTimeIntervalSeconds& aDurationValue ): |
|
576 CAknMfneSettingPage(aResourceId),iDurationValue(aDurationValue) |
|
577 { |
|
578 iBackupDurationValue = iDurationValue; |
|
579 AKNTASHOOK_ADD( this, "CAknDurationSettingPage" ); |
|
580 } |
|
581 /** |
|
582 * Constructor that allows separate setting page and editor resources |
|
583 * |
|
584 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible |
|
585 * |
|
586 * In all cases the number (if supplied i.e. <> 0 ) is used. |
|
587 * |
|
588 * Editor Resource Setting Page Resource |
|
589 * present present Both are used (but text & number overridden) |
|
590 * = 0 present Editor resource is used via SP resource (Effectively like the other constructor) |
|
591 * present = 0 Default Avkon SP resource if used + this editor resource |
|
592 * = 0 = 0 uses default resource for both SP and editor. This is OK if: |
|
593 * i) control type is present, |
|
594 * ii) a default resource exists ( OK for text, integer, date, time, duration ) |
|
595 * |
|
596 * |
|
597 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other |
|
598 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource |
|
599 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the |
|
600 * specific API for setting them, WILL override resource. |
|
601 * It is assumed that number from resource is very rare. Special text is somewhat more likely. |
|
602 * |
|
603 * @param aSettingTitleText Text at top of setting pane |
|
604 * @param aSettingNumber Number at top left (if present) |
|
605 * @param aControlType Determines the type constructed and how its resource is read |
|
606 * @param aEditorResourceId Editor resource to use in the setting page (if present) |
|
607 * @param aSettingPageResourceId Setting Page to use (if present) |
|
608 * @param aDurationValue reference to a duration |
|
609 */ |
|
610 |
|
611 EXPORT_C CAknDurationSettingPage::CAknDurationSettingPage( |
|
612 const TDesC* aSettingText, |
|
613 TInt aSettingNumber, |
|
614 TInt aControlType, |
|
615 TInt aEditorResourceId, |
|
616 TInt aSettingPageResourceId, |
|
617 TTimeIntervalSeconds& aDurationValue ) |
|
618 : CAknMfneSettingPage( |
|
619 aSettingText, |
|
620 aSettingNumber, |
|
621 aControlType, |
|
622 aEditorResourceId, |
|
623 aSettingPageResourceId), |
|
624 iDurationValue(aDurationValue) |
|
625 { |
|
626 iBackupDurationValue = iDurationValue; |
|
627 AKNTASHOOK_ADD( this, "CAknDurationSettingPage" ); |
|
628 } |
|
629 /** |
|
630 * |
|
631 * 2nd stage construction. This uses stored values from the conststuctor to allocate the |
|
632 * required aggregate objects, and then set the Duration value. |
|
633 * |
|
634 */ |
|
635 EXPORT_C void CAknDurationSettingPage::ConstructL() |
|
636 { |
|
637 CAknMfneSettingPage::ConstructL(); |
|
638 |
|
639 DurationEditor()->SetUpAndDownKeysConsumed(ETrue); |
|
640 DurationEditor()->SetDuration( iDurationValue ); |
|
641 |
|
642 DurationEditor()->SetSkinTextColorL(EAknsCIQsnTextColorsCG26); |
|
643 |
|
644 // Construct an appropriate control context for the contained editor areas. |
|
645 // Context produced is owned by CAknSettingPage. |
|
646 SetEditedItemFrameIID( KAknsIIDQsnFrInput, KAknsIIDQsnFrInputCenter ); |
|
647 } |
|
648 /** |
|
649 * This framework method is called when the editor changes its value and the mode of |
|
650 * execution of the setting page is a continuous update mode. |
|
651 * |
|
652 */ |
|
653 EXPORT_C void CAknDurationSettingPage::UpdateSettingL() |
|
654 { |
|
655 iDurationValue = DurationEditor()->Duration(); |
|
656 if( iSettingPageObserver ) |
|
657 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged); |
|
658 |
|
659 } |
|
660 /** |
|
661 * We reload the event once again, in case we were not in |
|
662 * continuous update mode. A special event is generated for the observer to say that the |
|
663 * value is accepted. |
|
664 * |
|
665 */ |
|
666 EXPORT_C void CAknDurationSettingPage::AcceptSettingL() |
|
667 { |
|
668 DurationEditor()->PrepareForFocusLossL(); |
|
669 iDurationValue = DurationEditor()->Duration(); |
|
670 } |
|
671 /** |
|
672 * The backup value, stored at construction time, is re-loaded into the referenced Duration. |
|
673 * An event is sent to the observer saying that the event was dismissed. |
|
674 */ |
|
675 EXPORT_C void CAknDurationSettingPage::RestoreOriginalSettingL() |
|
676 { |
|
677 iDurationValue = iBackupDurationValue; |
|
678 } |
|
679 |
|
680 /** |
|
681 * |
|
682 * Type-specific access to the editor |
|
683 * |
|
684 */ |
|
685 EXPORT_C CEikDurationEditor* CAknDurationSettingPage::DurationEditor() |
|
686 { |
|
687 return STATIC_CAST( CEikDurationEditor*, EditorControl()); |
|
688 } |
|
689 |
|
690 /** |
|
691 * Writes the internal state of the control and its components to aStream. |
|
692 * Does nothing in release mode. |
|
693 * Designed to be overidden and base called by subclasses. |
|
694 */ |
|
695 #ifndef _DEBUG |
|
696 EXPORT_C void CAknDurationSettingPage::WriteInternalStateL(RWriteStream& /*aWriteStream*/) const |
|
697 {} |
|
698 #else |
|
699 EXPORT_C void CAknDurationSettingPage::WriteInternalStateL(RWriteStream& aWriteStream) const |
|
700 { |
|
701 CAknSettingPage::WriteInternalStateL(aWriteStream); |
|
702 } |
|
703 #endif |
|
704 |
|
705 EXPORT_C void CAknDurationSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
706 { |
|
707 CAknMfneSettingPage::HandlePointerEventL(aPointerEvent); |
|
708 } |
|
709 |
|
710 EXPORT_C void* CAknDurationSettingPage::ExtensionInterface( TUid /*aInterface*/ ) |
|
711 { |
|
712 return NULL; |
|
713 } |
|
714 |
|
715 /** |
|
716 * Reserved method derived from CCoeControl |
|
717 */ |
|
718 EXPORT_C void CAknDurationSettingPage::Reserved_2() |
|
719 { |
|
720 } |
|
721 |
|
722 /** |
|
723 * Setting Page reserved methods |
|
724 */ |
|
725 EXPORT_C void CAknDurationSettingPage::CAknSettingPage_Reserved_1() |
|
726 { |
|
727 } |
|
728 EXPORT_C void CAknDurationSettingPage::CAknSettingPage_Reserved_2() |
|
729 { |
|
730 } |
|
731 ////////////////////////////////////////////////////////////////////// |
|
732 // |
|
733 // TIME OFFSET SETTING PAGE |
|
734 // |
|
735 ////////////////////////////////////////////////////////////////////// |
|
736 |
|
737 |
|
738 ////////////////////////////////////////////////////////////////////// |
|
739 // Construction/Destruction |
|
740 ////////////////////////////////////////////////////////////////////// |
|
741 |
|
742 /** |
|
743 * Destructor |
|
744 * |
|
745 */ |
|
746 EXPORT_C CAknTimeOffsetSettingPage::~CAknTimeOffsetSettingPage() |
|
747 { |
|
748 AKNTASHOOK_REMOVE(); |
|
749 } |
|
750 |
|
751 /** |
|
752 * Constructor using Setting page resource |
|
753 * |
|
754 * |
|
755 * @param aResourceId Setting page resource Id |
|
756 * @param aDurationValue Reference to a Time value set to the initial date |
|
757 */ |
|
758 EXPORT_C CAknTimeOffsetSettingPage::CAknTimeOffsetSettingPage( TInt aResourceId, TTimeIntervalSeconds& aTimeOffsetValue ): |
|
759 CAknMfneSettingPage(aResourceId),iTimeOffsetValue(aTimeOffsetValue) |
|
760 { |
|
761 iBackupTimeOffsetValue = iTimeOffsetValue; |
|
762 AKNTASHOOK_ADD( this, "CAknTimeOffsetSettingPage" ); |
|
763 } |
|
764 /** |
|
765 * Constructor that allows separate setting page and editor resources |
|
766 * |
|
767 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible |
|
768 * |
|
769 * In all cases the number (if supplied i.e. <> 0 ) is used. |
|
770 * |
|
771 * Editor Resource Setting Page Resource |
|
772 * present present Both are used (but text & number overridden) |
|
773 * = 0 present Editor resource is used via SP resource (Effectively like the other constructor) |
|
774 * present = 0 Default Avkon SP resource if used + this editor resource |
|
775 * = 0 = 0 uses default resource for both SP and editor. This is OK if: |
|
776 * i) control type is present, |
|
777 * ii) a default resource exists ( OK for text, integer, date, time, duration ) |
|
778 * |
|
779 * |
|
780 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other |
|
781 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource |
|
782 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the |
|
783 * specific API for setting them, WILL override resource. |
|
784 * It is assumed that number from resource is very rare. Special text is somewhat more likely. |
|
785 * |
|
786 * @param aSettingTitleText Text at top of setting pane |
|
787 * @param aSettingNumber Number at top left (if present) |
|
788 * @param aControlType Determines the type constructed and how its resource is read |
|
789 * @param aEditorResourceId Editor resource to use in the setting page (if present) |
|
790 * @param aSettingPageResourceId Setting Page to use (if present) |
|
791 * @param aDurationValue reference to a duration |
|
792 */ |
|
793 |
|
794 EXPORT_C CAknTimeOffsetSettingPage::CAknTimeOffsetSettingPage( |
|
795 const TDesC* aSettingText, |
|
796 TInt aSettingNumber, |
|
797 TInt aControlType, |
|
798 TInt aEditorResourceId, |
|
799 TInt aSettingPageResourceId, |
|
800 TTimeIntervalSeconds& aTimeOffsetValue ) |
|
801 : CAknMfneSettingPage( |
|
802 aSettingText, |
|
803 aSettingNumber, |
|
804 aControlType, |
|
805 aEditorResourceId, |
|
806 aSettingPageResourceId), |
|
807 iTimeOffsetValue(aTimeOffsetValue) |
|
808 { |
|
809 iBackupTimeOffsetValue = iTimeOffsetValue; |
|
810 AKNTASHOOK_ADD( this, "CAknTimeOffsetSettingPage" ); |
|
811 } |
|
812 /** |
|
813 * |
|
814 * 2nd stage construction. This uses stored values from the conststuctor to allocate the |
|
815 * required aggregate objects, and then set the TimeOffset value. |
|
816 * |
|
817 */ |
|
818 EXPORT_C void CAknTimeOffsetSettingPage::ConstructL() |
|
819 { |
|
820 CAknMfneSettingPage::ConstructL(); |
|
821 |
|
822 TimeOffsetEditor()->SetUpAndDownKeysConsumed(ETrue); |
|
823 TimeOffsetEditor()->SetTimeOffset( iTimeOffsetValue ); |
|
824 |
|
825 TimeOffsetEditor()->SetSkinTextColorL(EAknsCIQsnTextColorsCG26); |
|
826 |
|
827 // Construct an appropriate control context for the contained editor areas. |
|
828 // Context produced is owned by CAknSettingPage. |
|
829 SetEditedItemFrameIID( KAknsIIDQsnFrInput, KAknsIIDQsnFrInputCenter ); |
|
830 } |
|
831 /** |
|
832 * This framework method is called when the editor changes its value and the mode of |
|
833 * execution of the setting page is a continuous update mode. |
|
834 * |
|
835 */ |
|
836 EXPORT_C void CAknTimeOffsetSettingPage::UpdateSettingL() |
|
837 { |
|
838 iTimeOffsetValue = TimeOffsetEditor()->TimeOffset(); |
|
839 if( iSettingPageObserver ) |
|
840 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged); |
|
841 |
|
842 } |
|
843 /** |
|
844 * We reload the event once again, in case we were not in |
|
845 * continuous update mode. A special event is generated for the observer to say that the |
|
846 * value is accepted. |
|
847 * |
|
848 */ |
|
849 EXPORT_C void CAknTimeOffsetSettingPage::AcceptSettingL() |
|
850 { |
|
851 TimeOffsetEditor()->PrepareForFocusLossL(); |
|
852 iTimeOffsetValue = TimeOffsetEditor()->TimeOffset(); |
|
853 if( iSettingPageObserver ) |
|
854 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingOked); |
|
855 } |
|
856 /** |
|
857 * The backup value, stored at construction time, is re-loaded into the referenced TimeOffset. |
|
858 * An event is sent to the observer saying that the event was dismissed. |
|
859 */ |
|
860 EXPORT_C void CAknTimeOffsetSettingPage::RestoreOriginalSettingL() |
|
861 { |
|
862 iTimeOffsetValue = iBackupTimeOffsetValue; |
|
863 if( iSettingPageObserver ) |
|
864 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingCancelled); |
|
865 } |
|
866 |
|
867 /** |
|
868 * |
|
869 * Type-specific access to the editor |
|
870 * |
|
871 */ |
|
872 EXPORT_C CEikTimeOffsetEditor* CAknTimeOffsetSettingPage::TimeOffsetEditor() |
|
873 { |
|
874 return STATIC_CAST( CEikTimeOffsetEditor*, EditorControl()); |
|
875 } |
|
876 |
|
877 /** |
|
878 * Writes the internal state of the control and its components to aStream. |
|
879 * Does nothing in release mode. |
|
880 * Designed to be overidden and base called by subclasses. |
|
881 */ |
|
882 #ifndef _DEBUG |
|
883 EXPORT_C void CAknTimeOffsetSettingPage::WriteInternalStateL(RWriteStream& /*aWriteStream*/) const |
|
884 {} |
|
885 #else |
|
886 EXPORT_C void CAknTimeOffsetSettingPage::WriteInternalStateL(RWriteStream& aWriteStream) const |
|
887 { |
|
888 CAknSettingPage::WriteInternalStateL(aWriteStream); |
|
889 } |
|
890 #endif |
|
891 |
|
892 EXPORT_C void CAknTimeOffsetSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
893 { |
|
894 CAknMfneSettingPage::HandlePointerEventL(aPointerEvent); |
|
895 } |
|
896 |
|
897 EXPORT_C void* CAknTimeOffsetSettingPage::ExtensionInterface( TUid /*aInterface*/ ) |
|
898 { |
|
899 return NULL; |
|
900 } |
|
901 |
|
902 /** |
|
903 * Reserved method derived from CCoeControl |
|
904 */ |
|
905 EXPORT_C void CAknTimeOffsetSettingPage::Reserved_2() |
|
906 { |
|
907 } |
|
908 |
|
909 /** |
|
910 * Setting Page reserved methods |
|
911 */ |
|
912 EXPORT_C void CAknTimeOffsetSettingPage::CAknSettingPage_Reserved_1() |
|
913 { |
|
914 } |
|
915 EXPORT_C void CAknTimeOffsetSettingPage::CAknSettingPage_Reserved_2() |
|
916 { |
|
917 } |
|
918 ////////////////////////////////////////////////////////////////////// |
|
919 // |
|
920 // IP ADDRESS FIELD SETTING PAGE |
|
921 // |
|
922 ////////////////////////////////////////////////////////////////////// |
|
923 |
|
924 |
|
925 ////////////////////////////////////////////////////////////////////// |
|
926 // Construction/Destruction |
|
927 ////////////////////////////////////////////////////////////////////// |
|
928 |
|
929 /** |
|
930 * Destructor |
|
931 * |
|
932 */ |
|
933 EXPORT_C CAknIpFieldSettingPage::~CAknIpFieldSettingPage() |
|
934 { |
|
935 AKNTASHOOK_REMOVE(); |
|
936 } |
|
937 |
|
938 /** |
|
939 * Constructor using Setting page resource |
|
940 * |
|
941 * |
|
942 * @param aResourceId Setting page resource Id |
|
943 * @param aIpFieldValue Reference to a Time value set to the initial date |
|
944 */ |
|
945 EXPORT_C CAknIpFieldSettingPage::CAknIpFieldSettingPage( TInt aResourceId, TInetAddr& aIpAddress ): |
|
946 CAknMfneSettingPage(aResourceId),iIpAddress(aIpAddress) |
|
947 { |
|
948 iBackupIpAddress = iIpAddress; |
|
949 AKNTASHOOK_ADD( this, "CAknIpFieldSettingPage" ); |
|
950 } |
|
951 /** |
|
952 * Constructor that allows separate setting page and editor resources |
|
953 * |
|
954 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible |
|
955 * |
|
956 * In all cases the number (if supplied i.e. <> 0 ) is used. |
|
957 * |
|
958 * Editor Resource Setting Page Resource |
|
959 * present present Both are used (but text & number overridden) |
|
960 * = 0 present Editor resource is used via SP resource (Effectively like the other constructor) |
|
961 * present = 0 Default Avkon SP resource if used + this editor resource |
|
962 * = 0 = 0 uses default resource for both SP and editor. This is OK if: |
|
963 * i) control type is present, |
|
964 * ii) a default resource exists ( OK for text, integer, date, time, IpField ) |
|
965 * |
|
966 * |
|
967 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other |
|
968 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource |
|
969 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the |
|
970 * specific API for setting them, WILL override resource. |
|
971 * It is assumed that number from resource is very rare. Special text is somewhat more likely. |
|
972 * |
|
973 * @param aSettingTitleText Text at top of setting pane |
|
974 * @param aSettingNumber Number at top left (if present) |
|
975 * @param aControlType Determines the type constructed and how its resource is read |
|
976 * @param aEditorResourceId Editor resource to use in the setting page (if present) |
|
977 * @param aSettingPageResourceId Setting Page to use (if present) |
|
978 * @param aIpAddress reference to a IP address |
|
979 */ |
|
980 |
|
981 EXPORT_C CAknIpFieldSettingPage::CAknIpFieldSettingPage( |
|
982 const TDesC* aSettingText, |
|
983 TInt aSettingNumber, |
|
984 TInt aControlType, |
|
985 TInt aEditorResourceId, |
|
986 TInt aSettingPageResourceId, |
|
987 TInetAddr& aIpAddress ) |
|
988 : CAknMfneSettingPage( |
|
989 aSettingText, |
|
990 aSettingNumber, |
|
991 aControlType, |
|
992 aEditorResourceId, |
|
993 aSettingPageResourceId), |
|
994 iIpAddress(aIpAddress) |
|
995 { |
|
996 iBackupIpAddress = iIpAddress; |
|
997 AKNTASHOOK_ADD( this, "CAknIpFieldSettingPage" ); |
|
998 } |
|
999 /** |
|
1000 * |
|
1001 * 2nd stage construction. This uses stored values from the conststuctor to allocate the |
|
1002 * required aggregate objects, and then set the IpField value. |
|
1003 * |
|
1004 */ |
|
1005 EXPORT_C void CAknIpFieldSettingPage::ConstructL() |
|
1006 { |
|
1007 CAknMfneSettingPage::ConstructL(); |
|
1008 IpFieldEditor()->SetUpAndDownKeysConsumed(ETrue); |
|
1009 IpFieldEditor()->SetAddress( iIpAddress ); |
|
1010 |
|
1011 IpFieldEditor()->SetSkinTextColorL(EAknsCIQsnTextColorsCG26); |
|
1012 |
|
1013 // Construct an appropriate control context for the contained editor areas. |
|
1014 // Context produced is owned by CAknSettingPage. |
|
1015 SetEditedItemFrameIID( KAknsIIDQsnFrInput, KAknsIIDQsnFrInputCenter ); |
|
1016 } |
|
1017 /** |
|
1018 * This framework method is called when the editor changes its value and the mode of |
|
1019 * execution of the setting page is a continuous update mode. |
|
1020 * |
|
1021 */ |
|
1022 EXPORT_C void CAknIpFieldSettingPage::UpdateSettingL() |
|
1023 { |
|
1024 iIpAddress = IpFieldEditor()->Address(); |
|
1025 if( iSettingPageObserver ) |
|
1026 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged); |
|
1027 |
|
1028 } |
|
1029 /** |
|
1030 * We reload the event once again, in case we were not in |
|
1031 * continuous update mode. A special event is generated for the observer to say that the |
|
1032 * value is accepted. |
|
1033 * |
|
1034 */ |
|
1035 EXPORT_C void CAknIpFieldSettingPage::AcceptSettingL() |
|
1036 { |
|
1037 IpFieldEditor()->PrepareForFocusLossL(); |
|
1038 iIpAddress = IpFieldEditor()->Address(); |
|
1039 } |
|
1040 /** |
|
1041 * The backup value, stored at construction time, is re-loaded into the referenced IpField. |
|
1042 * An event is sent to the observer saying that the event was dismissed. |
|
1043 */ |
|
1044 EXPORT_C void CAknIpFieldSettingPage::RestoreOriginalSettingL() |
|
1045 { |
|
1046 iIpAddress = iBackupIpAddress; |
|
1047 } |
|
1048 |
|
1049 /** |
|
1050 * |
|
1051 * Type-specific access to the editor |
|
1052 * |
|
1053 */ |
|
1054 EXPORT_C CAknIpFieldEditor* CAknIpFieldSettingPage::IpFieldEditor() |
|
1055 { |
|
1056 return STATIC_CAST( CAknIpFieldEditor*, EditorControl()); |
|
1057 } |
|
1058 |
|
1059 /** |
|
1060 * Writes the internal state of the control and its components to aStream. |
|
1061 * Does nothing in release mode. |
|
1062 * Designed to be overidden and base called by subclasses. |
|
1063 */ |
|
1064 #ifndef _DEBUG |
|
1065 EXPORT_C void CAknIpFieldSettingPage::WriteInternalStateL(RWriteStream& /*aWriteStream*/) const |
|
1066 {} |
|
1067 #else |
|
1068 EXPORT_C void CAknIpFieldSettingPage::WriteInternalStateL(RWriteStream& aWriteStream) const |
|
1069 { |
|
1070 CAknSettingPage::WriteInternalStateL(aWriteStream); |
|
1071 } |
|
1072 #endif |
|
1073 |
|
1074 EXPORT_C void CAknIpFieldSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
1075 { |
|
1076 CAknMfneSettingPage::HandlePointerEventL(aPointerEvent); |
|
1077 } |
|
1078 |
|
1079 EXPORT_C void* CAknIpFieldSettingPage::ExtensionInterface( TUid /*aInterface*/ ) |
|
1080 { |
|
1081 return NULL; |
|
1082 } |
|
1083 |
|
1084 /** |
|
1085 * Reserved method derived from CCoeControl |
|
1086 */ |
|
1087 EXPORT_C void CAknIpFieldSettingPage::Reserved_2() |
|
1088 { |
|
1089 } |
|
1090 |
|
1091 /** |
|
1092 * Setting Page reserved methods |
|
1093 */ |
|
1094 EXPORT_C void CAknIpFieldSettingPage::CAknSettingPage_Reserved_1() |
|
1095 { |
|
1096 } |
|
1097 EXPORT_C void CAknIpFieldSettingPage::CAknSettingPage_Reserved_2() |
|
1098 { |
|
1099 } |
|
1100 // End of File |