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 the License "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 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <Browser_Platform_Variant.hrh> |
|
23 #include <eikmenub.h> |
|
24 #include <eikdef.h> |
|
25 #include <akninfrm.h> |
|
26 #include <eikon.rsg> |
|
27 #include <eikenv.h> |
|
28 #include <txtglobl.h> |
|
29 #include <gulfont.h> |
|
30 #include <txtfrmat.h> |
|
31 #include <eikgted.h> |
|
32 #include <aknconsts.h> |
|
33 #include <akneditstateindicator.h> |
|
34 #include <AknsListBoxBackgroundControlContext.h> |
|
35 #include <BrowserNG.rsg> |
|
36 #include <Featmgr.h> |
|
37 #include <fepbase.h> |
|
38 #include <aknutils.h> |
|
39 #include <browseruisdkcrkeys.h> |
|
40 |
|
41 #include <AknLayout2ScalableDef.h> |
|
42 #include <aknlayoutfont.h> |
|
43 #include <aknlayoutscalable_avkon.cdl.h> |
|
44 |
|
45 #include "CommonConstants.h" |
|
46 #include "BrowserGotoPane.h" |
|
47 #include "BrowserAppUi.h" |
|
48 #include "BrowserUtil.h" |
|
49 #include "browser.hrh" |
|
50 #include <favouriteslimits.h> |
|
51 #include "BrowserAdaptiveListPopup.h" |
|
52 #include "BrowserContentView.h" |
|
53 |
|
54 #include "eikon.hrh" |
|
55 |
|
56 #include <StringLoader.h> |
|
57 |
|
58 const TInt KMaxTitleLength = 512; |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CBrowserGotoPane::NewL |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CBrowserGotoPane* CBrowserGotoPane::NewL( |
|
65 const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId, |
|
66 TBool aPopupListStatus, CBrowserContentView* aContentView, |
|
67 TBool aFindKeywordMode ) |
|
68 { |
|
69 CBrowserGotoPane* gotoPane = new(ELeave) |
|
70 CBrowserGotoPane( aContentView, aFindKeywordMode ); |
|
71 |
|
72 CleanupStack::PushL( gotoPane ); |
|
73 gotoPane->ConstructL( aParent, aIconBitmapId, aIconMaskId, aPopupListStatus ); |
|
74 gotoPane->MakeVisibleL( EFalse ); |
|
75 gotoPane->SetFocus( EFalse ); |
|
76 CleanupStack::Pop(); // gotoPane |
|
77 |
|
78 return gotoPane; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CBrowserGotoPane::MakeVisibleL |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CBrowserGotoPane::MakeVisibleL( TBool aVisible ) |
|
86 { |
|
87 if ( aVisible ) |
|
88 { |
|
89 if ( iSearchEditor ) |
|
90 { |
|
91 ConstructSearchPaneL(); |
|
92 } |
|
93 HandleFindSizeChanged(); |
|
94 if ( AUTOCOMP ) //ask the feature manager |
|
95 { |
|
96 //2.1 does not put http:// there |
|
97 SetTextL( KNullDesC ); |
|
98 } |
|
99 else |
|
100 { |
|
101 //2.0 does put the http:// there |
|
102 SetTextL( KHttpString ); |
|
103 } |
|
104 } |
|
105 else |
|
106 { |
|
107 // Clear the search text if goto is cancelled ( hidden ). |
|
108 if ( iSearchEditor ) |
|
109 { |
|
110 SetSearchTextL( KNullDesC ); |
|
111 } |
|
112 } |
|
113 |
|
114 if (AknLayoutUtils::PenEnabled() && ( !iSearchEditor ) ) |
|
115 { |
|
116 SetPointerCapture(aVisible); |
|
117 if (aVisible) |
|
118 { |
|
119 ActivateVKB(); |
|
120 } |
|
121 } |
|
122 |
|
123 CCoeControl::MakeVisible( aVisible ); |
|
124 |
|
125 iGotoKeyHandled->Reset(); |
|
126 iGotoKeyHandled->EnableL( aVisible ); |
|
127 |
|
128 |
|
129 if ( iSearchEditor ) |
|
130 { |
|
131 SetTextModeItalicL(); |
|
132 } |
|
133 // To avoid Flickring Effect when SearchInputFrame is |
|
134 // re-created with new search provider icon. |
|
135 DrawNow( ); |
|
136 |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // CBrowserGotoPane::MakeVisible |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void CBrowserGotoPane::MakeVisible( TBool aVisible ) |
|
144 { |
|
145 TRAP_IGNORE( MakeVisibleL( aVisible ) ); |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CBrowserGotoPane::~CBrowserGotoPane |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 CBrowserGotoPane::~CBrowserGotoPane() |
|
153 { |
|
154 if (iAvkonAppUi!=NULL) |
|
155 { |
|
156 iAvkonAppUi->RemoveFromStack( iGotoKeyHandled ); |
|
157 } |
|
158 delete iSearchEditor; |
|
159 delete iSearchInputFrame; |
|
160 |
|
161 delete iGotoKeyHandled; |
|
162 delete iEditor; |
|
163 delete iInputFrame; |
|
164 delete iPrevKeyword; |
|
165 delete iBAdaptiveListPopup; |
|
166 delete iDefaultSearchText; |
|
167 iContentView = NULL; |
|
168 CCoeEnv::Static()->RemoveFepObserver(static_cast<MCoeFepObserver &>(*this)); |
|
169 } |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // CBrowserGotoPane::CBrowserGotoPane |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 CBrowserGotoPane::CBrowserGotoPane( CBrowserContentView* aContentView, TBool aFindKeywordMode ) |
|
176 : iContentView( aContentView), |
|
177 iFindKeywordMode( aFindKeywordMode ), |
|
178 iHandleFEPFind( ETrue ), |
|
179 iBAdaptiveListPopup( NULL ), |
|
180 iGotoPaneActive( ETrue ), |
|
181 iSearchPaneActive( EFalse), |
|
182 iSearchIconId( 0 ) |
|
183 { |
|
184 } |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // CBrowserGotoPane::ConstructL |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 void CBrowserGotoPane::ConstructL ( const CCoeControl* aParent, TInt aIconBitmapId, TInt aIconMaskId, |
|
191 TBool |
|
192 aPopupListStatus |
|
193 ) |
|
194 { |
|
195 CreateWindowL(); |
|
196 |
|
197 // remove 'const' modifier and set parent control |
|
198 SetMopParent( CONST_CAST( CCoeControl*, aParent ) ); |
|
199 |
|
200 iEditor = new (ELeave) CEikGlobalTextEditor; |
|
201 |
|
202 iInputFrame = CAknInputFrame::NewL( |
|
203 iEditor, |
|
204 EFalse, |
|
205 KAvkonBitmapFile, |
|
206 aIconBitmapId, |
|
207 aIconMaskId, |
|
208 CAknInputFrame::EPopupLayout ); |
|
209 |
|
210 iInputFrame->SetContainerWindowL( *this ); |
|
211 |
|
212 AknEditUtils::ConstructEditingL ( iEditor, |
|
213 KFavouritesMaxUrlGotoPaneDefine, |
|
214 1, |
|
215 EAknEditorCharactersLowerCase, |
|
216 EAknEditorAlignRight, |
|
217 EFalse, |
|
218 ETrue, |
|
219 EFalse ); |
|
220 |
|
221 iEditor->SetContainerWindowL( *this ); |
|
222 iEditor->SetObserver( this ); |
|
223 iEditor->SetBorder( TGulBorder::ENone ); |
|
224 iEditor->SetAknEditorCase( EAknEditorLowerCase ); |
|
225 iEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
|
226 |
|
227 if (AVKONAPAC) |
|
228 { |
|
229 // Disallow chinese input. |
|
230 iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | |
|
231 EAknEditorNumericInputMode ); |
|
232 } |
|
233 TInt editorFlags = ((iFindKeywordMode) ? EAknEditorFlagDefault : EAknEditorFlagLatinInputModesOnly) |EAknEditorFlagUseSCTNumericCharmap; |
|
234 |
|
235 // Always disable T9 input for goto url |
|
236 editorFlags = (editorFlags | EAknEditorFlagNoT9); |
|
237 |
|
238 iEditor->SetAknEditorFlags( editorFlags ); |
|
239 |
|
240 iEditor->SetAknEditorPermittedCaseModes ( EAknEditorUpperCase | |
|
241 EAknEditorLowerCase ); |
|
242 |
|
243 iGotoKeyHandled = new (ELeave) CBrowserKeyEventHandled( *this ); |
|
244 iAvkonAppUi->AddToStackL( iGotoKeyHandled, |
|
245 ECoeStackPriorityFep + 1, |
|
246 ECoeStackFlagRefusesFocus ); |
|
247 iEditor->SetEdwinObserver( iGotoKeyHandled ); |
|
248 iEditor->SetSkinBackgroundControlContextL(NULL); |
|
249 |
|
250 TBool searchFeature = iContentView->ApiProvider().Preferences().SearchFeature(); |
|
251 if ( searchFeature && !iFindKeywordMode ) |
|
252 { |
|
253 iDefaultSearchText = StringLoader::LoadL( R_IS_WEB_SEARCH ); |
|
254 ConstructSearchPaneL(); |
|
255 } |
|
256 |
|
257 //adaptive popuplist |
|
258 if ( aPopupListStatus && AUTOCOMP ) |
|
259 { |
|
260 iBAdaptiveListPopup = |
|
261 new (ELeave) CBrowserAdaptiveListPopup( iEditor, this, EGotoPane, searchFeature ); |
|
262 iBAdaptiveListPopup->ConstructL(); |
|
263 iEditor->SetObserver( iBAdaptiveListPopup ); |
|
264 if (iContentView) |
|
265 { |
|
266 iBAdaptiveListPopup->SetUrlSuffixList(iContentView->ApiProvider().Preferences().URLSuffixList()); |
|
267 iBAdaptiveListPopup->SetMaxRecentUrls(iContentView->ApiProvider().Preferences().MaxRecentUrls()); |
|
268 } |
|
269 } |
|
270 |
|
271 CCoeEnv::Static()->AddFepObserverL(static_cast<MCoeFepObserver &>(*this)); |
|
272 iPrevKeyword = KNullDesC().AllocL(); |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // CBrowserGotoPane::SetOrdinalPosition |
|
277 // --------------------------------------------------------------------------- |
|
278 // |
|
279 void CBrowserGotoPane::SetOrdinalPosition( TInt aPos ) |
|
280 { |
|
281 Window().SetOrdinalPosition( aPos ); |
|
282 if ( iBAdaptiveListPopup ) |
|
283 { |
|
284 iBAdaptiveListPopup->SetOrdinalPosition( aPos ); |
|
285 } |
|
286 } |
|
287 |
|
288 // --------------------------------------------------------------------------- |
|
289 // CBrowserGotoPane::HandleFindSizeChanged |
|
290 // --------------------------------------------------------------------------- |
|
291 // |
|
292 void CBrowserGotoPane::HandleFindSizeChanged() |
|
293 { |
|
294 |
|
295 if ( iSearchEditor && !iFindKeywordMode) |
|
296 { |
|
297 TRect clientRect = CBrowserAppUi::Static()->ClientRect(); |
|
298 TAknWindowLineLayout findWindow = AknLayout::popup_find_window(); |
|
299 |
|
300 TRect findWindowRect = AknLayoutUtils::RectFromCoords( clientRect,findWindow.il, findWindow.it, |
|
301 findWindow.ir, findWindow.ib, findWindow.iW, findWindow.iH); |
|
302 |
|
303 // Now Increase the height of rect to make room for two editors (Goto + search)// |
|
304 findWindowRect.iTl.iY -= ( findWindow.iH ); |
|
305 SetRect( findWindowRect ); |
|
306 } |
|
307 |
|
308 else if ( !AknLayoutUtils::PenEnabled() ) |
|
309 { |
|
310 |
|
311 TRect parentrect = iAvkonAppUi->ApplicationRect(); |
|
312 |
|
313 TAknLayoutRect lrect; |
|
314 lrect.LayoutRect( parentrect, |
|
315 AknLayout::main_pane( CBrowserAppUi::Static()->ApplicationRect(), 0, 1, 1 ) |
|
316 ); |
|
317 AknLayoutUtils::LayoutControl ( this, |
|
318 lrect.Rect(), |
|
319 AknLayout::popup_find_window() ); |
|
320 } |
|
321 else if( AknLayoutUtils::PenEnabled() ) |
|
322 { |
|
323 // The ClientRect() will be the application rectangle minus any |
|
324 // toolbars/menu bars etc. |
|
325 AknLayoutUtils::LayoutControl ( this, |
|
326 CBrowserAppUi::Static()->ClientRect(), |
|
327 AknLayout::popup_find_window() ); |
|
328 } |
|
329 |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------------------------- |
|
333 // CBrowserGotoPane::EnableKeyEventHandler |
|
334 // --------------------------------------------------------------------------- |
|
335 // |
|
336 void CBrowserGotoPane::EnableKeyEventHandlerL( TBool aEnable ) |
|
337 { |
|
338 iGotoKeyHandled->EnableL( aEnable ); |
|
339 } |
|
340 |
|
341 // --------------------------------------------------------------------------- |
|
342 // CBrowserGotoPane::HandleControlEventL |
|
343 // --------------------------------------------------------------------------- |
|
344 // |
|
345 void CBrowserGotoPane::HandleControlEventL ( CCoeControl* /*aControl*/, |
|
346 TCoeEvent aEventType ) |
|
347 { |
|
348 if ( iFindKeywordMode ) |
|
349 { |
|
350 if ( iEditor->AknEditorCurrentInputMode() == EAknEditorCalculatorNumberModeKeymap |
|
351 // When the user copies and paste's content to the find dialog, the editor |
|
352 // is in Text Input mode, The engine should still get the find keyword request |
|
353 || iEditor->AknEditorCurrentInputMode() == EAknEditorTextInputMode |
|
354 ) |
|
355 { |
|
356 if ( aEventType == MCoeControlObserver::EEventStateChanged ) |
|
357 { |
|
358 HBufC* newText = GetTextL(); |
|
359 if (!newText) |
|
360 { |
|
361 newText = KNullDesC().AllocL(); |
|
362 } |
|
363 |
|
364 if ( iPrevKeyword->Compare( *newText ) ) |
|
365 { |
|
366 delete iPrevKeyword; |
|
367 iPrevKeyword = NULL; |
|
368 iPrevKeyword = newText; |
|
369 // Find the typed keyword. |
|
370 iContentView->FindKeywordL( GetTextL() ); |
|
371 iHandleFEPFind = EFalse; |
|
372 } |
|
373 else |
|
374 { |
|
375 delete newText; |
|
376 } |
|
377 } |
|
378 } |
|
379 } |
|
380 |
|
381 switch (aEventType) |
|
382 { |
|
383 case EEventRequestFocus: |
|
384 { |
|
385 FocusChanged( EDrawNow ); |
|
386 break; |
|
387 } |
|
388 |
|
389 default: |
|
390 break; |
|
391 } |
|
392 } |
|
393 |
|
394 // ---------------------------------------------------------------------------- |
|
395 // CBrowserGotoPane::OfferKeyEventL |
|
396 // ---------------------------------------------------------------------------- |
|
397 // |
|
398 TKeyResponse CBrowserGotoPane::OfferKeyEventL |
|
399 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
400 { |
|
401 TKeyResponse resp = EKeyWasNotConsumed; |
|
402 |
|
403 if ( AknLayoutUtils::PenEnabled() |
|
404 && PopupList() |
|
405 && PopupList()->DrawableWindow()->OrdinalPosition() > 0 ) |
|
406 { |
|
407 PopupList()->SetOrdinalPosition(0); |
|
408 } |
|
409 |
|
410 if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape ) // Escape key event handling |
|
411 { |
|
412 CCoeEnv::Static()->AppUi()->RemoveFromStack( this ); |
|
413 if ( PopupList() ) |
|
414 { |
|
415 PopupList()->SetDirectoryModeL( ETrue ); |
|
416 PopupList()->HidePopupL(); |
|
417 } |
|
418 MakeVisible( EFalse ); // Hide Goto pane |
|
419 SetFocus( EFalse ); |
|
420 resp = EKeyWasConsumed; // should set the focus of container to ETrue...how? |
|
421 } |
|
422 |
|
423 if ( iFindKeywordMode ) |
|
424 { |
|
425 if ( iContentView->MenuBar()->MenuPane()->IsVisible() ) |
|
426 { |
|
427 return iContentView->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType ); |
|
428 } |
|
429 else |
|
430 { |
|
431 if ( aType == EEventKey ) // Handle up and down arow keys to search for |
|
432 { // next and previous keywords. |
|
433 |
|
434 if ( aKeyEvent.iCode == EKeyLeftUpArrow // Northwest |
|
435 || aKeyEvent.iCode == EStdKeyDevice10 // : Extra KeyEvent supports diagonal event simulator wedge |
|
436 || aKeyEvent.iCode == EKeyUpArrow // North |
|
437 || aKeyEvent.iCode == EKeyRightUpArrow // Northeast |
|
438 || aKeyEvent.iCode == EStdKeyDevice11 ) // : Extra KeyEvent supports diagonal event simulator wedge |
|
439 { // Any of those? If so, then... |
|
440 iContentView->FindKeywordL( NULL, EFalse ); // Find previous keyword |
|
441 iHandleFEPFind = EFalse; // : |
|
442 return EKeyWasConsumed; // And that consumes the key |
|
443 } |
|
444 |
|
445 if ( aKeyEvent.iCode == EKeyLeftDownArrow // Southwest |
|
446 || aKeyEvent.iCode == EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge |
|
447 || aKeyEvent.iCode == EKeyDownArrow // South |
|
448 || aKeyEvent.iCode == EKeyRightDownArrow // Southeast |
|
449 || aKeyEvent.iCode == EStdKeyDevice12 ) // : Extra KeyEvent supports diagonal event simulator wedge |
|
450 { // Any of those? If so, then... |
|
451 iContentView->FindKeywordL( NULL, ETrue ); // Find next keyword |
|
452 iHandleFEPFind = EFalse; // : |
|
453 return EKeyWasConsumed; // And that consumes the key |
|
454 } |
|
455 |
|
456 if ( aKeyEvent.iCode == EKeyDevice3 ) // Select key? |
|
457 { // If so, then... |
|
458 return EKeyWasConsumed; // Ignore select key |
|
459 } |
|
460 |
|
461 } |
|
462 return iEditor->OfferKeyEventL( aKeyEvent, aType ); // Otherwise, just pass the key on to the editor |
|
463 } |
|
464 } |
|
465 |
|
466 else // *NOT* iFindKeywordMode |
|
467 { |
|
468 |
|
469 if ( aKeyEvent.iCode == EKeyRightUpArrow // Northeast |
|
470 || aKeyEvent.iCode == EStdKeyDevice11 // : Extra KeyEvent supports diagonal event simulator wedge |
|
471 || aKeyEvent.iCode == EKeyRightDownArrow // Southeast |
|
472 || aKeyEvent.iCode == EStdKeyDevice12 // : Extra KeyEvent supports diagonal event simulator wedge |
|
473 || aKeyEvent.iCode == EKeyLeftDownArrow // Southwest |
|
474 || aKeyEvent.iCode == EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge |
|
475 || aKeyEvent.iCode == EKeyLeftUpArrow // Northwest |
|
476 || aKeyEvent.iCode == EStdKeyDevice10 ) // : Extra KeyEvent supports diagonal event simulator wedge |
|
477 { // Any of those? If so, then... |
|
478 return EKeyWasConsumed; // Ignore diagonal navigation events here |
|
479 } |
|
480 |
|
481 // For touch UI, handle enter key from VKB as a "GOTO" |
|
482 if (AknLayoutUtils::PenEnabled() && aKeyEvent.iCode == EKeyEnter) |
|
483 { |
|
484 CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo); |
|
485 return EKeyWasConsumed; |
|
486 } |
|
487 else if ( ((aKeyEvent.iCode == EKeyOK ) || (aKeyEvent.iCode == EKeyEnter)) |
|
488 && iGPObserver |
|
489 && IsFocused() ) |
|
490 { |
|
491 if ( CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsVisible() ) |
|
492 { |
|
493 return CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType ); |
|
494 } |
|
495 else |
|
496 { |
|
497 // If there is an observer and we have the focus, enter key is |
|
498 // consumed and observer is notified. |
|
499 iGPObserver->HandleGotoPaneEventL |
|
500 ( this, MGotoPaneObserver::EEventEnterKeyPressed ); |
|
501 return EKeyWasConsumed; |
|
502 } |
|
503 } |
|
504 |
|
505 if ( iSearchEditor && iSearchPaneActive ) |
|
506 { |
|
507 resp = iSearchEditor->OfferKeyEventL( aKeyEvent, aType ); |
|
508 } |
|
509 else |
|
510 { |
|
511 resp = iEditor->OfferKeyEventL( aKeyEvent, aType ); |
|
512 } |
|
513 |
|
514 if ((iBAdaptiveListPopup ) && (resp != EKeyWasConsumed)) |
|
515 { |
|
516 resp = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType ); |
|
517 } |
|
518 |
|
519 |
|
520 if ( iSearchEditor ) |
|
521 { |
|
522 if ( ( iGotoPaneActive || iSearchPaneActive) |
|
523 && (resp != EKeyWasConsumed) ) |
|
524 { |
|
525 |
|
526 if ( aKeyEvent.iCode == EKeyUpArrow ) |
|
527 { |
|
528 resp = EKeyWasConsumed; |
|
529 if ( iSearchPaneActive ) |
|
530 { |
|
531 SetGotoPaneActiveL(); |
|
532 |
|
533 #if defined(BRDO_SEARCH_INTEGRATION_FF) |
|
534 iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
535 #endif |
|
536 |
|
537 } |
|
538 } |
|
539 if ( aKeyEvent.iCode == EKeyDownArrow ) |
|
540 { |
|
541 resp = EKeyWasConsumed; |
|
542 if ( iGotoPaneActive ) |
|
543 { |
|
544 SetSearchPaneActiveL(); |
|
545 |
|
546 #if defined(BRDO_SEARCH_INTEGRATION_FF) |
|
547 iSearchEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
548 #endif |
|
549 |
|
550 } |
|
551 } |
|
552 } |
|
553 } |
|
554 |
|
555 } |
|
556 |
|
557 return resp; |
|
558 |
|
559 } |
|
560 |
|
561 // ---------------------------------------------------------------------------- |
|
562 // CBrowserGotoPane::HandlePointerEventL |
|
563 // ---------------------------------------------------------------------------- |
|
564 // |
|
565 void CBrowserGotoPane::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
566 { |
|
567 if ( !AknLayoutUtils::PenEnabled() ) |
|
568 { |
|
569 return; |
|
570 } |
|
571 |
|
572 // ponter is in goto pane |
|
573 if (Rect().Contains(aPointerEvent.iPosition)) |
|
574 { |
|
575 iGotoKeyHandled->EnableL(ETrue); |
|
576 |
|
577 // If search feature exists, check and route to appropriate editor // |
|
578 if ( iSearchEditor ) |
|
579 { |
|
580 if ( iSearchInputFrame->Rect().Contains(aPointerEvent.iPosition)) |
|
581 { |
|
582 if ( iSearchPaneActive ) |
|
583 { |
|
584 iSearchEditor->HandlePointerEventL(aPointerEvent); |
|
585 } |
|
586 else |
|
587 { |
|
588 SetSearchPaneActiveL(); |
|
589 } |
|
590 #if defined(BRDO_SEARCH_INTEGRATION_FF) |
|
591 iSearchEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB); |
|
592 #endif |
|
593 } |
|
594 else |
|
595 { |
|
596 if ( iGotoPaneActive ) |
|
597 { |
|
598 iEditor->HandlePointerEventL(aPointerEvent); |
|
599 } |
|
600 else |
|
601 { |
|
602 SetGotoPaneActiveL(); |
|
603 } |
|
604 #if defined(BRDO_SEARCH_INTEGRATION_FF) |
|
605 iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB); |
|
606 #endif |
|
607 } |
|
608 } |
|
609 else |
|
610 { |
|
611 iEditor->HandlePointerEventL(aPointerEvent); |
|
612 } |
|
613 iGotoKeyHandled->SetFirstKeyEvent(EFalse); |
|
614 } |
|
615 else |
|
616 { |
|
617 // pointer outside of control |
|
618 CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneCancel); |
|
619 } |
|
620 } |
|
621 |
|
622 // ---------------------------------------------------------------------------- |
|
623 // CBrowserGotoPane::CountComponentControls |
|
624 // ---------------------------------------------------------------------------- |
|
625 // |
|
626 TInt CBrowserGotoPane::CountComponentControls() const |
|
627 { |
|
628 if ( iSearchEditor && !iFindKeywordMode ) |
|
629 { |
|
630 return 4; // iEditor, input frame, SearchEditor and Searchinput frame. |
|
631 } |
|
632 return 2; // iEditor and input frame |
|
633 } |
|
634 |
|
635 // ---------------------------------------------------------------------------- |
|
636 // CBrowserGotoPane::ComponentControl |
|
637 // ---------------------------------------------------------------------------- |
|
638 // |
|
639 CCoeControl* CBrowserGotoPane::ComponentControl ( TInt aIndex ) const |
|
640 { |
|
641 switch(aIndex) |
|
642 { |
|
643 case 0: |
|
644 { |
|
645 return iInputFrame; |
|
646 } |
|
647 case 1: |
|
648 { |
|
649 return iEditor; |
|
650 } |
|
651 case 2: |
|
652 { |
|
653 return iSearchInputFrame; |
|
654 } |
|
655 case 3: |
|
656 { |
|
657 return iSearchEditor; |
|
658 } |
|
659 |
|
660 default: |
|
661 return NULL; |
|
662 } |
|
663 } |
|
664 |
|
665 // ---------------------------------------------------------------------------- |
|
666 // CBrowserGotoPane::SizeChanged |
|
667 // ---------------------------------------------------------------------------- |
|
668 // |
|
669 void CBrowserGotoPane::SizeChanged() |
|
670 { |
|
671 if (iSearchEditor && !iFindKeywordMode ) |
|
672 { |
|
673 // We need height and width of FindWindow |
|
674 TAknWindowLineLayout findWindow = AknLayout::popup_find_window(); |
|
675 TRect findWindowRect = AknLayoutUtils::RectFromCoords( Rect(), findWindow.il, |
|
676 findWindow.it, findWindow.ir, findWindow.ib, findWindow.iW, findWindow.iH); |
|
677 |
|
678 TSize gotoSize( findWindowRect.Size() ); |
|
679 TRect gotoRect( TPoint( 0,0 ), gotoSize ); |
|
680 iInputFrame->SetRect( gotoRect ); |
|
681 |
|
682 // Now set SearchPane right below GoTo pane // |
|
683 TRect searchRect( TPoint( 0, gotoRect.iBr.iY ), gotoSize ); |
|
684 iSearchInputFrame->SetRect( searchRect ); |
|
685 } |
|
686 else |
|
687 { |
|
688 iInputFrame->SetRect( Rect() ); |
|
689 } |
|
690 } |
|
691 |
|
692 // ---------------------------------------------------------------------------- |
|
693 // CBrowserGotoPane::FocusChanged |
|
694 // ---------------------------------------------------------------------------- |
|
695 // |
|
696 void CBrowserGotoPane::FocusChanged( TDrawNow aDrawNow ) |
|
697 { |
|
698 // this is a workaround |
|
699 TRAP_IGNORE( iGotoKeyHandled->EnableL( IsFocused() ) ); |
|
700 CCoeControl::FocusChanged( aDrawNow ); |
|
701 if ( iGotoPaneActive ) |
|
702 { |
|
703 iEditor->SetFocus( IsFocused() ); |
|
704 } |
|
705 else if ( iSearchEditor && !iFindKeywordMode && iSearchPaneActive ) |
|
706 { |
|
707 iSearchEditor->SetFocus( IsFocused() ); |
|
708 } |
|
709 } |
|
710 |
|
711 |
|
712 |
|
713 // ---------------------------------------------------------------------------- |
|
714 // CBrowserGotoPane::TextLength |
|
715 // ---------------------------------------------------------------------------- |
|
716 // |
|
717 TInt CBrowserGotoPane::SearchTextLength() const |
|
718 { |
|
719 TInt len = 0; |
|
720 if ( iSearchEditor ) |
|
721 { |
|
722 len = iSearchEditor->TextLength(); |
|
723 } |
|
724 return len; |
|
725 } |
|
726 |
|
727 // ---------------------------------------------------------------------------- |
|
728 // CBrowserGotoPane::TextLength |
|
729 // ---------------------------------------------------------------------------- |
|
730 // |
|
731 TInt CBrowserGotoPane::TextLength() const |
|
732 { |
|
733 return iEditor->TextLength(); |
|
734 } |
|
735 |
|
736 // ---------------------------------------------------------------------------- |
|
737 // CBrowserGotoPane::GetText |
|
738 // ---------------------------------------------------------------------------- |
|
739 // |
|
740 HBufC* CBrowserGotoPane::GetTextL() const |
|
741 { |
|
742 HBufC *retVal = NULL; |
|
743 |
|
744 if ( TextLength() |
|
745 || SearchTextLength() |
|
746 || iFindKeywordMode) |
|
747 { |
|
748 if ( iSearchEditor && iSearchPaneActive ) |
|
749 { |
|
750 retVal = HBufC::NewL( SearchTextLength() + 1 ); |
|
751 } |
|
752 else |
|
753 { |
|
754 retVal = HBufC::NewL( TextLength() + 1 ); |
|
755 } |
|
756 TPtr ptr = retVal->Des(); |
|
757 if ( iSearchEditor && iSearchPaneActive ) |
|
758 { |
|
759 iSearchEditor->GetText( ptr ); |
|
760 } |
|
761 else |
|
762 { |
|
763 iEditor->GetText( ptr ); |
|
764 } |
|
765 ptr.ZeroTerminate(); |
|
766 if ( !iFindKeywordMode && !iSearchPaneActive ) |
|
767 { |
|
768 Util::EncodeSpaces(retVal); |
|
769 } |
|
770 } |
|
771 |
|
772 return retVal; |
|
773 } |
|
774 |
|
775 |
|
776 // ---------------------------------------------------------------------------- |
|
777 // CBrowserGotoPane::SetSearchTextL |
|
778 // ---------------------------------------------------------------------------- |
|
779 // |
|
780 void CBrowserGotoPane::SetSearchTextL( const TDesC& aTxt ) |
|
781 { |
|
782 // for search pane, no default text |
|
783 if ( aTxt == KHttpString || aTxt == KWWWString) |
|
784 { |
|
785 iSearchEditor->SetTextL( &KNullDesC ); |
|
786 } |
|
787 else |
|
788 { |
|
789 iSearchEditor->SetTextL( &aTxt ); |
|
790 } |
|
791 TInt curPos = SearchTextLength(); |
|
792 // Cursor to end, no selection. |
|
793 iSearchEditor->SetSelectionL( curPos, curPos ); |
|
794 iSearchEditor->DrawNow(); |
|
795 } |
|
796 |
|
797 // ---------------------------------------------------------------------------- |
|
798 // CBrowserGotoPane::SetTextL |
|
799 // ---------------------------------------------------------------------------- |
|
800 // |
|
801 void CBrowserGotoPane::SetTextL( const TDesC& aTxt ) |
|
802 { |
|
803 iEditor->SetTextL( &aTxt ); |
|
804 TInt curPos = TextLength(); |
|
805 // Cursor to end, no selection. |
|
806 iEditor->SetSelectionL( curPos, curPos ); |
|
807 iEditor->DrawNow(); |
|
808 } |
|
809 |
|
810 // ---------------------------------------------------------------------------- |
|
811 // CBrowserGotoPane::SelectAllL |
|
812 // ---------------------------------------------------------------------------- |
|
813 // |
|
814 void CBrowserGotoPane::SelectAllL() |
|
815 { |
|
816 if ( iSearchEditor && iSearchPaneActive ) |
|
817 { |
|
818 iSearchEditor->SelectAllL(); |
|
819 } |
|
820 else |
|
821 { |
|
822 iEditor->SelectAllL(); |
|
823 } |
|
824 } |
|
825 |
|
826 // ---------------------------------------------------------------------------- |
|
827 // CBrowserGotoPane::SetInfoTextL |
|
828 // ---------------------------------------------------------------------------- |
|
829 // |
|
830 void CBrowserGotoPane::SetInfoTextL( const TDesC& aText ) |
|
831 { |
|
832 iInputFrame->SetInfoTextL( aText ); |
|
833 } |
|
834 |
|
835 // ---------------------------------------------------------------------------- |
|
836 // CBrowserGotoPane::ClipboardL |
|
837 // ---------------------------------------------------------------------------- |
|
838 // |
|
839 void CBrowserGotoPane::ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc ) |
|
840 { |
|
841 iEditor->ClipboardL( aClipboardFunc ); |
|
842 } |
|
843 |
|
844 // ---------------------------------------------------------------------------- |
|
845 // CBrowserGotoPane::Editor |
|
846 // ---------------------------------------------------------------------------- |
|
847 CEikEdwin* CBrowserGotoPane::Editor() const |
|
848 { |
|
849 return iEditor; |
|
850 } |
|
851 |
|
852 // ---------------------------------------------------------------------------- |
|
853 // CBrowserGotoPane::SetGPObserver |
|
854 // ---------------------------------------------------------------------------- |
|
855 // |
|
856 void CBrowserGotoPane::SetGPObserver( MGotoPaneObserver* aObserver ) |
|
857 { |
|
858 __ASSERT_DEBUG( !iGPObserver, \ |
|
859 Util::Panic( Util::EGotoPaneObserverAlreadySet ) ); |
|
860 iGPObserver = aObserver; |
|
861 } |
|
862 |
|
863 // ---------------------------------------------------------------------------- |
|
864 // CBrowserKeyEventHandled::CBrowserKeyEventHandled |
|
865 // ---------------------------------------------------------------------------- |
|
866 // |
|
867 CBrowserKeyEventHandled::CBrowserKeyEventHandled( |
|
868 CBrowserGotoPane& aGotoPane ) : |
|
869 iEnabled( EFalse ) |
|
870 ,iFirstKeyEvent( ETrue ) |
|
871 ,iLeftRightEvent ( EFalse ) |
|
872 ,iGotoPane( aGotoPane ) |
|
873 { |
|
874 } |
|
875 |
|
876 |
|
877 // ---------------------------------------------------------------------------- |
|
878 // CBrowserKeyEventHandled::OfferKeyEventL |
|
879 // ---------------------------------------------------------------------------- |
|
880 // |
|
881 TKeyResponse |
|
882 CBrowserKeyEventHandled::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
883 TEventCode aType) |
|
884 { |
|
885 TKeyResponse response( EKeyWasNotConsumed ); |
|
886 iLeftRightEvent = EFalse; |
|
887 |
|
888 if ( iEnabled && aType == EEventKey ) |
|
889 { |
|
890 switch( aKeyEvent.iCode ) |
|
891 { |
|
892 case EKeyUpArrow: |
|
893 case EKeyDownArrow: |
|
894 { |
|
895 iFirstKeyEvent = EFalse; |
|
896 break; |
|
897 } |
|
898 |
|
899 case EKeyLeftArrow: |
|
900 case EKeyRightArrow: |
|
901 { |
|
902 iFirstKeyEvent = EFalse; |
|
903 iLeftRightEvent = ETrue; |
|
904 |
|
905 // Below added to compensate for a weird key event situation: |
|
906 // For some reason the CBrowserGotoPane::OfferKeyEventL function |
|
907 // is not being called for an EEventKey when you press the left/right |
|
908 // arrows in the menupane produced to paste previously used special |
|
909 // chars (this is brought up by pressing the pen button on the phone). |
|
910 // This only happens when the cursor is in the first or last position in |
|
911 // the goto pane with text in it. |
|
912 // Therefore, in this particular scenario, we need to process the EEventKey |
|
913 // here since we will not be able to in CBrowserGotoPane::OfferKeyEventL |
|
914 if (CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsFocused()) |
|
915 { |
|
916 response = CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType ); |
|
917 } |
|
918 break; |
|
919 } |
|
920 |
|
921 case EKeyBackspace: |
|
922 case EKeyDelete: |
|
923 { |
|
924 if ( iFirstKeyEvent ) |
|
925 { |
|
926 iFirstKeyEvent = EFalse; |
|
927 iCoeEnv->SimulateKeyEventL( aKeyEvent, aType ); |
|
928 response = EKeyWasConsumed; |
|
929 } |
|
930 break; |
|
931 } |
|
932 |
|
933 default: |
|
934 { |
|
935 if ( iFirstKeyEvent ) |
|
936 { |
|
937 if ( TChar( aKeyEvent.iCode ).IsPrint() ) |
|
938 { |
|
939 iFirstKeyEvent = EFalse; |
|
940 response = EKeyWasConsumed; |
|
941 iCoeEnv->SimulateKeyEventL( aKeyEvent, aType ); |
|
942 } |
|
943 } |
|
944 break; |
|
945 } |
|
946 } |
|
947 // CBrowserAppUi::Static()->UpdateCbaL(); |
|
948 } |
|
949 return response; |
|
950 } |
|
951 |
|
952 // ---------------------------------------------------------------------------- |
|
953 // CBrowserKeyEventHandled::HandleEdwinEventL |
|
954 // ---------------------------------------------------------------------------- |
|
955 // |
|
956 void CBrowserKeyEventHandled::HandleEdwinEventL( CEikEdwin* /*aEdwin*/, |
|
957 TEdwinEvent aEventType ) |
|
958 { |
|
959 // if text changed in the editor we don't have to handle clear key anymore |
|
960 if ( aEventType == EEventTextUpdate ) |
|
961 { |
|
962 iFirstKeyEvent = EFalse; |
|
963 } |
|
964 } |
|
965 |
|
966 // ---------------------------------------------------------------------------- |
|
967 // CBrowserKeyEventHandled::EnableL |
|
968 // ---------------------------------------------------------------------------- |
|
969 // |
|
970 void CBrowserKeyEventHandled::EnableL( TBool aEnable ) |
|
971 { |
|
972 iEnabled = aEnable; |
|
973 } |
|
974 |
|
975 // ---------------------------------------------------------------------------- |
|
976 // CBrowserKeyEventHandled::Reset |
|
977 // ---------------------------------------------------------------------------- |
|
978 // |
|
979 void CBrowserKeyEventHandled::Reset() |
|
980 { |
|
981 iFirstKeyEvent = ETrue; |
|
982 } |
|
983 |
|
984 // --------------------------------------------------------------------------- |
|
985 // CBrowserGotoPane::PopupList |
|
986 // --------------------------------------------------------------------------- |
|
987 // |
|
988 CBrowserAdaptiveListPopup* CBrowserGotoPane::PopupList() |
|
989 { |
|
990 return iBAdaptiveListPopup; |
|
991 } |
|
992 // --------------------------------------------------------------------------- |
|
993 // CBrowserGotoPane::HandleResourceChange |
|
994 // --------------------------------------------------------------------------- |
|
995 // |
|
996 void CBrowserGotoPane::HandleResourceChange( |
|
997 TInt |
|
998 aType |
|
999 ) |
|
1000 { |
|
1001 CCoeControl::HandleResourceChange( aType ); |
|
1002 |
|
1003 if ( iBAdaptiveListPopup ) |
|
1004 { |
|
1005 iBAdaptiveListPopup->HandleResourceChange( aType ); |
|
1006 } |
|
1007 } |
|
1008 |
|
1009 // --------------------------------------------------------------------------- |
|
1010 // CBrowserGotoPane::HandleStartOfTransactionL() |
|
1011 // --------------------------------------------------------------------------- |
|
1012 // |
|
1013 void CBrowserGotoPane::HandleStartOfTransactionL() |
|
1014 { |
|
1015 } |
|
1016 |
|
1017 // --------------------------------------------------------------------------- |
|
1018 // CBrowserGotoPane::HandleCompletionOfTransactionL() |
|
1019 // --------------------------------------------------------------------------- |
|
1020 // |
|
1021 void CBrowserGotoPane::HandleCompletionOfTransactionL() |
|
1022 { |
|
1023 if ( iContentView && iFindKeywordMode && this->IsVisible() && |
|
1024 !iContentView->MenuBar()->MenuPane()->IsVisible() ) |
|
1025 { |
|
1026 if ( GetTextL() ) |
|
1027 { |
|
1028 // Find the typed keyword. |
|
1029 if ( iHandleFEPFind && iPrevKeyword->Compare(GetTextL()->Des()) ) |
|
1030 { |
|
1031 iContentView->FindKeywordL( GetTextL() ); |
|
1032 } |
|
1033 } |
|
1034 } |
|
1035 iHandleFEPFind = ETrue; |
|
1036 } |
|
1037 |
|
1038 // ---------------------------------------------------------------------------- |
|
1039 // CBrowserGotoPane::ActivateVKB |
|
1040 // ---------------------------------------------------------------------------- |
|
1041 void CBrowserGotoPane::ActivateVKB() |
|
1042 { |
|
1043 if ( ( iEditor && iEditor->TextView() ) |
|
1044 || ( iSearchEditor && iSearchEditor->TextView()) ) |
|
1045 { |
|
1046 // make sure observer is set |
|
1047 iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
|
1048 |
|
1049 // simulate pointer event to force VKB |
|
1050 |
|
1051 // first get point at cursor location |
|
1052 TInt pos = 0; |
|
1053 CTextView* textView = NULL; |
|
1054 if ( iSearchEditor && iSearchPaneActive ) |
|
1055 { |
|
1056 pos = iSearchEditor->CursorPos(); |
|
1057 textView = iSearchEditor->TextView(); |
|
1058 } |
|
1059 else |
|
1060 { |
|
1061 pos = iEditor->CursorPos(); |
|
1062 textView = iEditor->TextView(); |
|
1063 } |
|
1064 |
|
1065 TPoint curPos; |
|
1066 textView->DocPosToXyPosL(pos, curPos); |
|
1067 |
|
1068 TPointerEvent pe; |
|
1069 pe.iPosition = curPos; |
|
1070 |
|
1071 pe.iType = TPointerEvent::EButton1Down; |
|
1072 |
|
1073 TInt err(KErrNone); |
|
1074 if ( iSearchEditor && iSearchPaneActive ) |
|
1075 { |
|
1076 TRAP(err, iSearchEditor->HandlePointerEventL(pe)); |
|
1077 } |
|
1078 else |
|
1079 { |
|
1080 TRAP(err, iEditor->HandlePointerEventL(pe)); |
|
1081 } |
|
1082 |
|
1083 if (err != KErrNone) |
|
1084 { |
|
1085 return; |
|
1086 } |
|
1087 |
|
1088 pe.iType = TPointerEvent::EButton1Up; |
|
1089 |
|
1090 // VKB will only activate is nothing selected |
|
1091 if ( iSearchEditor && iSearchPaneActive ) |
|
1092 { |
|
1093 iSearchEditor->SetSelectionL(pos,pos); |
|
1094 TRAP_IGNORE(iSearchEditor->HandlePointerEventL(pe)); |
|
1095 } |
|
1096 else |
|
1097 { |
|
1098 iEditor->SetSelectionL(pos,pos); |
|
1099 TRAP_IGNORE(iEditor->HandlePointerEventL(pe)); |
|
1100 } |
|
1101 } |
|
1102 } |
|
1103 |
|
1104 // ---------------------------------------------------------------------------- |
|
1105 // CBrowserGotoPane::ConstructSearchPaneL |
|
1106 // ---------------------------------------------------------------------------- |
|
1107 void CBrowserGotoPane::ConstructSearchPaneL() |
|
1108 { |
|
1109 |
|
1110 TFileName iconFile; |
|
1111 TInt iconId = iContentView->ApiProvider().Preferences().GetIntValue( KBrowserSearchIconId ); |
|
1112 iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchIconPath, KMaxFileName, iconFile ); |
|
1113 |
|
1114 // If Icon File Path Changed or Icon Id Changed, Refresh the Icon for Search Pane. |
|
1115 // Comparing Icon File path as well, because it may be possible that two different |
|
1116 // Icon files have same icon id. |
|
1117 if ( iconId != iSearchIconId |
|
1118 || iSearchIconFilePath.Compare( iconFile ) != 0 ) |
|
1119 { |
|
1120 |
|
1121 TInt iconMaskId = iContentView->ApiProvider().Preferences().GetIntValue( KBrowserSearchIconMaskId ); |
|
1122 // Save IconId |
|
1123 iSearchIconId = iconId; |
|
1124 // Save Icon File |
|
1125 iSearchIconFilePath = iconFile; |
|
1126 |
|
1127 // No Icon file or IconId or IconMaskId set , then it means no search provider is still |
|
1128 // selected and set by search application, in that case we use the default icon for Search. |
|
1129 if ( ! iconFile.Length() |
|
1130 || iconId == -1 |
|
1131 || iconMaskId == -1 ) |
|
1132 { |
|
1133 iconId = EMbmAvkonQgn_indi_find_glass; |
|
1134 iconMaskId = EMbmAvkonQgn_indi_find_glass_mask; |
|
1135 iconFile = KAvkonBitmapFile; |
|
1136 } |
|
1137 |
|
1138 |
|
1139 if ( iSearchEditor ) |
|
1140 { |
|
1141 delete iSearchEditor; |
|
1142 iSearchEditor = NULL; |
|
1143 } |
|
1144 |
|
1145 if ( iSearchInputFrame ) |
|
1146 { |
|
1147 delete iSearchInputFrame; |
|
1148 iSearchInputFrame = NULL; |
|
1149 } |
|
1150 |
|
1151 |
|
1152 // iSearchEditor != NULL, implies presence of Search Feature, which can be |
|
1153 // used to validate search feature exsistence, avoiding unecessary feature |
|
1154 // check calls and need of separate variable. |
|
1155 iSearchEditor = new (ELeave) CEikGlobalTextEditor; |
|
1156 iSearchInputFrame = CAknInputFrame::NewL( |
|
1157 iSearchEditor, |
|
1158 EFalse, |
|
1159 iconFile, |
|
1160 iconId, |
|
1161 iconMaskId, |
|
1162 CAknInputFrame::EPopupLayout ); |
|
1163 |
|
1164 iSearchInputFrame->SetContainerWindowL( *this); |
|
1165 AknEditUtils::ConstructEditingL ( iSearchEditor, |
|
1166 KFavouritesMaxUrlGotoPaneDefine, |
|
1167 1, |
|
1168 EAknEditorCharactersLowerCase, |
|
1169 EAknEditorAlignRight, |
|
1170 EFalse, |
|
1171 ETrue, |
|
1172 EFalse ); |
|
1173 |
|
1174 iSearchEditor->SetContainerWindowL( *this ); |
|
1175 iSearchEditor->SetObserver( this ); |
|
1176 iSearchEditor->SetBorder( TGulBorder::ENone ); |
|
1177 iSearchEditor->SetAknEditorCase( EAknEditorLowerCase ); |
|
1178 iSearchEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
|
1179 |
|
1180 if (AVKONAPAC) |
|
1181 { |
|
1182 // Disallow chinese input. |
|
1183 iSearchEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | |
|
1184 EAknEditorNumericInputMode ); |
|
1185 } |
|
1186 |
|
1187 //Search should use EAknEditorFlagDefault as search allows all types of input |
|
1188 iSearchEditor->SetAknEditorFlags |
|
1189 ( EAknEditorFlagDefault | EAknEditorFlagUseSCTNumericCharmap ); |
|
1190 |
|
1191 iSearchEditor->SetAknEditorPermittedCaseModes ( EAknEditorUpperCase | |
|
1192 EAknEditorLowerCase ); |
|
1193 |
|
1194 iSearchEditor->SetEdwinObserver( iGotoKeyHandled ); |
|
1195 iSearchEditor->SetSkinBackgroundControlContextL(NULL); |
|
1196 iSearchEditor->MakeVisible( ETrue ); |
|
1197 iSearchInputFrame->MakeVisible( ETrue ); |
|
1198 // Set the default text if not active// |
|
1199 if ( ! iSearchPaneActive ) |
|
1200 { |
|
1201 HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength ); |
|
1202 TPtr searchProviderPtr = searchProvider->Des(); |
|
1203 iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle, |
|
1204 KMaxTitleLength , searchProviderPtr); |
|
1205 if( searchProvider->Length() == 0 ) |
|
1206 { |
|
1207 SetSearchTextL( *iDefaultSearchText ); |
|
1208 } |
|
1209 else |
|
1210 { |
|
1211 SetSearchTextL( *searchProvider ); |
|
1212 delete iDefaultSearchText; |
|
1213 iDefaultSearchText = NULL; |
|
1214 iDefaultSearchText = searchProvider->AllocL(); |
|
1215 } |
|
1216 CleanupStack::PopAndDestroy(searchProvider); |
|
1217 } |
|
1218 iSearchInputFrame->ActivateL(); |
|
1219 } |
|
1220 |
|
1221 } |
|
1222 |
|
1223 // ---------------------------------------------------------------------------- |
|
1224 // CBrowserGotoPane::SetGotoPaneActive |
|
1225 // ---------------------------------------------------------------------------- |
|
1226 void CBrowserGotoPane::SetGotoPaneActiveL() |
|
1227 { |
|
1228 |
|
1229 iGotoPaneActive = ETrue; |
|
1230 iSearchPaneActive = EFalse; |
|
1231 |
|
1232 if ( iSearchEditor ) |
|
1233 { |
|
1234 #if defined(BRDO_SEARCH_INTEGRATION_FF) |
|
1235 iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
1236 #endif |
|
1237 // if searchpane is empty add default text |
|
1238 if ( !SearchTextLength() ) |
|
1239 { |
|
1240 HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength ); |
|
1241 TPtr searchProviderPtr = searchProvider->Des(); |
|
1242 iContentView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle, |
|
1243 KMaxTitleLength , searchProviderPtr); |
|
1244 if( searchProvider->Length() == 0 ) |
|
1245 { |
|
1246 SetSearchTextL( *iDefaultSearchText ); |
|
1247 } |
|
1248 else |
|
1249 { |
|
1250 SetSearchTextL( *searchProvider ); |
|
1251 } |
|
1252 CleanupStack::PopAndDestroy(searchProvider); |
|
1253 } |
|
1254 |
|
1255 // if gotopane is empty add default text |
|
1256 if ( !TextLength() ) |
|
1257 { |
|
1258 SetTextL( KWWWString ); |
|
1259 } |
|
1260 |
|
1261 iSearchEditor->SetFocus( EFalse); |
|
1262 } |
|
1263 |
|
1264 iEditor->SetFocus( ETrue ); |
|
1265 CBrowserAppUi::Static()->UpdateCbaL(); |
|
1266 SetTextModeItalicL(); |
|
1267 iEditor->SetCursorPosL(iEditor->TextLength(), EFalse); |
|
1268 DrawDeferred(); |
|
1269 } |
|
1270 |
|
1271 // ---------------------------------------------------------------------------- |
|
1272 // CBrowserGotoPane::SetSearchPaneActive |
|
1273 // ---------------------------------------------------------------------------- |
|
1274 void CBrowserGotoPane::SetSearchPaneActiveL() |
|
1275 { |
|
1276 |
|
1277 if ( iSearchEditor ) |
|
1278 { |
|
1279 #if defined(BRDO_SEARCH_INTEGRATION_FF) |
|
1280 iSearchEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
1281 #endif |
|
1282 // if gotopane is empty add default text |
|
1283 if ( !TextLength() ) |
|
1284 { |
|
1285 SetTextL( KWWWString ); |
|
1286 } |
|
1287 |
|
1288 // if searchpane has default text remove it |
|
1289 HBufC* text = iSearchEditor->GetTextInHBufL(); |
|
1290 if ( text ) |
|
1291 { |
|
1292 CleanupStack::PushL( text ); |
|
1293 if ( !text->Compare( iDefaultSearchText->Des() ) ) |
|
1294 { |
|
1295 SetSearchTextL( KNullDesC ); |
|
1296 } |
|
1297 |
|
1298 CleanupStack::PopAndDestroy( text ); |
|
1299 } |
|
1300 |
|
1301 iSearchPaneActive = ETrue; |
|
1302 iGotoPaneActive = EFalse; |
|
1303 iEditor->SetFocus( EFalse ); |
|
1304 if ( iBAdaptiveListPopup ) |
|
1305 iBAdaptiveListPopup->HidePopupL(); |
|
1306 iSearchEditor->SetFocus( ETrue ); |
|
1307 iSearchEditor->SetCursorPosL(iSearchEditor->TextLength(), EFalse); |
|
1308 CBrowserAppUi::Static()->UpdateCbaL(); |
|
1309 |
|
1310 SetTextModeItalicL(); |
|
1311 DrawDeferred(); |
|
1312 } |
|
1313 } |
|
1314 |
|
1315 |
|
1316 // ---------------------------------------------------------------------------- |
|
1317 // CBrowserBookmarksGotoPane::SetTextModeItalic |
|
1318 // ---------------------------------------------------------------------------- |
|
1319 void CBrowserGotoPane::SetTextModeItalicL() |
|
1320 { |
|
1321 |
|
1322 // Editor Control is laid in a scalable way, so we need to get the correct font |
|
1323 // specification for setting CharFormatLayer, We could have used GetNearestFontInTwips, |
|
1324 // as done above in SetTextL() but it does not provide correct fonts for editor. |
|
1325 // We do not need to set the FontPosture back to EPostureUpright ( Normal ), as it |
|
1326 // is automatically handled by AknLayoutUtils::LayoutEdwinScalable called by |
|
1327 // iInputFrame->SetRect(), which overwrites all the properties for Editor. |
|
1328 if ( iSearchEditor ) |
|
1329 { |
|
1330 TAknTextComponentLayout editorLayout; |
|
1331 TBool apac( AknLayoutUtils::Variant() == EApacVariant && ( CAknInputFrame::EShowIndicators ) ); |
|
1332 editorLayout = AknLayoutScalable_Avkon::input_popup_find_pane_t1( apac ? 2 : 0 ); |
|
1333 TAknTextLineLayout lineLayout = editorLayout.LayoutLine(); |
|
1334 TInt fontid = lineLayout.FontId(); |
|
1335 const CAknLayoutFont *font = AknLayoutUtils::LayoutFontFromId( fontid ); |
|
1336 |
|
1337 TCharFormat charFormat; |
|
1338 TCharFormatMask charFormatMask; |
|
1339 charFormat.iFontSpec = font->FontSpecInTwips(); |
|
1340 charFormat.iFontSpec.iFontStyle.SetPosture( EPostureItalic ); |
|
1341 charFormatMask.SetAttrib(EAttFontTypeface); |
|
1342 charFormatMask.SetAttrib(EAttFontHeight); |
|
1343 charFormatMask.SetAttrib(EAttFontStrokeWeight); |
|
1344 charFormatMask.SetAttrib(EAttFontPosture); |
|
1345 |
|
1346 // Owner ship of charFormatLayer is taken by Editor |
|
1347 CCharFormatLayer* charFormatLayerItalics = NULL; |
|
1348 CCharFormatLayer* charFormatLayerUpright = NULL; |
|
1349 charFormatLayerItalics = CCharFormatLayer::NewL(charFormat,charFormatMask); |
|
1350 charFormat.iFontSpec.iFontStyle.SetPosture( EPostureUpright ); |
|
1351 charFormatLayerUpright = CCharFormatLayer::NewL(charFormat,charFormatMask); |
|
1352 if ( iSearchPaneActive ) |
|
1353 { |
|
1354 iSearchEditor->SetCharFormatLayer(charFormatLayerUpright); |
|
1355 iEditor->SetCharFormatLayer(charFormatLayerItalics); |
|
1356 } |
|
1357 else |
|
1358 { |
|
1359 iSearchEditor->SetCharFormatLayer(charFormatLayerItalics); |
|
1360 iEditor->SetCharFormatLayer(charFormatLayerUpright); |
|
1361 } |
|
1362 } |
|
1363 } |
|
1364 |
|
1365 |
|
1366 // END OF FILE |
|