125 { |
125 { |
126 iSearchPane->SetTextL( *iDefaultSearchText ); |
126 iSearchPane->SetTextL( *iDefaultSearchText ); |
127 } |
127 } |
128 CleanupStack::PopAndDestroy( text ); |
128 CleanupStack::PopAndDestroy( text ); |
129 } |
129 } |
130 |
130 |
131 iGotoPane->BeginEditingL(); |
131 iGotoPane->BeginEditingL(); |
132 DrawDeferred(); |
132 DrawDeferred(); |
133 } |
133 } |
134 } |
134 } |
135 |
135 |
136 // --------------------------------------------------------- |
136 // --------------------------------------------------------- |
137 // CBrowserBookmarksContainer::SetSearchActiveL |
137 // CBrowserBookmarksContainer::SetSearchActiveL |
138 // --------------------------------------------------------- |
138 // --------------------------------------------------------- |
139 // |
139 // |
140 void CBrowserBookmarksContainer::SetSearchActiveL() |
140 void CBrowserBookmarksContainer::SetSearchActiveL() |
141 { |
141 { |
142 if( ! iSearchPaneActive ) |
142 if( ! iSearchPaneActive ) |
143 { |
143 { |
144 // Check for Search Configuration Changes // |
144 // Check for Search Configuration Changes // |
145 if( View().ApiProvider().Preferences().GetIntValue( KBrowserSearchIconId ) |
145 if( View().ApiProvider().Preferences().GetIntValue( KBrowserSearchIconId ) |
146 != iSearchIconId ) |
146 != iSearchIconId ) |
147 { |
147 { |
148 ConstructSearchPaneL(); |
148 ConstructSearchPaneL(); |
149 } |
149 } |
150 |
150 |
151 iSearchPane->SetVKBFlag( EFalse ); |
151 iSearchPane->SetVKBFlag( EFalse ); |
152 iSearchPane->SetFocus( ETrue ); |
152 iSearchPane->SetFocus( ETrue ); |
153 iSearchPaneActive = ETrue; |
153 iSearchPaneActive = ETrue; |
154 |
154 |
155 Listbox()->UpdateFilterL(); |
155 Listbox()->UpdateFilterL(); |
156 // only one editor can be active at a time |
156 // only one editor can be active at a time |
157 iGotoPaneActive = EFalse; |
157 iGotoPaneActive = EFalse; |
158 iGotoPane->MakeVisible(ETrue); |
158 iGotoPane->MakeVisible(ETrue); |
159 iGotoPane->SetFocus( EFalse ); |
159 iGotoPane->SetFocus( EFalse ); |
160 iGotoPane->CancelEditingL(); |
160 iGotoPane->CancelEditingL(); |
161 |
161 |
162 // redraw |
162 // redraw |
163 SizeChanged(); |
163 SizeChanged(); |
164 |
164 |
165 // Not Focused, so set the current Text Mode to italics. |
165 // Not Focused, so set the current Text Mode to italics. |
166 iGotoPane->SetTextModeItalicL(); |
166 iGotoPane->SetTextModeItalicL(); |
167 // if gotopane is empty add default text |
167 // if gotopane is empty add default text |
168 HBufC* text = iGotoPane->GetTextL(); |
168 HBufC* text = iGotoPane->GetTextL(); |
169 CleanupStack::PushL( text ); |
169 CleanupStack::PushL( text ); |
170 if ( !text->Length() ) |
170 if ( !text->Length() ) |
171 { |
171 { |
172 iGotoPane->SetTextL( KWWWString ); |
172 iGotoPane->SetTextL( KWWWString ); |
173 } |
173 } |
174 CleanupStack::PopAndDestroy( text ); |
174 CleanupStack::PopAndDestroy( text ); |
175 |
175 |
176 iSearchPane->BeginEditingL(); |
176 iSearchPane->BeginEditingL(); |
177 DrawDeferred(); |
177 DrawDeferred(); |
178 } |
178 } |
179 |
179 |
180 } |
180 } |
181 |
181 |
182 |
182 |
183 // --------------------------------------------------------- |
183 // --------------------------------------------------------- |
184 // CBrowserBookmarksContainer::SetGotoInactiveL(); |
184 // CBrowserBookmarksContainer::SetGotoInactiveL(); |
185 // --------------------------------------------------------- |
185 // --------------------------------------------------------- |
186 // |
186 // |
187 |
187 |
188 void CBrowserBookmarksContainer::SetGotoInactiveL() |
188 void CBrowserBookmarksContainer::SetGotoInactiveL() |
189 { |
189 { |
190 if( iGotoPaneActive || iSearchPaneActive ) |
190 if( iGotoPaneActive || iSearchPaneActive ) |
191 { |
191 { |
192 |
192 |
193 if( iSearchPane ) |
193 if( iSearchPane ) |
194 { |
194 { |
195 /* In Search Feature we have to move between the editors preserving the |
195 /* In Search Feature we have to move between the editors preserving the |
196 * text added, clear the text when cancel is pressed. |
196 * text added, clear the text when cancel is pressed. |
197 */ |
197 */ |
198 iGotoPane->SetTextL( KNullDesC , ETrue ); |
198 iGotoPane->SetTextL( KNullDesC , ETrue ); |
199 SetSearchInactiveL(); |
199 SetSearchInactiveL(); |
200 } |
200 } |
201 // Deactivate GoTo Pane |
201 // Deactivate GoTo Pane |
202 iGotoPaneActive = EFalse; |
202 iGotoPaneActive = EFalse; |
203 |
203 |
204 // Deactivate GoTo Pane |
204 // Deactivate GoTo Pane |
205 iGotoPane->MakeVisible( EFalse ); |
205 iGotoPane->MakeVisible( EFalse ); |
206 iGotoPane->CancelEditingL(); |
206 iGotoPane->CancelEditingL(); |
207 iGotoPane->SetFocus( EFalse ); |
207 iGotoPane->SetFocus( EFalse ); |
208 |
208 |
209 // redraw |
209 // redraw |
210 Listbox()->UpdateFilterL(); |
210 Listbox()->UpdateFilterL(); |
211 SizeChanged(); |
211 SizeChanged(); |
212 DrawDeferred(); |
212 DrawDeferred(); |
213 } |
213 } |
214 } |
214 } |
215 |
215 |
216 void CBrowserBookmarksContainer::SetSearchInactiveL() |
216 void CBrowserBookmarksContainer::SetSearchInactiveL() |
217 { |
217 { |
218 iSearchPaneActive = EFalse; |
218 iSearchPaneActive = EFalse; |
219 iSearchPane->SetTextL( KNullDesC , ETrue); |
219 iSearchPane->SetTextL( KNullDesC , ETrue); |
220 iSearchPane->MakeVisible( EFalse ); |
220 iSearchPane->MakeVisible( EFalse ); |
221 iSearchPane->CancelEditingL(); |
221 iSearchPane->CancelEditingL(); |
222 } |
222 } |
223 |
223 |
265 // |
265 // |
266 void CBrowserBookmarksContainer::SizeChanged() |
266 void CBrowserBookmarksContainer::SizeChanged() |
267 { |
267 { |
268 TRect rect = Rect(); |
268 TRect rect = Rect(); |
269 TInt unfilteredNumberOfItems = Listbox()->UnfilteredNumberOfItems(); |
269 TInt unfilteredNumberOfItems = Listbox()->UnfilteredNumberOfItems(); |
270 |
270 |
271 // if goto pane is active |
271 // if goto pane is active |
272 if( iGotoPaneActive || iSearchPaneActive ) |
272 if( iGotoPaneActive || iSearchPaneActive ) |
273 { |
273 { |
274 if( iSearchPane ) |
274 if( iSearchPane ) |
275 { |
275 { |
276 TAknWindowLineLayout findPane = AknLayout::find_pane(); |
276 TAknWindowLineLayout findPane = AknLayout::find_pane(); |
277 |
277 |
278 // Enable / disable line in Goto Pane (hide if listbox is empty). |
278 // Enable / disable line in Goto Pane (hide if listbox is empty). |
279 iGotoPane->SetLineState( unfilteredNumberOfItems > 0 ); |
279 iGotoPane->SetLineState( unfilteredNumberOfItems > 0 ); |
280 |
280 |
281 TAknWindowLineLayout listLayout = AknLayout::list_gen_pane( 1 ); |
281 TAknWindowLineLayout listLayout = AknLayout::list_gen_pane( 1 ); |
282 |
282 |
283 TRect listBoxRect = AknLayoutUtils::RectFromCoords( rect,listLayout.il, |
283 TRect listBoxRect = AknLayoutUtils::RectFromCoords( rect,listLayout.il, |
284 listLayout.it, listLayout.ir, listLayout.ib, listLayout.iW, listLayout.iH); |
284 listLayout.it, listLayout.ir, listLayout.ib, listLayout.iW, listLayout.iH); |
285 |
285 |
286 /* Now we need to make room for both Goto and Search Pane. |
286 /* Now we need to make room for both Goto and Search Pane. |
287 * No layout specification was suitable for this case, so |
287 * No layout specification was suitable for this case, so |
288 * substracting the height of pane. |
288 * substracting the height of pane. |
289 */ |
289 */ |
290 listBoxRect.iBr.iY -= findPane.iH; |
290 listBoxRect.iBr.iY -= findPane.iH; |
291 |
291 |
292 // In Goto Mode, the listbox is laid out leaving space for Goto Pane. |
292 // In Goto Mode, the listbox is laid out leaving space for Goto Pane. |
293 Listbox()->SetRect( listBoxRect ); |
293 Listbox()->SetRect( listBoxRect ); |
294 |
294 |
295 |
295 |
296 // Now Lay out Search Pane as if it was the old Find Pane. |
296 // Now Lay out Search Pane as if it was the old Find Pane. |
297 AknLayoutUtils::LayoutControl( iSearchPane, rect, findPane ); |
297 AknLayoutUtils::LayoutControl( iSearchPane, rect, findPane ); |
298 |
298 |
299 TRect gotoRect = AknLayoutUtils::RectFromCoords( rect,findPane.il, findPane.it, |
299 TRect gotoRect = AknLayoutUtils::RectFromCoords( rect,findPane.il, findPane.it, |
300 findPane.ir, findPane.ib, findPane.iW, findPane.iH); |
300 findPane.ir, findPane.ib, findPane.iW, findPane.iH); |
301 |
301 |
302 // Calculate the new position for GoToPane. |
302 // Calculate the new position for GoToPane. |
303 gotoRect.iTl.iY -= ( findPane.iH ); |
303 gotoRect.iTl.iY -= ( findPane.iH ); |
304 gotoRect.iBr.iY -= ( findPane.iH ); |
304 gotoRect.iBr.iY -= ( findPane.iH ); |
305 iGotoPane->SetRect( gotoRect ); |
305 iGotoPane->SetRect( gotoRect ); |
306 |
306 |
307 } |
307 } |
308 else |
308 else |
309 { |
309 { |
310 // Enable / disable line in Goto Pane (hide if listbox is empty). |
310 // Enable / disable line in Goto Pane (hide if listbox is empty). |
311 iGotoPane->SetLineState( unfilteredNumberOfItems > 0 ); |
311 iGotoPane->SetLineState( unfilteredNumberOfItems > 0 ); |
312 |
312 |
313 // In Goto Mode, the listbox is laid out leaving space for Goto Pane. |
313 // In Goto Mode, the listbox is laid out leaving space for Goto Pane. |
314 AknLayoutUtils::LayoutControl( Listbox(), rect, AknLayout::list_gen_pane( 1 )); |
314 AknLayoutUtils::LayoutControl( Listbox(), rect, AknLayout::list_gen_pane( 1 )); |
315 |
315 |
316 // Lay out Goto Pane as if it was the old Find Pane. |
316 // Lay out Goto Pane as if it was the old Find Pane. |
317 AknLayoutUtils::LayoutControl( iGotoPane, rect, AknLayout::find_pane() ); |
317 AknLayoutUtils::LayoutControl( iGotoPane, rect, AknLayout::find_pane() ); |
318 } |
318 } |
319 } |
319 } |
320 else |
320 else |
321 { |
321 { |
322 // Fall back upon default behavior in base-class, which lays out the bookmarks list only |
322 // Fall back upon default behavior in base-class, which lays out the bookmarks list only |
323 CBrowserFavouritesContainer::SizeChanged(); |
323 CBrowserFavouritesContainer::SizeChanged(); |
324 } |
324 } |
325 } |
325 } |
326 |
326 |
327 // --------------------------------------------------------- |
327 // --------------------------------------------------------- |
328 // CBrowserBookmarksContainer::OfferKeyEventL |
328 // CBrowserBookmarksContainer::OfferKeyEventL |
329 // --------------------------------------------------------- |
329 // --------------------------------------------------------- |
330 // |
330 // |
331 TKeyResponse CBrowserBookmarksContainer::OfferKeyEventL |
331 TKeyResponse CBrowserBookmarksContainer::OfferKeyEventL |
332 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
332 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
333 { |
333 { |
334 /* |
334 /* |
335 LOG_ENTERFN( "BookmarksContainer::OfferKeyEventL" ); |
335 LOG_ENTERFN( "BookmarksContainer::OfferKeyEventL" ); |
336 BROWSER_LOG( ( _L("aType: %d, aKeyEvent.iCode: %d, iScanCode: %d, iRepeats: %d"), |
336 BROWSER_LOG( ( _L("aType: %d, aKeyEvent.iCode: %d, iScanCode: %d, iRepeats: %d"), |
337 aType, aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iRepeats ) ); |
337 aType, aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iRepeats ) ); |
338 */ |
338 */ |
339 TKeyResponse result = EKeyWasNotConsumed; |
339 TKeyResponse result = EKeyWasNotConsumed; |
340 TKeyEvent keyEvent( aKeyEvent ); |
340 TKeyEvent keyEvent( aKeyEvent ); |
341 |
341 |
342 // Selection Key handling |
342 // Selection Key handling |
343 if( keyEvent.iScanCode == EStdKeyDevice3 ) |
343 if( keyEvent.iScanCode == EStdKeyDevice3 ) |
344 { |
344 { |
345 // it is possible to activate BookmarksView from ContentView |
345 // it is possible to activate BookmarksView from ContentView |
346 // via a long press of Selection key, so here we must capture |
346 // via a long press of Selection key, so here we must capture |
347 // the KeyDown. Long press processing will be done only if key |
347 // the KeyDown. Long press processing will be done only if key |
348 // was pressed originally in this view. |
348 // was pressed originally in this view. |
349 if( aType == EEventKeyDown ) |
349 if( aType == EEventKeyDown ) |
350 { |
350 { |
351 iSelectionKeyDownPressed = ETrue; |
351 iSelectionKeyDownPressed = ETrue; |
352 result = EKeyWasConsumed; |
352 result = EKeyWasConsumed; |
353 } |
353 } |
354 else if( aType == EEventKeyUp ) |
354 else if( aType == EEventKeyUp ) |
355 { |
355 { |
356 if( !iSelectionKeyLongPress && iSelectionKeyDownPressed ) |
356 if( !iSelectionKeyLongPress && iSelectionKeyDownPressed ) |
357 { |
357 { |
358 // short press of Selection key, pass it to GotoPane |
358 // short press of Selection key, pass it to GotoPane |
359 keyEvent.iCode = EKeyOK; |
359 keyEvent.iCode = EKeyOK; |
360 result = EKeyWasNotConsumed; |
360 result = EKeyWasNotConsumed; |
361 } |
361 } |
362 else |
362 else |
363 { |
363 { |
364 // long press of Selection key was already processed |
364 // long press of Selection key was already processed |
365 result = EKeyWasConsumed; |
365 result = EKeyWasConsumed; |
366 } |
366 } |
367 iSelectionKeyDownPressed = EFalse; |
367 iSelectionKeyDownPressed = EFalse; |
368 iSelectionKeyLongPress = EFalse; |
368 iSelectionKeyLongPress = EFalse; |
369 } |
369 } |
370 else if( aType == EEventKey ) |
370 else if( aType == EEventKey ) |
371 { |
371 { |
372 if( keyEvent.iRepeats && iSelectionKeyDownPressed ) |
372 if( keyEvent.iRepeats && iSelectionKeyDownPressed ) |
373 { |
373 { |
374 const CFavouritesItem* item = Listbox()->CurrentItem(); |
374 const CFavouritesItem* item = Listbox()->CurrentItem(); |
375 if ( item ) |
375 if ( item ) |
376 { |
376 { |
377 // The option for the user to download the page in new window is disabled |
377 // The option for the user to download the page in new window is disabled |
378 CBrowserAppUi::Static()->FetchBookmarkL( *item ); |
378 CBrowserAppUi::Static()->FetchBookmarkL( *item ); |
379 } |
379 } |
380 iSelectionKeyLongPress = ETrue; |
380 iSelectionKeyLongPress = ETrue; |
381 iSelectionKeyDownPressed = EFalse; |
381 iSelectionKeyDownPressed = EFalse; |
382 } |
382 } |
383 |
383 |
384 if ( (aKeyEvent.iScanCode == EStdKeyHash) || |
384 if ( (aKeyEvent.iScanCode == EStdKeyHash) || |
385 ( aKeyEvent.iModifiers & |
385 ( aKeyEvent.iModifiers & |
386 ( EModifierShift | EModifierLeftShift | EModifierRightShift | |
386 ( EModifierShift | EModifierLeftShift | EModifierRightShift | |
387 EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) ) |
387 EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) ) |
388 { |
388 { |
389 |
389 |
390 // Hash key press will be used for Mark/UnMark functionality |
390 // Hash key press will be used for Mark/UnMark functionality |
391 // Let Platform Listbox handle this. |
391 // Let Platform Listbox handle this. |
392 result = EKeyWasNotConsumed; |
392 result = EKeyWasNotConsumed; |
393 } |
393 } |
394 else |
394 else |
395 { |
395 { |
396 result = EKeyWasConsumed; |
396 result = EKeyWasConsumed; |
397 } |
397 } |
398 } |
398 } |
399 } |
399 } |
400 // If the Goto Pane exists and we're not fetching, then decide |
400 |
401 // if we should pass keystroke to it |
401 // If the Goto Pane exists and we're not fetching, decide |
402 if(iGotoPane && !CBrowserAppUi::Static()->Fetching()) |
402 // if we should pass key event to the goto pane |
403 { |
403 if ( iGotoPane && !CBrowserAppUi::Static()->Fetching() ) |
404 // If the key so far hadn't been consumed or if the pane is already active, |
404 { |
405 // pass the keystroke on |
405 // If the key hadn't been consumed, so far, determine if the keystroke |
406 if( (result == EKeyWasNotConsumed) || iGotoPaneActive || iSearchPaneActive ) |
406 // should be handled by goto pane |
407 { |
407 if ( ( result == EKeyWasNotConsumed ) || iSearchPaneActive ) |
408 // Goto pane has highest priority; if it's active, arrow keys go there. |
408 { |
409 // If fetching is in progress, no key events are offered, to prevent it |
409 // Goto pane has highest priority; if it's active, arrow keys go there. |
410 // from getting the focus and popping up a new CBA. |
410 // If fetching is in progress, no key events are offered, to prevent it |
411 |
411 // from getting the focus and popping up a new CBA. |
412 // Enter Key now handled through HandleCommand in BrowserBookmarksView like MSK |
412 |
413 // This change affects the enter key on the QWERTY keyboard when we run emulator |
413 // Enter Key now handled through HandleCommand in BrowserBookmarksView like MSK |
414 if(EStdKeyEnter == aKeyEvent.iScanCode && EEventKeyUp == aType && AknLayoutUtils::MSKEnabled() && (iGotoPaneActive || iSearchPaneActive )) |
414 // This change affects the enter key on the QWERTY keyboard when we run emulator |
415 { |
415 if ( EStdKeyEnter == aKeyEvent.iScanCode && EEventKeyUp == aType && |
416 CEikButtonGroupContainer* myCba = CEikButtonGroupContainer::Current(); |
416 AknLayoutUtils::MSKEnabled() && |
417 if(myCba != NULL) |
417 ( iGotoPaneActive || iSearchPaneActive ) ) |
418 { |
418 { |
419 TInt cmdId = myCba->ButtonGroup()->CommandId(CEikButtonGroupContainer::EMiddleSoftkeyPosition); |
419 // Handle MSK press |
420 View().HandleCommandL(cmdId); |
420 CEikButtonGroupContainer* myCba = CEikButtonGroupContainer::Current(); |
421 result = EKeyWasConsumed; |
421 if ( myCba != NULL ) |
422 } |
422 { |
423 } |
423 TInt cmdId = myCba->ButtonGroup()->CommandId(CEikButtonGroupContainer::EMiddleSoftkeyPosition); |
424 else |
424 View().HandleCommandL(cmdId); |
425 { |
425 result = EKeyWasConsumed; |
426 if( iSearchPane ) |
426 } |
427 { |
427 } |
428 // Process separately for Search Feature // |
428 else |
429 if( iGotoPaneActive ) |
429 { |
|
430 if ( iSearchPane ) |
|
431 { |
|
432 // Process separately for Search Feature |
|
433 if ( iGotoPaneActive ) |
430 { |
434 { |
431 result = iGotoPane->OfferKeyEventL( keyEvent, aType ); |
435 result = iGotoPane->OfferKeyEventL( keyEvent, aType ); |
432 } |
436 } |
433 else |
437 else |
434 { |
438 { |
435 result = iSearchPane->OfferKeyEventL( keyEvent, aType ); |
439 result = iSearchPane->OfferKeyEventL( keyEvent, aType ); |
436 } |
440 } |
437 } |
441 } |
438 else |
442 else |
439 result = iGotoPane->OfferKeyEventL( keyEvent, aType ); |
|
440 } |
|
441 |
|
442 if( iSearchPane ) |
|
443 { |
|
444 if( ( iGotoPaneActive || iSearchPaneActive) && result == EKeyWasNotConsumed ) |
|
445 { |
443 { |
446 |
444 if ( iGotoPaneActive ) |
447 if( aKeyEvent.iCode == EKeyUpArrow ) |
445 { |
|
446 // Once activated let goto pane handle all the keys |
|
447 result = iGotoPane->OfferKeyEventL( keyEvent, aType ); |
|
448 } |
|
449 else // if ( !iGotoPaneActive ) |
|
450 { |
|
451 // Only a valid digit or character should popup the goto pane. |
|
452 // We will ignore h/w key events, i.e. camera cover, camera |
|
453 // shutter, zoom, etc... iCode is only valid for EEventKey, |
|
454 // not EEventKeyDown, so we have to use iScanCode. because |
|
455 // the goto pane decides to popup on EEventKeyDown. Use |
|
456 // upper case of iScanCode since there is no overlap of |
|
457 // h/w scan codes and uppercase letters. |
|
458 TChar inputCharCode( aKeyEvent.iScanCode ); |
|
459 TBool isDigit = inputCharCode.IsDigit(); |
|
460 TUint upperCase = inputCharCode.GetUpperCase(); |
|
461 if ( isDigit || |
|
462 (( upperCase >= 0x41 /*A*/ ) && ( upperCase <= 0x5A /*Z*/ )) ) |
|
463 { |
|
464 // Valid digit or character was entered, let goto pane |
|
465 // determine if it handles the keys from here on. |
|
466 result = iGotoPane->OfferKeyEventL( aKeyEvent, aType ); |
|
467 if ( result == EKeyWasConsumed ) |
|
468 { |
|
469 // goto pane is not active, make it active now |
|
470 SetGotoActiveL(); |
|
471 } |
|
472 } |
|
473 } |
|
474 } |
|
475 } |
|
476 } |
|
477 |
|
478 if ( iSearchPane ) |
|
479 { |
|
480 if ( ( iGotoPaneActive || iSearchPaneActive) && |
|
481 result == EKeyWasNotConsumed ) |
|
482 { |
|
483 |
|
484 if ( aKeyEvent.iCode == EKeyUpArrow ) |
448 { |
485 { |
449 result = EKeyWasConsumed; |
486 result = EKeyWasConsumed; |
450 if( iSearchPaneActive ) |
487 if ( iSearchPaneActive ) |
451 { |
488 { |
452 SetGotoActiveL(); |
489 SetGotoActiveL(); |
453 iGotoPane->SetVKBFlag( ETrue ); |
490 iGotoPane->SetVKBFlag( ETrue ); |
454 } |
491 } |
455 } |
492 } |
456 if( aKeyEvent.iCode == EKeyDownArrow ) |
493 |
|
494 if ( aKeyEvent.iCode == EKeyDownArrow ) |
457 { |
495 { |
458 result = EKeyWasConsumed; |
496 result = EKeyWasConsumed; |
459 if( iGotoPaneActive ) |
497 if ( iGotoPaneActive ) |
460 { |
498 { |
461 SetSearchActiveL(); |
499 SetSearchActiveL(); |
462 iSearchPane->SetVKBFlag( ETrue ); |
500 iSearchPane->SetVKBFlag( ETrue ); |
463 } |
501 } |
464 } |
502 } |
465 } |
503 } |
466 } |
504 } |
467 |
505 } |
468 // if key is consumed, goto pane was not active, make it active now. |
506 |
469 if(result == EKeyWasConsumed && (!iGotoPaneActive && !iSearchPaneActive)) |
507 // For handling Enter key in emulator / Keyboard ( Enter key should behave similar to MSK ) |
470 { |
508 if ( EStdKeyEnter == keyEvent.iScanCode && EEventKey == aType && |
471 SetGotoActiveL(); |
509 AknLayoutUtils::MSKEnabled() && result == EKeyWasNotConsumed ) |
472 } |
510 { |
473 } |
511 CEikButtonGroupContainer* myCba = CEikButtonGroupContainer::Current(); |
474 } |
512 if(myCba != NULL) |
475 // For handling Enter key in emulator / Keyboard ( Enter key should behave similar to MSK ) |
513 { |
476 if(EStdKeyEnter == keyEvent.iScanCode && EEventKey == aType && AknLayoutUtils::MSKEnabled() && result == EKeyWasNotConsumed ) |
514 TInt cmdId = myCba->ButtonGroup()->CommandId(CEikButtonGroupContainer::EMiddleSoftkeyPosition); |
477 { |
515 if(EAknSoftkeyContextOptions == cmdId) |
478 CEikButtonGroupContainer* myCba = CEikButtonGroupContainer::Current(); |
516 { |
479 if(myCba != NULL) |
517 View().MenuBar()->TryDisplayContextMenuBarL(); |
480 { |
518 result = EKeyWasConsumed; |
481 TInt cmdId = myCba->ButtonGroup()->CommandId(CEikButtonGroupContainer::EMiddleSoftkeyPosition); |
519 } |
482 if(EAknSoftkeyContextOptions == cmdId) |
520 else if(Listbox()->Model()->ItemTextArray()->MdcaCount() == 0) |
483 { |
521 { |
484 View().MenuBar()->TryDisplayContextMenuBarL(); |
522 View().HandleCommandL(cmdId); |
485 result = EKeyWasConsumed; |
523 result = EKeyWasConsumed; |
486 } |
524 } |
487 else if(Listbox()->Model()->ItemTextArray()->MdcaCount() == 0) |
525 } |
488 { |
526 } |
489 View().HandleCommandL(cmdId); |
|
490 result = EKeyWasConsumed; |
|
491 } |
|
492 } |
|
493 } |
|
494 |
527 |
495 if ( result == EKeyWasNotConsumed ) |
528 if ( result == EKeyWasNotConsumed ) |
496 { |
529 { |
497 // Otherwise, base class handles Find pane, arrows between folders and |
530 // Otherwise, base class handles Find pane, arrows between folders and |
498 // the listbox. |
531 // the listbox. |
499 result = CBrowserFavouritesContainer::OfferKeyEventL |
532 result = CBrowserFavouritesContainer::OfferKeyEventL( keyEvent, aType ); |
500 ( keyEvent, aType ); |
|
501 } |
533 } |
502 |
534 |
503 return result; |
535 return result; |
504 } |
536 } |
505 |
537 |
506 // --------------------------------------------------------- |
538 // --------------------------------------------------------- |
507 // CBrowserBookmarksContainer::HandleCursorChangedL |
539 // CBrowserBookmarksContainer::HandleCursorChangedL |
508 // --------------------------------------------------------- |
540 // --------------------------------------------------------- |
509 // |
541 // |
510 void CBrowserBookmarksContainer::HandleCursorChangedL |
542 void CBrowserBookmarksContainer::HandleCursorChangedL |
511 ( CEikListBox* |
543 ( CEikListBox* |
512 #ifdef _DEBUG |
544 #ifdef _DEBUG |
513 aListBox // used only for debugging purposes |
545 aListBox // used only for debugging purposes |
514 #endif |
546 #endif |
515 ) |
547 ) |
516 { |
548 { |
742 |
775 |
743 void CBrowserBookmarksContainer::ConstructSearchPaneL() |
776 void CBrowserBookmarksContainer::ConstructSearchPaneL() |
744 { |
777 { |
745 TFileName iconFile; |
778 TFileName iconFile; |
746 MPreferences& preferences = View().ApiProvider().Preferences(); |
779 MPreferences& preferences = View().ApiProvider().Preferences(); |
747 |
780 |
748 TInt iconId = preferences.GetIntValue( KBrowserSearchIconId ); |
781 TInt iconId = preferences.GetIntValue( KBrowserSearchIconId ); |
749 // Get the Search Icon File Path. |
782 // Get the Search Icon File Path. |
750 preferences.GetStringValueL( KBrowserSearchIconPath, KMaxFileName, iconFile ); |
783 preferences.GetStringValueL( KBrowserSearchIconPath, KMaxFileName, iconFile ); |
751 |
784 |
752 // If Icon File Path Changed or Icon Id Changed, Refresh the Icon for Search Pane. |
785 // If Icon File Path Changed or Icon Id Changed, Refresh the Icon for Search Pane. |
753 // Comparing Icon File path as well, because it may be possible that two different |
786 // Comparing Icon File path as well, because it may be possible that two different |
754 // Icon files have same icon id. |
787 // Icon files have same icon id. |
755 if( iconId != iSearchIconId |
788 if( iconId != iSearchIconId |
756 || iSearchIconFilePath.Compare( iconFile ) != 0 ) |
789 || iSearchIconFilePath.Compare( iconFile ) != 0 ) |
757 { |
790 { |
758 |
791 |
759 TInt iconMaskId = preferences.GetIntValue( KBrowserSearchIconMaskId ); |
792 TInt iconMaskId = preferences.GetIntValue( KBrowserSearchIconMaskId ); |
760 |
793 |
761 // Save IconId |
794 // Save IconId |
762 iSearchIconId = iconId; |
795 iSearchIconId = iconId; |
763 // Save Icon File |
796 // Save Icon File |
764 iSearchIconFilePath = iconFile; |
797 iSearchIconFilePath = iconFile; |
765 |
798 |
766 |
799 |
767 // No Icon file or IconId or IconMaskId set , then it means no search provider is still |
800 // No Icon file or IconId or IconMaskId set , then it means no search provider is still |
768 // selected and set by search application, in that case we use the default icon for Search. |
801 // selected and set by search application, in that case we use the default icon for Search. |
769 if( ! iconFile.Length() |
802 if( ! iconFile.Length() |
770 || iconId == -1 |
803 || iconId == -1 |
771 || iconMaskId == -1 ) |
804 || iconMaskId == -1 ) |
772 { |
805 { |
773 iconId = EMbmAvkonQgn_indi_find_glass; |
806 iconId = EMbmAvkonQgn_indi_find_glass; |
774 iconMaskId = EMbmAvkonQgn_indi_find_glass_mask; |
807 iconMaskId = EMbmAvkonQgn_indi_find_glass_mask; |
775 iconFile = KAvkonBitmapFile; |
808 iconFile = KAvkonBitmapFile; |
776 } |
809 } |
777 |
810 |
778 if( iSearchPane ) |
811 if( iSearchPane ) |
779 { |
812 { |
780 delete iSearchPane; |
813 delete iSearchPane; |
781 iSearchPane = NULL; |
814 iSearchPane = NULL; |
782 } |
815 } |
783 |
816 |
784 |
817 |
785 // iSearchPane != NULL, implies presence of search feature, hence it can be |
818 // iSearchPane != NULL, implies presence of search feature, hence it can be |
786 // used to validate search feature avoiding repetative calls to utils and |
819 // used to validate search feature avoiding repetative calls to utils and |
787 // avoiding need of separate variable. |
820 // avoiding need of separate variable. |
788 iSearchPane = CBrowserBookmarksGotoPane::NewL( *this, |
821 iSearchPane = CBrowserBookmarksGotoPane::NewL( *this, |
789 &(View()), |
822 &(View()), |
790 iconFile, |
823 iconFile, |
791 iconId, |
824 iconId, |
792 iconMaskId, |
825 iconMaskId, |
793 GOTOPANE_POPUPLIST_DISABLE, |
826 GOTOPANE_POPUPLIST_DISABLE, |
794 ETrue |
827 ETrue |
795 ); |
828 ); |
796 |
829 |
797 CBrowserBookmarksView* bookmarkView = REINTERPRET_CAST( CBrowserBookmarksView* , &( View() )); |
830 CBrowserBookmarksView* bookmarkView = REINTERPRET_CAST( CBrowserBookmarksView* , &( View() )); |
798 // Set Pane observer |
831 // Set Pane observer |
799 iSearchPane->SetGPObserver( bookmarkView ); |
832 iSearchPane->SetGPObserver( bookmarkView ); |
800 } |
833 } |
801 } |
834 } |