|
1 /* |
|
2 * Copyright (c) 2006-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32base.h> |
|
21 |
|
22 #include <vuivoicerecognition.rsg> |
|
23 #include <vuivoicerecogdefs.h> |
|
24 |
|
25 #include "vuivoicerecognition.hrh" |
|
26 |
|
27 #include "vuiclistquerydialog.h" |
|
28 |
|
29 #include "rubydebug.h" |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CListQueryDialog::NewL |
|
33 // Two-phased constructor. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CListQueryDialog* CListQueryDialog::NewL( TInt *aIndex, |
|
37 CListQueryDialog** aSelf, |
|
38 MEikCommandObserver* aObserver, |
|
39 TInt aMenuTitleResourceId ) |
|
40 { |
|
41 CListQueryDialog* self = new (ELeave) CListQueryDialog( aObserver, |
|
42 aMenuTitleResourceId, |
|
43 aIndex, aSelf ); |
|
44 CleanupStack::PushL( self ); |
|
45 self->ConstructL(); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // Destructor |
|
51 CListQueryDialog::~CListQueryDialog() |
|
52 { |
|
53 RUBY_DEBUG0( "CListQueryDialog::~CListQueryDialog START" ); |
|
54 |
|
55 MakeVisible( EFalse ); |
|
56 |
|
57 if ( iSelf ) |
|
58 { |
|
59 *iSelf = NULL; |
|
60 iSelf = NULL; |
|
61 } |
|
62 |
|
63 RUBY_DEBUG0( "CListQueryDialog::~CListQueryDialog EXIT" ); |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------- |
|
67 // CListQueryDialog::IsMenuVisible |
|
68 // --------------------------------------------------------- |
|
69 // |
|
70 TBool CListQueryDialog::IsMenuVisible() |
|
71 { |
|
72 RUBY_DEBUG0( "CListQueryDialog::IsMenuVisible" ); |
|
73 return MenuShowing(); |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------- |
|
77 // CListQueryDialog::SetCommandVisibility |
|
78 // --------------------------------------------------------- |
|
79 // |
|
80 void CListQueryDialog::SetCommandVisibility( TBool aHidden ) |
|
81 { |
|
82 RUBY_DEBUG0( "CListQueryDialog::SetCommandVisibility" ); |
|
83 iCommandsHidden = aHidden; |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // CListQueryDialog::PostLayoutDynInitL |
|
88 // --------------------------------------------------------- |
|
89 // |
|
90 void CListQueryDialog::PostLayoutDynInitL() |
|
91 { |
|
92 RUBY_DEBUG_BLOCK( "CListQueryDialog::PostLayoutDynInitL" ); |
|
93 |
|
94 if ( iObserver && iMenuResourceId ) |
|
95 { |
|
96 if ( iMenuBar ) |
|
97 { |
|
98 iMenuBar->TitleArray()->ResetAndDestroy(); |
|
99 iMenuBar->SetMenuTitleResourceId( iMenuResourceId ); |
|
100 iMenuBar->SetMenuType( CEikMenuBar::EMenuOptionsNoTaskSwapper ); |
|
101 } |
|
102 else |
|
103 { |
|
104 CEikMenuBar* menuBar = new ( ELeave ) CEikMenuBar(); |
|
105 CleanupStack::PushL( menuBar ); |
|
106 |
|
107 menuBar->ConstructL( this, NULL, iMenuResourceId ); |
|
108 menuBar->SetMenuType( CEikMenuBar::EMenuOptionsNoTaskSwapper ); |
|
109 |
|
110 iEikonEnv->EikAppUi()->AddToStackL( menuBar, |
|
111 ECoeStackPriorityMenu, |
|
112 ECoeStackFlagRefusesFocus); |
|
113 |
|
114 iMenuBar = menuBar; |
|
115 CleanupStack::Pop( menuBar ); // now owned by this Dialog. |
|
116 } |
|
117 } |
|
118 |
|
119 // Set scrollbar observer so that touch scrolling can be observed |
|
120 ListBox()->ScrollBarFrame()->SetScrollBarFrameObserver( this ); |
|
121 |
|
122 CAknDialog::PostLayoutDynInitL(); |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------- |
|
126 // CListQueryDialog::OkToExitL |
|
127 // --------------------------------------------------------- |
|
128 // |
|
129 TBool CListQueryDialog::OkToExitL( TInt aButtonId ) |
|
130 { |
|
131 RUBY_DEBUG_BLOCK( "CListQueryDialog::OkToExitL" ); |
|
132 |
|
133 TBool returnValue = CAknListQueryDialog::OkToExitL( aButtonId ); |
|
134 |
|
135 switch( aButtonId ) |
|
136 { |
|
137 case EAknSoftkeyOptions: |
|
138 { |
|
139 DisplayMenuL(); |
|
140 |
|
141 returnValue = EFalse; |
|
142 |
|
143 if ( iObserver ) |
|
144 { |
|
145 iObserver->ProcessCommandL( EAknSoftkeyOptions ); |
|
146 } |
|
147 |
|
148 break; |
|
149 } |
|
150 |
|
151 case EVoiceTagSoftKeySelect: |
|
152 { |
|
153 returnValue = ETrue; |
|
154 |
|
155 break; |
|
156 } |
|
157 |
|
158 default: |
|
159 { |
|
160 break; |
|
161 } |
|
162 } |
|
163 return returnValue; |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------- |
|
167 // CListQueryDialog::ProcessCommandL |
|
168 // --------------------------------------------------------- |
|
169 // |
|
170 void CListQueryDialog::ProcessCommandL( TInt aCommandId ) |
|
171 { |
|
172 RUBY_DEBUG_BLOCK( "CListQueryDialog::ProcessCommandL" ); |
|
173 |
|
174 if ( !iObserver ) |
|
175 { |
|
176 User::Leave( KErrArgument ); |
|
177 } |
|
178 |
|
179 iObserver->ProcessCommandL( aCommandId ); |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------- |
|
183 // CListQueryDialog::DynInitMenuPaneL |
|
184 // --------------------------------------------------------- |
|
185 // |
|
186 void CListQueryDialog::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
187 { |
|
188 RUBY_DEBUG_BLOCK( "CListQueryDialog::DynInitMenuPaneL" ); |
|
189 |
|
190 if ( aMenuPane && aResourceId == R_NBEST_MENU_PANE ) |
|
191 { |
|
192 aMenuPane->SetItemDimmed( EVoiceTagSoftKeyOpen, iCommandsHidden ); |
|
193 } |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------- |
|
197 // CListQueryDialog::HandleListBoxEventL |
|
198 // --------------------------------------------------------- |
|
199 // |
|
200 void CListQueryDialog::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ) |
|
201 { |
|
202 RUBY_DEBUG_BLOCK( "CListQueryDialog::HandleListBoxEventL" ); |
|
203 |
|
204 TBool forwardEvent = ETrue; |
|
205 |
|
206 if ( aEventType == EEventItemClicked ) |
|
207 { |
|
208 if ( iObserver ) |
|
209 { |
|
210 forwardEvent = EFalse; |
|
211 iObserver->ProcessCommandL( EDragKeypress ); |
|
212 } |
|
213 } |
|
214 else if ( aEventType == EEventItemDraggingActioned ) |
|
215 { |
|
216 if ( iObserver ) |
|
217 { |
|
218 iObserver->ProcessCommandL( EDragKeypress ); |
|
219 } |
|
220 } |
|
221 else if ( aEventType == EEventItemDoubleClicked ) |
|
222 { |
|
223 if ( iObserver ) |
|
224 { |
|
225 forwardEvent = EFalse; |
|
226 iObserver->ProcessCommandL( EVoiceTagSoftKeySelect ); |
|
227 } |
|
228 } |
|
229 else if ( aEventType == EEventFlickStopped ) |
|
230 { |
|
231 if ( iObserver ) |
|
232 { |
|
233 iObserver->ProcessCommandL( EDragKeypress ); |
|
234 } |
|
235 } |
|
236 |
|
237 if ( forwardEvent ) |
|
238 { |
|
239 CAknListQueryDialog::HandleListBoxEventL( aListBox, aEventType ); |
|
240 } |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------- |
|
244 // CListQueryDialog::HandleScrollEventL |
|
245 // --------------------------------------------------------- |
|
246 // |
|
247 void CListQueryDialog::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType ) |
|
248 { |
|
249 RUBY_DEBUG_BLOCK( "CListQueryDialog::HandleScrollEventL" ); |
|
250 |
|
251 if ( aEventType == EEikScrollThumbDragVert ) |
|
252 { |
|
253 if ( iObserver ) |
|
254 { |
|
255 iObserver->ProcessCommandL( EScrollKeypress ); |
|
256 } |
|
257 } |
|
258 |
|
259 ListBox()->HandleScrollEventL( aScrollBar, aEventType ); |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------- |
|
263 // CListQueryDialog::CListQueryDialog |
|
264 // --------------------------------------------------------- |
|
265 // |
|
266 CListQueryDialog::CListQueryDialog( MEikCommandObserver* aObserver, |
|
267 TInt aMenuTitleResourceId, |
|
268 TInt *aIndex, CListQueryDialog** aSelf ) |
|
269 : CAknListQueryDialog( aIndex ), iObserver( aObserver), |
|
270 iMenuResourceId( aMenuTitleResourceId ), iSelf( aSelf ) |
|
271 { |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------- |
|
275 // CListQueryDialog::ConstructL |
|
276 // --------------------------------------------------------- |
|
277 // |
|
278 void CListQueryDialog::ConstructL() |
|
279 { |
|
280 RUBY_DEBUG_BLOCK( "CListQueryDialog::ConstructL" ); |
|
281 } |
|
282 |
|
283 // End of File |
|
284 |