|
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: Setting page for user ID |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "cwvsettingsuseridsettingpage.h" |
|
20 |
|
21 // ======== MEMBER FUNCTIONS ======== |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Constructor |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 CWVSettingsUserIDSettingPage::CWVSettingsUserIDSettingPage( |
|
28 TInt aResourceID, TDes& aText, TInt aTextSettingPageFlags ) : |
|
29 CAknTextSettingPage( aResourceID, aText, aTextSettingPageFlags ) |
|
30 { |
|
31 } |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // Destructor |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CWVSettingsUserIDSettingPage::~CWVSettingsUserIDSettingPage() |
|
38 { |
|
39 // Implementation not needed |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // From class CAknTextSettingPage. |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 void CWVSettingsUserIDSettingPage::SetSettingPageObserver( |
|
47 MAknSettingPageObserver* aObserver ) |
|
48 { |
|
49 iObserver = aObserver; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // From class CAknTextSettingPage. |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 TKeyResponse CWVSettingsUserIDSettingPage::OfferKeyEventL( |
|
57 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
58 { |
|
59 // Get char count before key event |
|
60 TInt oldCharCount = 0; |
|
61 CCoeControl* ctrl = EditorControl(); |
|
62 CEikEdwin* edwin = NULL; |
|
63 if ( ctrl ) |
|
64 { |
|
65 edwin = static_cast<CEikEdwin*>( ctrl ); |
|
66 oldCharCount = edwin->TextLength(); |
|
67 } |
|
68 |
|
69 // Offer key event to base class |
|
70 TKeyResponse response = CAknTextSettingPage::OfferKeyEventL( aKeyEvent, aType ); |
|
71 |
|
72 // Report changes only when user has cleared editor |
|
73 if ( edwin ) |
|
74 { |
|
75 if ( response == EKeyWasConsumed |
|
76 && edwin->TextLength() == 0 |
|
77 && oldCharCount > 0 |
|
78 && iObserver ) |
|
79 { |
|
80 iObserver->HandleSettingPageEventL( this, |
|
81 MAknSettingPageObserver::EEventSettingChanged ); |
|
82 } |
|
83 } |
|
84 |
|
85 return response; |
|
86 } |