|
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: MsgEditorKeyCatcher implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // ========== INCLUDE FILES ================================ |
|
21 |
|
22 #include <eikenv.h> |
|
23 #include <eikappui.h> |
|
24 |
|
25 #include "MsgEditorKeyCatcher.h" |
|
26 #include "MsgAddressControlEditor.h" |
|
27 |
|
28 // ========== EXTERNAL DATA STRUCTURES ===================== |
|
29 |
|
30 // ========== EXTERNAL FUNCTION PROTOTYPES ================= |
|
31 |
|
32 // ========== CONSTANTS ==================================== |
|
33 |
|
34 // ========== MACROS ======================================= |
|
35 |
|
36 // ========== LOCAL CONSTANTS AND MACROS =================== |
|
37 |
|
38 // ========== MODULE DATA STRUCTURES ======================= |
|
39 |
|
40 // ========== LOCAL FUNCTION PROTOTYPES ==================== |
|
41 |
|
42 // ========== LOCAL FUNCTIONS ============================== |
|
43 |
|
44 // ========== MEMBER FUNCTIONS ============================= |
|
45 |
|
46 // --------------------------------------------------------- |
|
47 // CMsgEditorKeyCatcher::ConstructL |
|
48 // |
|
49 // 2nd phase constructor. |
|
50 // --------------------------------------------------------- |
|
51 // |
|
52 void CMsgEditorKeyCatcher::ConstructL( CMsgAddressControlEditor* aEditor ) |
|
53 { |
|
54 CreateWindowL(); |
|
55 SetNonFocusing(); |
|
56 |
|
57 #ifdef RD_SCALABLE_UI_V2 |
|
58 SetPointerCapture( EFalse ); |
|
59 #endif // RD_SCALABLE_UI_V2 |
|
60 |
|
61 RWindow& window=Window(); |
|
62 window.SetOrdinalPosition( 0, ECoeWinPriorityFep ); |
|
63 TPoint fepControlPos( 0, 0 ); |
|
64 SetExtent( fepControlPos, TSize( 0, 0 ) ); |
|
65 window.SetNonFading( ETrue ); |
|
66 iEikonEnv->EikAppUi()->AddToStackL( |
|
67 this, |
|
68 ECoeStackPriorityFep + 10, |
|
69 ECoeStackFlagRefusesFocus | ECoeStackFlagSharable ); |
|
70 iEditor = aEditor; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------- |
|
74 // CMsgEditorKeyCatcher::CMsgEditorKeyCatcher |
|
75 // |
|
76 // Constructor. |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 CMsgEditorKeyCatcher::CMsgEditorKeyCatcher() |
|
80 { |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CMsgEditorKeyCatcher::~CMsgEditorKeyCatcher |
|
85 // |
|
86 // Destructor. |
|
87 // --------------------------------------------------------- |
|
88 // |
|
89 CMsgEditorKeyCatcher::~CMsgEditorKeyCatcher() |
|
90 { |
|
91 iEikonEnv->EikAppUi()->RemoveFromStack( this ); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // CMsgEditorKeyCatcher::OfferKeyEventL |
|
96 // |
|
97 // Handles key event. |
|
98 // --------------------------------------------------------- |
|
99 // |
|
100 TKeyResponse CMsgEditorKeyCatcher::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
101 { |
|
102 if ( aType == EEventKey ) |
|
103 { |
|
104 // All printable characters except # which means user is changing case. |
|
105 // SCT of address control contains less characters, however. |
|
106 // There is a drawback here: pressing cancel in SCT still may add delimiters. |
|
107 if ( aKeyEvent.iCode >= 32 && |
|
108 aKeyEvent.iCode <= 255 && |
|
109 aKeyEvent.iCode != '#' ) |
|
110 { |
|
111 iEditor->PreInsertEditorFormattingL( aKeyEvent ); |
|
112 return EKeyWasNotConsumed; |
|
113 } |
|
114 } |
|
115 |
|
116 return EKeyWasNotConsumed; |
|
117 } |
|
118 |
|
119 // End of File |