1 /* |
|
2 * Copyright (c) 2002-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 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 * Implementation of CBrowserBookmarksGotoPane. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <Browser_Platform_Variant.hrh> |
|
23 |
|
24 #include <akninfrm.h> |
|
25 #include <eikedwin.h> |
|
26 #include <favouriteslimits.h> |
|
27 |
|
28 #include <aknconsts.h> |
|
29 #include <akneditstateindicator.h> |
|
30 #include <AknsListBoxBackgroundControlContext.h> |
|
31 #include <AknsFrameBackgroundControlContext.h> |
|
32 |
|
33 #include <BrowserNG.rsg> |
|
34 |
|
35 #include <AknsUtils.h> |
|
36 #include <AppApacLayout.cdl.h> |
|
37 #include <AppLayout.cdl.h> |
|
38 #include <AknLayout.cdl.h> |
|
39 |
|
40 #include "BrowserBookmarksGotoPane.h" |
|
41 #include "BrowserUtil.h" |
|
42 #include "commonconstants.h" |
|
43 #include "BrowserAdaptiveListPopup.h" |
|
44 #include "WmlBrowserBuild.h" //feature manager |
|
45 #include "browser.hrh" |
|
46 #include "BrowserAppUi.h" |
|
47 #include "BrowserFavouritesView.h" |
|
48 #include "Preferences.h" |
|
49 #include <Featmgr.h> |
|
50 #include "BrowserUiSDKCRKeys.h" |
|
51 |
|
52 #include <eikpriv.rsg> |
|
53 #include <BARSREAD.H> |
|
54 |
|
55 #include <AknLayout2ScalableDef.h> |
|
56 #include <aknlayoutfont.h> |
|
57 #include <aknlayoutscalable_avkon.cdl.h> |
|
58 |
|
59 #include <StringLoader.h> |
|
60 #include <skinlayout.cdl.h> |
|
61 using namespace SkinLayout; |
|
62 |
|
63 // CONSTANTS |
|
64 const TInt EUseSkinContext = 0x01; |
|
65 const TInt EParentAbsolute = 0x02; |
|
66 const TInt KRightSpace = 10; //space in pixels left at the end of text editor. |
|
67 // CONSTANTS |
|
68 const TInt KMaxTitleLength = 512; |
|
69 _LIT(KAddressText,"http://www."); |
|
70 |
|
71 // ================= MEMBER FUNCTIONS ======================= |
|
72 |
|
73 // --------------------------------------------------------- |
|
74 // CBrowserBookmarksGotoPane::NewL |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 CBrowserBookmarksGotoPane* CBrowserBookmarksGotoPane::NewL |
|
78 ( |
|
79 const CCoeControl& aParent, |
|
80 CBrowserFavouritesView* aContentView, |
|
81 const TDesC& aBitmapfile, |
|
82 TInt aIconBitmapId, |
|
83 TInt aIconMaskId, |
|
84 TBool aPopupListStatus, |
|
85 TBool aSearchPaneMode |
|
86 ) |
|
87 { |
|
88 CBrowserBookmarksGotoPane* gotoPane = |
|
89 new(ELeave) CBrowserBookmarksGotoPane(aContentView, aSearchPaneMode); |
|
90 CleanupStack::PushL( gotoPane ); |
|
91 gotoPane->ConstructL( aParent, aBitmapfile, aIconBitmapId, aIconMaskId, aPopupListStatus ); |
|
92 CleanupStack::Pop(); // gotoPane |
|
93 return gotoPane; |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------- |
|
97 // CBrowserBookmarksGotoPane::~CBrowserBookmarksGotoPane |
|
98 // --------------------------------------------------------- |
|
99 // |
|
100 CBrowserBookmarksGotoPane::~CBrowserBookmarksGotoPane() |
|
101 { |
|
102 delete iEditor; |
|
103 delete iInputFrame; |
|
104 delete iSkinContext; |
|
105 delete iInputContext; |
|
106 delete iBAdaptiveListPopup; |
|
107 delete iDefaultSearchText; |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------- |
|
111 // CBrowserBookmarksGotoPane::BeginEditingL() |
|
112 // --------------------------------------------------------- |
|
113 // |
|
114 void CBrowserBookmarksGotoPane::BeginEditingL() |
|
115 { |
|
116 if ( !iFrozen ) |
|
117 { |
|
118 // If its a GoTo Pane Mode. |
|
119 if( !iSearchPaneMode ) |
|
120 { |
|
121 if( iView->ApiProvider().Preferences().SearchFeature() ) |
|
122 { |
|
123 // If there is no text, then we need to place back |
|
124 // the default text, else preserve the previously |
|
125 // typed text. |
|
126 HBufC* text = iEditor->GetTextInHBufL(); |
|
127 if( !text ) |
|
128 { |
|
129 SetTextL( KWWWString ); |
|
130 } |
|
131 else |
|
132 { |
|
133 delete text; |
|
134 } |
|
135 } |
|
136 else |
|
137 SetTextL( KWWWString ); |
|
138 } |
|
139 else |
|
140 { |
|
141 if( iView->ApiProvider().Preferences().SearchFeature() ) |
|
142 { |
|
143 //Clear searchpane on focus if default text is there |
|
144 HBufC* text = iEditor->GetTextInHBufL(); |
|
145 if ( text ) |
|
146 { |
|
147 CleanupStack::PushL( text ); |
|
148 if ( !text->Compare( iDefaultSearchText->Des() ) ) |
|
149 { |
|
150 iEditor->SetTextL( &KNullDesC ); |
|
151 } |
|
152 CleanupStack::PopAndDestroy( text ); |
|
153 } |
|
154 } |
|
155 } |
|
156 |
|
157 MakeVisible( ETrue ); |
|
158 SetEditingL( ETrue ); |
|
159 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
|
160 if (AknLayoutUtils::PenEnabled() |
|
161 && ( !iView->ApiProvider().Preferences().SearchFeature()) ) |
|
162 { |
|
163 ActivateVkbL(); |
|
164 } |
|
165 } |
|
166 } |
|
167 |
|
168 // --------------------------------------------------------- |
|
169 // CBrowserBookmarksGotoPane::CancelEditingL() |
|
170 // --------------------------------------------------------- |
|
171 // |
|
172 void CBrowserBookmarksGotoPane::CancelEditingL() |
|
173 { |
|
174 if ( !iFrozen ) |
|
175 { |
|
176 // Clear selection when focus moved, only |
|
177 // affects when both the editors are visible. |
|
178 // no need for condition. |
|
179 TInt pos = iEditor->CursorPos(); |
|
180 iEditor->SetSelectionL(pos,pos); |
|
181 SetEditingL( EFalse ); |
|
182 |
|
183 // Cancel Adaptive List popup if its active |
|
184 if ( NULL != iBAdaptiveListPopup) |
|
185 { |
|
186 iBAdaptiveListPopup->SetDirectoryModeL( ETrue ); |
|
187 iBAdaptiveListPopup->HidePopupL(); |
|
188 } |
|
189 } |
|
190 |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------- |
|
194 // CBrowserBookmarksGotoPane::SetTextL |
|
195 // --------------------------------------------------------- |
|
196 // |
|
197 void CBrowserBookmarksGotoPane::SetTextL |
|
198 ( const TDesC& aText, TBool aClipToFit /*=ETrue*/, TBool aCancelEditing ) |
|
199 { |
|
200 |
|
201 CFbsFont * font = NULL; |
|
202 |
|
203 if ( !iFrozen ) |
|
204 { |
|
205 if ( aClipToFit && aText.Length() ) |
|
206 { |
|
207 // Allocate 3 chars more (make sure "..." fits). |
|
208 HBufC* buf = HBufC::NewLC( aText.Length() + 3 ); |
|
209 *buf = aText; |
|
210 TPtr ptr( buf->Des() ); |
|
211 CTextView* textView = iEditor->TextView(); |
|
212 if ( textView ) |
|
213 { |
|
214 //The Textview does not use the iConEnv->NormalFont() for drawing so we can not use it for measurement. |
|
215 //Textview uses the default char format font for drawing. See bug: EHCN-6U59SN |
|
216 TBuf<KMaxTypefaceNameLength> typeface; |
|
217 CEikonEnv::Static()->ReadResource(typeface,R_EIK_DEFAULT_CHAR_FORMAT_TYPEFACE); |
|
218 TResourceReader reader; |
|
219 CEikonEnv::Static()->CreateResourceReaderLC(reader,R_EIK_DEFAULT_CHAR_FORMAT_HEIGHT); |
|
220 TInt height = reader.ReadInt16(); |
|
221 CleanupStack::PopAndDestroy(); // reader |
|
222 |
|
223 TFontSpec fontSpec(typeface, height); |
|
224 CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips((CFont*&)font, fontSpec); |
|
225 |
|
226 AknTextUtils::ClipToFit |
|
227 ( |
|
228 ptr, |
|
229 *font, |
|
230 textView->ViewRect().Width() - KRightSpace |
|
231 ); |
|
232 } |
|
233 iEditor->SetTextL( &ptr ); |
|
234 CleanupStack::PopAndDestroy(); // buf |
|
235 } |
|
236 else |
|
237 { |
|
238 if( iSearchPaneMode ) |
|
239 { |
|
240 iEditor->SetTextL( &aText ); |
|
241 } |
|
242 else |
|
243 { |
|
244 if ( aText.Length() ) |
|
245 { |
|
246 iEditor->SetTextL( &aText ); |
|
247 } |
|
248 else |
|
249 { |
|
250 TBufC<16> buf(KAddressText); |
|
251 HBufC* tmpBuf = NULL; |
|
252 tmpBuf = buf.AllocLC(); |
|
253 iEditor->SetTextL( tmpBuf ); |
|
254 CleanupStack::PopAndDestroy(); // tmpBuf |
|
255 } |
|
256 } |
|
257 } |
|
258 |
|
259 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
|
260 if ( !iEverFocused ) |
|
261 { |
|
262 iEditor->SetFocus( ETrue ); |
|
263 } |
|
264 |
|
265 if ( !iEverFocused ) |
|
266 { |
|
267 iEditor->SetFocus( IsFocused() ); |
|
268 iEverFocused = ETrue; |
|
269 } |
|
270 SetEditingL( !aCancelEditing ); |
|
271 DrawDeferred(); |
|
272 } |
|
273 |
|
274 // release font if it was used |
|
275 if (font != NULL) |
|
276 { |
|
277 CEikonEnv::Static()->ScreenDevice()->ReleaseFont(font); |
|
278 } |
|
279 |
|
280 } |
|
281 |
|
282 // --------------------------------------------------------- |
|
283 // CBrowserBookmarksGotoPane::GetTextL |
|
284 // --------------------------------------------------------- |
|
285 // |
|
286 HBufC* CBrowserBookmarksGotoPane::GetTextL() |
|
287 { |
|
288 HBufC* text = HBufC::NewL( iEditor->TextLength() + 1 ); |
|
289 TPtr ptr = text->Des(); |
|
290 iEditor->GetText( ptr ); |
|
291 ptr.ZeroTerminate(); |
|
292 if( !iSearchPaneMode ) |
|
293 { |
|
294 Util::EncodeSpaces(text); |
|
295 } |
|
296 |
|
297 return text; |
|
298 } |
|
299 |
|
300 // --------------------------------------------------------- |
|
301 // CBrowserBookmarksGotoPane::SetObserver |
|
302 // --------------------------------------------------------- |
|
303 // |
|
304 void CBrowserBookmarksGotoPane::SetGPObserver |
|
305 ( MBookmarksGotoPaneObserver* aObserver ) |
|
306 { |
|
307 /*__ASSERT_DEBUG( !iGPObserver, \ |
|
308 Util::Panic( Util::EGotoPaneObserverAlreadySet ) );*/ |
|
309 iGPObserver = aObserver; |
|
310 } |
|
311 |
|
312 // --------------------------------------------------------- |
|
313 // CBrowserBookmarksGotoPane::SetLineState |
|
314 // --------------------------------------------------------- |
|
315 // |
|
316 void CBrowserBookmarksGotoPane::SetLineState( TBool aLineVisible ) |
|
317 { |
|
318 iInputFrame->SetLineState( aLineVisible ); |
|
319 } |
|
320 |
|
321 // --------------------------------------------------------- |
|
322 // CBrowserBookmarksGotoPane::OfferKeyEventL |
|
323 // --------------------------------------------------------- |
|
324 // |
|
325 // Note: |
|
326 // |
|
327 // Below, there are several keys in the ISO-Latin-1 range that we |
|
328 // exclude from use in a URL: |
|
329 // |
|
330 // - EStdKeyDevice10 0xC9 E-accent acute Northwest |
|
331 // - EStdKeyDevice11 0xCA E-accent circumflex Northeast |
|
332 // - EStdKeyDevice12 0xCB E-umlaut Southeast |
|
333 // - EStdKeyDevice13 0xCC I-accent grave Southwest |
|
334 // |
|
335 // While these ought to be vaguely acceptable in certain parts of a URL, |
|
336 // they are also used by some navigation drivers as our "diagonal event" |
|
337 // codes so turn up as the user navigates the cursor. Because of this, |
|
338 // today, we prevent them from being inserted as characters. There's |
|
339 // a second set of code ranges (in the 0x8XXX range) that's also defined |
|
340 // for these events; if the driver writers ever manage to get all of |
|
341 // the navigation drivers using this "out-of-band" range, we can |
|
342 // eliminate filtering the ISO-Latin-1 range of characters that we |
|
343 // do here. |
|
344 // |
|
345 // |
|
346 |
|
347 TKeyResponse CBrowserBookmarksGotoPane::OfferKeyEventL |
|
348 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
349 { |
|
350 TKeyResponse response = EKeyWasNotConsumed; |
|
351 TChar iInputChar = TChar( aKeyEvent.iScanCode ); |
|
352 |
|
353 |
|
354 if ( iBAdaptiveListPopup ) |
|
355 { |
|
356 response = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType ); |
|
357 } |
|
358 |
|
359 if ( iEditing && response != EKeyWasConsumed) |
|
360 { |
|
361 // Editing; most keys simply forwarded to the editor. |
|
362 switch ( aKeyEvent.iCode ) |
|
363 { |
|
364 case EKeyOK: |
|
365 { |
|
366 response = EKeyWasConsumed; // MSK is now handled through HandleCommand in BrowserBookmarksView |
|
367 break; |
|
368 } |
|
369 |
|
370 case EKeyRightUpArrow: // Northeast |
|
371 case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge |
|
372 case EKeyRightDownArrow: // Southeast |
|
373 case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge |
|
374 case EKeyLeftDownArrow: // Southwest |
|
375 case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge |
|
376 case EKeyLeftUpArrow: // Northwest |
|
377 case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge |
|
378 { // Here, "eat" all of the diagonals so they have no effect... |
|
379 response = EKeyWasConsumed; |
|
380 break; |
|
381 } |
|
382 |
|
383 case EKeyEnter: |
|
384 // Handle EnterKey as "GOTO" for Touch, VKB's enter key |
|
385 if ( AknLayoutUtils::PenEnabled() ) |
|
386 { |
|
387 CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo); |
|
388 // In case of search feature, we need to pass EKeyWasConsumed for EKeyEnter |
|
389 if ( iView->ApiProvider().Preferences().SearchFeature() ) |
|
390 { |
|
391 response = EKeyWasConsumed; |
|
392 } |
|
393 break; |
|
394 } |
|
395 |
|
396 // Else *FALL THROUGH* to default in case Pen is not enabled. |
|
397 default: |
|
398 { |
|
399 response = iEditor->OfferKeyEventL(aKeyEvent, aType ); |
|
400 break; |
|
401 } |
|
402 } |
|
403 |
|
404 // In the absence of search feature |
|
405 // Force key event to be consumed if you're editing |
|
406 // regardless of what's happened to it. |
|
407 // |
|
408 // This forces user to press cancel to continue other tasks |
|
409 if ( !iView->ApiProvider().Preferences().SearchFeature() ) |
|
410 { |
|
411 response = EKeyWasConsumed; |
|
412 } |
|
413 } |
|
414 else if ( response != EKeyWasConsumed ) |
|
415 { |
|
416 // Key consumed yet? If not, process onwards... |
|
417 if ( (aKeyEvent.iScanCode == EStdKeyHash) || |
|
418 ( aKeyEvent.iModifiers & |
|
419 ( EModifierShift | EModifierLeftShift | EModifierRightShift | |
|
420 EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) ) |
|
421 { |
|
422 |
|
423 // Hash key press will be used for Mark/UnMark functionality |
|
424 // Let Platform Listbox handle this. |
|
425 response = EKeyWasNotConsumed; |
|
426 } |
|
427 |
|
428 // |
|
429 // Not currently editing the GoTo pane. |
|
430 // Catch alpha and numeric to pop |
|
431 // up goto pane |
|
432 // |
|
433 // Only popup the GoTo Pane with a KeyDown event. |
|
434 // Otherwise, if browser is pushed to the backround (but still active) |
|
435 // in favor of the App Shell, A long "0" press will reactivate the browser and |
|
436 // leave a KeyUp to (wrongly) pop the pane up |
|
437 // |
|
438 // Note that we exclude Unicode 0xC4 and 0xC5 which |
|
439 // are defined as EStdkeyYes and EStdkeyNo. These |
|
440 // map to the Send and End keys respectively. Normally, |
|
441 // 0xC4 and 0xC5 can be considered alpha digits, but we |
|
442 // exclude them so that they will not pop the GoTo pane |
|
443 // |
|
444 // We do the same thing for all of the diagonal motion events |
|
445 // so they have no effect either. |
|
446 // |
|
447 // Otherwise, key event is generated again (to channel through FEP) |
|
448 // |
|
449 else if ( !iFrozen |
|
450 && aType == EEventKeyDown |
|
451 && iInputChar.IsAlphaDigit() // We want alpha numeric keys to popup goto pane |
|
452 && iInputChar != EStdKeyYes // Ignore Send (green key) |
|
453 && iInputChar != EStdKeyNo // Ignore End (red key) |
|
454 && iInputChar != EKeyRightUpArrow // Ignore Northeast |
|
455 && iInputChar != EStdKeyDevice11 // : Extra KeyEvent supports diagonal event simulator wedge |
|
456 && iInputChar != EKeyRightDownArrow // Ignore Southeast |
|
457 && iInputChar != EStdKeyDevice12 // : Extra KeyEvent supports diagonal event simulator wedge |
|
458 && iInputChar != EKeyLeftDownArrow // Ignore Southwest |
|
459 && iInputChar != EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge |
|
460 && iInputChar != EKeyLeftUpArrow // Ignore Northwest |
|
461 && iInputChar != EStdKeyDevice10 ) // : Extra KeyEvent supports diagonal event simulator wedge |
|
462 { |
|
463 // These keys activate the Goto Pane. |
|
464 // We'll consume the key event so it ends here |
|
465 response = EKeyWasConsumed; |
|
466 |
|
467 BeginEditingL(); |
|
468 |
|
469 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
|
470 iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
|
471 iCoeEnv->SimulateKeyEventL( aKeyEvent, aType ); |
|
472 } |
|
473 else |
|
474 { |
|
475 // Other keys do not activate the Goto Pane. |
|
476 // Let someone else take the key event |
|
477 response = EKeyWasNotConsumed; |
|
478 } |
|
479 } |
|
480 return response; |
|
481 } |
|
482 |
|
483 // --------------------------------------------------------- |
|
484 // CBrowserBookmarksGotoPane::CountComponentControls |
|
485 // --------------------------------------------------------- |
|
486 // |
|
487 TInt CBrowserBookmarksGotoPane::CountComponentControls() const |
|
488 { |
|
489 return 2; |
|
490 } |
|
491 |
|
492 // --------------------------------------------------------- |
|
493 // CBrowserBookmarksGotoPane::ComponentControl |
|
494 // --------------------------------------------------------- |
|
495 // |
|
496 CCoeControl* CBrowserBookmarksGotoPane::ComponentControl |
|
497 ( TInt aIndex ) const |
|
498 { |
|
499 switch ( aIndex ) |
|
500 { |
|
501 case 0: |
|
502 { |
|
503 return iInputFrame; |
|
504 } |
|
505 |
|
506 case 1: |
|
507 { |
|
508 return iEditor; |
|
509 } |
|
510 |
|
511 default: |
|
512 { |
|
513 return NULL; |
|
514 } |
|
515 } |
|
516 } |
|
517 |
|
518 // --------------------------------------------------------- |
|
519 // CBrowserBookmarksGotoPane::FocusChanged |
|
520 // --------------------------------------------------------- |
|
521 // |
|
522 void CBrowserBookmarksGotoPane::FocusChanged( TDrawNow aDrawNow ) |
|
523 { |
|
524 iEditor->SetFocus( IsFocused(), aDrawNow ); |
|
525 } |
|
526 |
|
527 // --------------------------------------------------------- |
|
528 // CBrowserBookmarksGotoPane::CBrowserBookmarksGotoPane |
|
529 // --------------------------------------------------------- |
|
530 // |
|
531 CBrowserBookmarksGotoPane::CBrowserBookmarksGotoPane(CBrowserFavouritesView* aView, TBool aSearchPaneMode) |
|
532 : iView( aView ), |
|
533 iEditing( EFalse ), |
|
534 iFrozen( EFalse ), |
|
535 iBAdaptiveListPopup( NULL ), |
|
536 iSearchPaneMode( aSearchPaneMode ) |
|
537 { |
|
538 } |
|
539 |
|
540 // --------------------------------------------------------- |
|
541 // CBrowserBookmarksGotoPane::ConstructL |
|
542 // --------------------------------------------------------- |
|
543 // |
|
544 void CBrowserBookmarksGotoPane::ConstructL ( const CCoeControl& aParent, const TDesC& aBitmapfile, |
|
545 TInt aIconBitmapId, TInt aIconMaskId, TBool aPopupListStatus ) |
|
546 |
|
547 { |
|
548 SetContainerWindowL( aParent ); // This is now non-window owning control |
|
549 SetMopParent(const_cast<CCoeControl*>(&aParent)); |
|
550 iEditor = new (ELeave) CEikEdwin; |
|
551 iInputFrame = CAknInputFrame::NewL( iEditor, EFalse, aBitmapfile, |
|
552 aIconBitmapId, aIconMaskId, 0 ); |
|
553 iInputFrame->SetContainerWindowL( *this ); |
|
554 iEditor->SetContainerWindowL( *this ); |
|
555 AknEditUtils::ConstructEditingL(iEditor, KFavouritesMaxUrlGotoPaneDefine, 1, EAknEditorCharactersLowerCase, EAknEditorAlignRight, EFalse, ETrue, EFalse); |
|
556 iEditor->AddFlagToUserFlags( CEikEdwin::EAlwaysShowSelection ); |
|
557 iEditor->SetBorder( TGulBorder::ENone ); |
|
558 iEditor->SetAknEditorCase( EAknEditorLowerCase ); |
|
559 iEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
|
560 iEditor->SetSkinBackgroundControlContextL(NULL); |
|
561 if (AVKONAPAC) |
|
562 { |
|
563 // Disallow chinese input. |
|
564 iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | EAknEditorNumericInputMode ); |
|
565 } |
|
566 |
|
567 // In Search Mode we allow all types of inputs |
|
568 TInt editorFlags( (iSearchPaneMode ? EAknEditorFlagDefault : EAknEditorFlagLatinInputModesOnly) | EAknEditorFlagUseSCTNumericCharmap ); |
|
569 |
|
570 // Always disable T9 input for goto url |
|
571 editorFlags = (editorFlags | EAknEditorFlagNoT9); |
|
572 |
|
573 iEditor->SetAknEditorFlags( editorFlags ); |
|
574 |
|
575 |
|
576 iEditor->SetAknEditorPermittedCaseModes( EAknEditorUpperCase | EAknEditorLowerCase ); |
|
577 |
|
578 iEditor->CreateTextViewL(); |
|
579 SetupSkinContextL(); |
|
580 iEditing = EFalse; |
|
581 TBool searchFeature = iView->ApiProvider().Preferences().SearchFeature(); |
|
582 if ( searchFeature ) |
|
583 { |
|
584 HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength ); |
|
585 TPtr searchProviderPtr = searchProvider->Des(); |
|
586 |
|
587 iView->ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle, |
|
588 KMaxTitleLength , searchProviderPtr); |
|
589 if( searchProvider->Length() == 0 ) |
|
590 { |
|
591 iDefaultSearchText = StringLoader::LoadL( R_IS_WEB_SEARCH ); |
|
592 } |
|
593 else |
|
594 { |
|
595 iDefaultSearchText = searchProvider->AllocL(); |
|
596 } |
|
597 CleanupStack::PopAndDestroy(searchProvider); |
|
598 } |
|
599 |
|
600 //adaptive popuplist |
|
601 iBAdaptiveListPopup = NULL; |
|
602 if( aPopupListStatus && AUTOCOMP ) //ask the feature manager |
|
603 { |
|
604 iBAdaptiveListPopup= new (ELeave) CBrowserAdaptiveListPopup( |
|
605 iEditor, this, EBookmarksGotoPane, searchFeature); |
|
606 iBAdaptiveListPopup->ConstructL(); |
|
607 iEditor->SetObserver( iBAdaptiveListPopup ); |
|
608 if (iView) |
|
609 { |
|
610 iBAdaptiveListPopup->SetUrlSuffixList(iView->ApiProvider().Preferences().URLSuffixList()); |
|
611 iBAdaptiveListPopup->SetMaxRecentUrls(iView->ApiProvider().Preferences().MaxRecentUrls()); |
|
612 } |
|
613 } |
|
614 |
|
615 ActivateL(); |
|
616 MakeVisible( EFalse ); |
|
617 } |
|
618 |
|
619 // --------------------------------------------------------- |
|
620 // CBrowserBookmarksGotoPane::SizeChanged |
|
621 // --------------------------------------------------------- |
|
622 // |
|
623 void CBrowserBookmarksGotoPane::SizeChanged() |
|
624 { |
|
625 TAknLayoutRect layoutRectTemp; |
|
626 TAknWindowLineLayout windowLayoutTmp, windowLayoutTmp2; |
|
627 |
|
628 windowLayoutTmp = AknLayout::Find_pane_elements_Line_4(); |
|
629 windowLayoutTmp2 = windowLayoutTmp; |
|
630 layoutRectTemp.LayoutRect( Rect(), windowLayoutTmp2 ); |
|
631 iEditor->SetRect( layoutRectTemp.Rect() ); |
|
632 iInputFrame->SetRect( Rect() ); |
|
633 TRAP_IGNORE(SetupSkinContextL()); |
|
634 } |
|
635 |
|
636 // --------------------------------------------------------- |
|
637 // CBrowserBookmarksGotoPane::SetEditingL |
|
638 // --------------------------------------------------------- |
|
639 // |
|
640 void CBrowserBookmarksGotoPane::SetEditingL( TBool aEditing ) |
|
641 { |
|
642 if ( aEditing != iEditing ) |
|
643 { |
|
644 iEditing = aEditing; |
|
645 SetFocus( iEditing ); |
|
646 if ( iGPObserver ) |
|
647 { |
|
648 iGPObserver->HandleBookmarksGotoPaneEventL |
|
649 ( |
|
650 this, |
|
651 MBookmarksGotoPaneObserver::EEventEditingModeChanged |
|
652 ); |
|
653 } |
|
654 } |
|
655 } |
|
656 |
|
657 // --------------------------------------------------------- |
|
658 // CBrowserBookmarksGotoPane::PopupList |
|
659 // --------------------------------------------------------- |
|
660 // |
|
661 CBrowserAdaptiveListPopup* CBrowserBookmarksGotoPane::PopupList() |
|
662 { |
|
663 return iBAdaptiveListPopup; |
|
664 } |
|
665 |
|
666 // --------------------------------------------------------- |
|
667 // CBrowserBookmarksGotoPane::HandleResourceChange |
|
668 // --------------------------------------------------------- |
|
669 // |
|
670 void CBrowserBookmarksGotoPane::HandleResourceChange( TInt aType ) |
|
671 { |
|
672 CCoeControl::HandleResourceChange( aType ); |
|
673 |
|
674 if ( iBAdaptiveListPopup ) |
|
675 { |
|
676 iBAdaptiveListPopup->HandleResourceChange( aType ); |
|
677 } |
|
678 } |
|
679 |
|
680 // --------------------------------------------------------- |
|
681 // CBrowserBookmarksGotoPane::MopSupplyObject |
|
682 // --------------------------------------------------------- |
|
683 // |
|
684 TTypeUid::Ptr CBrowserBookmarksGotoPane::MopSupplyObject( TTypeUid aId ) |
|
685 { |
|
686 return MAknsControlContext::SupplyMopObject( aId, iSkinContext ); |
|
687 } |
|
688 |
|
689 // ---------------------------------------------------------------------------- |
|
690 // CBrowserBookmarksGotoPane::Editor |
|
691 // ---------------------------------------------------------------------------- |
|
692 CEikEdwin* CBrowserBookmarksGotoPane::Editor() const |
|
693 { |
|
694 return iEditor; |
|
695 } |
|
696 |
|
697 // ---------------------------------------------------------------------------- |
|
698 // CBrowserBookmarksGotoPane::HandlePointerEventL |
|
699 // ---------------------------------------------------------------------------- |
|
700 // |
|
701 void CBrowserBookmarksGotoPane::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
702 { |
|
703 if (AknLayoutUtils::PenEnabled()) |
|
704 { |
|
705 if(iEditor && Rect().Contains(aPointerEvent.iPosition)) |
|
706 { |
|
707 iEditor->HandlePointerEventL(aPointerEvent); |
|
708 if ( !iEditing ) |
|
709 { |
|
710 SetEditingL( ETrue ); |
|
711 iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
|
712 CBrowserAppUi::Static()->UpdateCbaL(); |
|
713 } |
|
714 } |
|
715 else |
|
716 { |
|
717 // pointer outside of control |
|
718 CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneCancel); |
|
719 } |
|
720 } |
|
721 } |
|
722 // ---------------------------------------------------------------------------- |
|
723 // CBrowserBookmarksGotoPane::SetupSkinContextL |
|
724 // ---------------------------------------------------------------------------- |
|
725 void CBrowserBookmarksGotoPane::SetupSkinContextL() |
|
726 { |
|
727 TAknsItemID tileIID = KAknsIIDQsnBgColumnA; |
|
728 |
|
729 TAknWindowLineLayout tile = |
|
730 Column_background_and_list_slice_skin_placing_Line_2(); |
|
731 |
|
732 TAknLayoutRect mainPane; |
|
733 mainPane.LayoutRect( |
|
734 iAvkonAppUi->ApplicationRect(), |
|
735 AKN_LAYOUT_WINDOW_main_pane( iAvkonAppUi->ApplicationRect(), |
|
736 0, 0, 1) ); |
|
737 TAknLayoutRect listRect; |
|
738 listRect.LayoutRect( mainPane.Rect(), AknLayout::list_gen_pane(0) ); |
|
739 |
|
740 TAknLayoutRect tileRect; |
|
741 tileRect.LayoutRect(mainPane.Rect(), tile); |
|
742 |
|
743 if ( !iSkinContext ) |
|
744 { |
|
745 iSkinContext = CAknsListBoxBackgroundControlContext::NewL( |
|
746 KAknsIIDQsnBgAreaMainListGene, |
|
747 listRect.Rect(), |
|
748 EUseSkinContext & EParentAbsolute, |
|
749 tileIID, |
|
750 tileRect.Rect() ); |
|
751 } |
|
752 else |
|
753 { |
|
754 iSkinContext->SetRect( listRect.Rect() ); |
|
755 } |
|
756 |
|
757 |
|
758 if ( !iInputContext ) |
|
759 { |
|
760 iInputContext = CAknsFrameBackgroundControlContext::NewL( |
|
761 KAknsIIDQsnFrInput, TRect(0,0,0,0),TRect(0,0,0,0),EFalse ); |
|
762 } |
|
763 |
|
764 iInputFrame->SetInputContext(iInputContext); |
|
765 iEditor->SetSkinBackgroundControlContextL(iInputContext); |
|
766 |
|
767 } |
|
768 |
|
769 // ---------------------------------------------------------------------------- |
|
770 // CBrowserBookmarksGotoPane::ActivateVkbL |
|
771 // ---------------------------------------------------------------------------- |
|
772 void CBrowserBookmarksGotoPane::ActivateVkbL() |
|
773 { |
|
774 if (iEditor && iEditor->TextView()) |
|
775 { |
|
776 // make sure observer is set |
|
777 iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
|
778 |
|
779 // simulate pointer event to force VKB |
|
780 |
|
781 // first get point at cursor location |
|
782 TInt pos = iEditor->CursorPos(); |
|
783 CTextView* textView = iEditor->TextView(); |
|
784 TPoint curPos; |
|
785 textView->DocPosToXyPosL(pos, curPos); |
|
786 |
|
787 TPointerEvent pe; |
|
788 pe.iPosition = curPos; |
|
789 |
|
790 pe.iType = TPointerEvent::EButton1Down; |
|
791 iEditor->HandlePointerEventL(pe); |
|
792 |
|
793 // VKB will only activate if nothing selected |
|
794 iEditor->SetSelectionL(pos, pos); |
|
795 |
|
796 pe.iType = TPointerEvent::EButton1Up; |
|
797 iEditor->HandlePointerEventL(pe); |
|
798 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
|
799 |
|
800 } |
|
801 } |
|
802 |
|
803 |
|
804 // ---------------------------------------------------------------------------- |
|
805 // CBrowserBookmarksGotoPane::SetTextModeItalic |
|
806 // ---------------------------------------------------------------------------- |
|
807 void CBrowserBookmarksGotoPane::SetTextModeItalicL( ) |
|
808 { |
|
809 |
|
810 // Editor Control is laid in a scalable way, so we need to get the correct font |
|
811 // specification for setting CharFormatLayer, We could have used GetNearestFontInTwips, |
|
812 // as done above in SetTextL() but it does not provide correct fonts for editor. |
|
813 // We do not need to set the FontPosture back to EPostureUpright ( Normal ), as it |
|
814 // is automatically handled by AknLayoutUtils::LayoutEdwinScalable called by |
|
815 // iInputFrame->SetRect(), which overwrites all the properties for Editor. |
|
816 |
|
817 TAknTextComponentLayout editorLayout; |
|
818 TBool apac( AknLayoutUtils::Variant() == EApacVariant && ( CAknInputFrame::EShowIndicators ) ); |
|
819 editorLayout = AknLayoutScalable_Avkon::input_find_pane_t1( apac ? 1: 0 ); |
|
820 TAknTextLineLayout lineLayout = editorLayout.LayoutLine(); |
|
821 TInt fontid = lineLayout.FontId(); |
|
822 const CAknLayoutFont *font = AknLayoutUtils::LayoutFontFromId( fontid ); |
|
823 |
|
824 TCharFormat charFormat; |
|
825 TCharFormatMask charFormatMask; |
|
826 charFormat.iFontSpec = font->FontSpecInTwips(); |
|
827 charFormat.iFontSpec.iFontStyle.SetPosture( EPostureItalic ); |
|
828 charFormatMask.SetAttrib(EAttFontTypeface); |
|
829 charFormatMask.SetAttrib(EAttFontHeight); |
|
830 charFormatMask.SetAttrib(EAttFontStrokeWeight); |
|
831 charFormatMask.SetAttrib(EAttFontPosture); |
|
832 |
|
833 // Owner ship of charFormatLayer is taken by Editor |
|
834 CCharFormatLayer* charFormatLayer = NULL; |
|
835 charFormatLayer = CCharFormatLayer::NewL(charFormat,charFormatMask); |
|
836 iEditor->SetCharFormatLayer(charFormatLayer); |
|
837 } |
|
838 |
|
839 // ---------------------------------------------------------------------------- |
|
840 // CBrowserBookmarksGotoPane::SetVKBFlag |
|
841 // ---------------------------------------------------------------------------- |
|
842 void CBrowserBookmarksGotoPane::SetVKBFlag( TBool aVKBFlag ) |
|
843 { |
|
844 #if defined(BRDO_SEARCH_INTEGRATION_FF) |
|
845 if( aVKBFlag ) |
|
846 { |
|
847 iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
848 } |
|
849 else |
|
850 { |
|
851 iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
852 } |
|
853 #endif |
|
854 } |
|
855 // End of File |
|