|
1 /* |
|
2 * Copyright (c) 2007 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: Take care of touch event handling and component states. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <alf/alfenv.h> |
|
19 |
|
20 #include "emailtrace.h" |
|
21 #include "ceuiemaillisttouchmanager.h" |
|
22 #include "FreestyleEmailUiMailListVisualiser.h" |
|
23 |
|
24 // ======== MEMBER FUNCTIONS ======== |
|
25 |
|
26 // --------------------------------------------------------------------------- |
|
27 // Two-phased constructor. |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 CEUiEmailListTouchManager* CEUiEmailListTouchManager::NewL( |
|
31 CFSEmailUiMailListVisualiser& aVisualiser) |
|
32 { |
|
33 FUNC_LOG; |
|
34 CEUiEmailListTouchManager* self = new (ELeave) CEUiEmailListTouchManager( |
|
35 aVisualiser); |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(self); |
|
39 return self; |
|
40 |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // Destructor. |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CEUiEmailListTouchManager::~CEUiEmailListTouchManager() |
|
48 { |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CEUiEmailListTouchManager::SetDisabled |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CEUiEmailListTouchManager::SetDisabled(TBool aState) |
|
56 { |
|
57 iDisableActions = aState; |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // From class MFsControlBarObserver. |
|
62 // CEUiEmailListTouchManager::HandleControlBarEvent |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 void CEUiEmailListTouchManager::HandleControlBarEvent( |
|
66 TFsControlBarEvent aEvent, TInt aData) |
|
67 { |
|
68 FUNC_LOG; |
|
69 |
|
70 //If folderlist is opened. Ignore all events. |
|
71 if (iDisableActions) |
|
72 return; |
|
73 |
|
74 switch (aEvent) |
|
75 { |
|
76 |
|
77 case MFsControlBarObserver::EEventTouchFocused: |
|
78 //change focus |
|
79 TRAP_IGNORE(iVisualiser.SetControlBarFocusedL()) |
|
80 ; |
|
81 break; |
|
82 case MFsControlBarObserver::EEventButtonTouched: |
|
83 //action |
|
84 TRAP_IGNORE(DoHandleActionL( aData )) |
|
85 ; |
|
86 break; |
|
87 |
|
88 default: |
|
89 //Just ignore rest of events |
|
90 break; |
|
91 } |
|
92 |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // From class MFsTreeListObserver. |
|
97 // CEUiEmailListTouchManager::TreeListEventL |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CEUiEmailListTouchManager::TreeListEventL(const TFsTreeListEvent aEvent, |
|
101 const TFsTreeItemId /*aId*/) |
|
102 { |
|
103 FUNC_LOG; |
|
104 |
|
105 //If folderlist is opened. Ignore all events. |
|
106 if (iDisableActions) |
|
107 return; |
|
108 |
|
109 switch (aEvent) |
|
110 { |
|
111 case MFsTreeListObserver::EFsTreeListItemTouchAction: |
|
112 DoHandleActionL(); |
|
113 break; |
|
114 case MFsTreeListObserver::EFsTreeListItemTouchLongTap: |
|
115 DoHandleLongTapL(); |
|
116 break; |
|
117 case MFsTreeListObserver::EFsTreeListItemTouchFocused: |
|
118 DoHandleTreelistFocusChangeL(); |
|
119 break; |
|
120 case MFsTreeListObserver::EFsTreeListItemWillGetFocused: |
|
121 { |
|
122 iVisualiser.SetMskL(); |
|
123 } |
|
124 break; |
|
125 |
|
126 default: |
|
127 //Just ignore rest of events |
|
128 break; |
|
129 } |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // C++ constructor. |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 CEUiEmailListTouchManager::CEUiEmailListTouchManager( |
|
137 CFSEmailUiMailListVisualiser& aVisualiser) : |
|
138 iVisualiser(aVisualiser), iDisableActions(EFalse) |
|
139 { |
|
140 FUNC_LOG; |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // Two-phased constructor. |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 void CEUiEmailListTouchManager::ConstructL() |
|
148 { |
|
149 FUNC_LOG; |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // CEUiEmailListTouchManager::DoHandleLongTapL |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 void CEUiEmailListTouchManager::DoHandleLongTapL() |
|
157 { |
|
158 FUNC_LOG; |
|
159 |
|
160 //Supported only for list component |
|
161 switch (iVisualiser.GetFocusedControl()) |
|
162 { |
|
163 case EMailListComponent: |
|
164 iVisualiser.DoHandleListItemLongTapL(); |
|
165 break; |
|
166 default: |
|
167 //Ignore rest |
|
168 break; |
|
169 } |
|
170 |
|
171 } |
|
172 // --------------------------------------------------------------------------- |
|
173 // CEUiEmailListTouchManager::DoHandleActionL |
|
174 // --------------------------------------------------------------------------- |
|
175 // |
|
176 void CEUiEmailListTouchManager::DoHandleActionL(TInt aData) |
|
177 { |
|
178 FUNC_LOG; |
|
179 |
|
180 switch (iVisualiser.GetFocusedControl()) |
|
181 { |
|
182 case EMailListComponent: |
|
183 iVisualiser.DoHandleListItemOpenL(); |
|
184 break; |
|
185 case EControlBarComponent: |
|
186 iVisualiser.DoHandleControlBarOpenL(aData); |
|
187 break; |
|
188 default: |
|
189 //Ignore rest |
|
190 break; |
|
191 } |
|
192 } |
|
193 // --------------------------------------------------------------------------- |
|
194 // CEUiEmailListTouchManager::DoHandleTreelistFocusChangeL |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 void CEUiEmailListTouchManager::DoHandleTreelistFocusChangeL() |
|
198 { |
|
199 FUNC_LOG; |
|
200 |
|
201 if (iVisualiser.GetFocusedControl() != EMailListComponent) |
|
202 iVisualiser.SetTreeListFocusedL(); |
|
203 } |
|
204 |