69 // --------------------------------------------------------- |
75 // --------------------------------------------------------- |
70 // CBrowserBookmarksGotoPane::NewL |
76 // CBrowserBookmarksGotoPane::NewL |
71 // --------------------------------------------------------- |
77 // --------------------------------------------------------- |
72 // |
78 // |
73 CBrowserBookmarksGotoPane* CBrowserBookmarksGotoPane::NewL |
79 CBrowserBookmarksGotoPane* CBrowserBookmarksGotoPane::NewL |
74 ( const CCoeControl& aParent, CBrowserFavouritesView* aView ) |
80 ( |
75 { |
81 const CCoeControl& aParent, |
|
82 CBrowserFavouritesView* aContentView, |
|
83 const TDesC& aBitmapfile, |
|
84 TInt aIconBitmapId, |
|
85 TInt aIconMaskId, |
|
86 TBool aPopupListStatus, |
|
87 TBool aSearchPaneMode |
|
88 ) |
|
89 { |
76 CBrowserBookmarksGotoPane* gotoPane = |
90 CBrowserBookmarksGotoPane* gotoPane = |
77 new(ELeave) CBrowserBookmarksGotoPane(aView); |
91 new(ELeave) CBrowserBookmarksGotoPane(aContentView, aSearchPaneMode); |
78 CleanupStack::PushL( gotoPane ); |
92 CleanupStack::PushL( gotoPane ); |
79 gotoPane->ConstructL( aParent ); |
93 gotoPane->ConstructL( aParent, aBitmapfile, aIconBitmapId, aIconMaskId, aPopupListStatus ); |
80 CleanupStack::Pop(); // gotoPane |
94 CleanupStack::Pop(); // gotoPane |
81 return gotoPane; |
95 return gotoPane; |
82 } |
96 } |
83 |
97 |
84 // --------------------------------------------------------- |
98 // --------------------------------------------------------- |
85 // CBrowserBookmarksGotoPane::~CBrowserBookmarksGotoPane |
99 // CBrowserBookmarksGotoPane::~CBrowserBookmarksGotoPane |
86 // --------------------------------------------------------- |
100 // --------------------------------------------------------- |
87 // |
101 // |
88 CBrowserBookmarksGotoPane::~CBrowserBookmarksGotoPane() |
102 CBrowserBookmarksGotoPane::~CBrowserBookmarksGotoPane() |
89 { |
103 { |
90 delete iEditor; |
104 delete iEditor; |
91 delete iInputFrame; |
105 delete iInputFrame; |
92 delete iSkinContext; |
106 delete iSkinContext; |
93 delete iInputContext; |
107 delete iInputContext; |
94 delete iBAdaptiveListPopup; |
108 delete iBAdaptiveListPopup; |
|
109 delete iDefaultSearchText; |
95 } |
110 } |
96 |
111 |
97 // --------------------------------------------------------- |
112 // --------------------------------------------------------- |
98 // CBrowserBookmarksGotoPane::BeginEditingL() |
113 // CBrowserBookmarksGotoPane::BeginEditingL() |
99 // --------------------------------------------------------- |
114 // --------------------------------------------------------- |
100 // |
115 // |
101 void CBrowserBookmarksGotoPane::BeginEditingL() |
116 void CBrowserBookmarksGotoPane::BeginEditingL() |
102 { |
117 { |
103 if ( !iFrozen ) |
118 if ( !iFrozen ) |
104 { |
119 { |
105 // set the default string, make visible, start editing |
120 // If its a GoTo Pane Mode. |
106 SetTextL( KWWWString ); |
121 if( !iSearchPaneMode ) |
107 MakeVisible( ETrue ); |
122 { |
108 SetEditingL( ETrue ); |
123 if( iView->ApiProvider().Preferences().SearchFeature() ) |
109 if (AknLayoutUtils::PenEnabled()) |
124 { |
110 { |
125 // If there is no text, then we need to place back |
111 ActivateVKB(); |
126 // the default text, else preserve the previously |
112 } |
127 // typed text. |
113 } |
128 HBufC* text = iEditor->GetTextInHBufL(); |
114 } |
129 if( !text ) |
115 |
130 { |
|
131 SetTextL( KWWWString ); |
|
132 } |
|
133 else |
|
134 { |
|
135 delete text; |
|
136 } |
|
137 } |
|
138 else |
|
139 SetTextL( KWWWString ); |
|
140 } |
|
141 else |
|
142 { |
|
143 if( iView->ApiProvider().Preferences().SearchFeature() ) |
|
144 { |
|
145 //Clear searchpane on focus if default text is there |
|
146 HBufC* text = iEditor->GetTextInHBufL(); |
|
147 if ( text ) |
|
148 { |
|
149 CleanupStack::PushL( text ); |
|
150 if ( !text->Compare( iDefaultSearchText->Des() ) ) |
|
151 { |
|
152 iEditor->SetTextL( &KNullDesC ); |
|
153 } |
|
154 CleanupStack::PopAndDestroy( text ); |
|
155 } |
|
156 } |
|
157 } |
|
158 |
|
159 MakeVisible( ETrue ); |
|
160 SetEditingL( ETrue ); |
|
161 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
|
162 if (AknLayoutUtils::PenEnabled() |
|
163 && ( !iView->ApiProvider().Preferences().SearchFeature()) ) |
|
164 { |
|
165 ActivateVkbL(); |
|
166 } |
|
167 } |
|
168 } |
|
169 |
116 // --------------------------------------------------------- |
170 // --------------------------------------------------------- |
117 // CBrowserBookmarksGotoPane::CancelEditingL() |
171 // CBrowserBookmarksGotoPane::CancelEditingL() |
118 // --------------------------------------------------------- |
172 // --------------------------------------------------------- |
119 // |
173 // |
120 void CBrowserBookmarksGotoPane::CancelEditingL() |
174 void CBrowserBookmarksGotoPane::CancelEditingL() |
121 { |
175 { |
122 if ( !iFrozen ) |
176 if ( !iFrozen ) |
123 { |
177 { |
|
178 // Clear selection when focus moved, only |
|
179 // affects when both the editors are visible. |
|
180 // no need for condition. |
|
181 TInt pos = iEditor->CursorPos(); |
|
182 iEditor->SetSelectionL(pos,pos); |
124 SetEditingL( EFalse ); |
183 SetEditingL( EFalse ); |
125 |
184 |
126 // Cancel Adaptive List popup if its active |
185 // Cancel Adaptive List popup if its active |
127 if( NULL != iBAdaptiveListPopup) |
186 if ( NULL != iBAdaptiveListPopup) |
128 { |
187 { |
129 iBAdaptiveListPopup->SetDirectoryModeL( ETrue ); |
188 iBAdaptiveListPopup->SetDirectoryModeL( ETrue ); |
130 iBAdaptiveListPopup->HidePopupL(); |
189 iBAdaptiveListPopup->HidePopupL(); |
131 } |
190 } |
132 } |
191 } |
133 |
192 |
134 } |
193 } |
135 |
194 |
136 // --------------------------------------------------------- |
195 // --------------------------------------------------------- |
137 // CBrowserBookmarksGotoPane::SetTextL |
196 // CBrowserBookmarksGotoPane::SetTextL |
138 // --------------------------------------------------------- |
197 // --------------------------------------------------------- |
139 // |
198 // |
140 void CBrowserBookmarksGotoPane::SetTextL |
199 void CBrowserBookmarksGotoPane::SetTextL |
141 ( const TDesC& aText, TBool aClipToFit /*=ETrue*/, TBool aCancelEditing ) |
200 ( const TDesC& aText, TBool aClipToFit /*=ETrue*/, TBool aCancelEditing ) |
142 { |
201 { |
143 |
202 |
144 CFbsFont * font = NULL; |
203 CFbsFont * font = NULL; |
145 |
204 |
146 if ( !iFrozen ) |
205 if ( !iFrozen ) |
147 { |
206 { |
148 if ( aClipToFit && aText.Length() ) |
207 if ( aClipToFit && aText.Length() ) |
149 { |
208 { |
150 // Allocate 3 chars more (make sure "..." fits). |
209 // Allocate 3 chars more (make sure "..." fits). |
176 iEditor->SetTextL( &ptr ); |
235 iEditor->SetTextL( &ptr ); |
177 CleanupStack::PopAndDestroy(); // buf |
236 CleanupStack::PopAndDestroy(); // buf |
178 } |
237 } |
179 else |
238 else |
180 { |
239 { |
181 if ( aText.Length() ) |
240 if( iSearchPaneMode ) |
182 { |
241 { |
183 iEditor->SetTextL( &aText ); |
242 iEditor->SetTextL( &aText ); |
184 } |
243 } |
185 else |
244 else |
186 { |
245 { |
187 TBufC<16> buf(KAddressText); |
246 if ( aText.Length() ) |
188 HBufC* tmpBuf = NULL; |
247 { |
189 tmpBuf = buf.AllocLC(); |
248 iEditor->SetTextL( &aText ); |
190 iEditor->SetTextL( tmpBuf ); |
249 } |
191 CleanupStack::PopAndDestroy(); // tmpBuf |
250 else |
192 } |
251 { |
193 } |
252 TBufC<16> buf(KAddressText); |
194 |
253 HBufC* tmpBuf = NULL; |
|
254 tmpBuf = buf.AllocLC(); |
|
255 iEditor->SetTextL( tmpBuf ); |
|
256 CleanupStack::PopAndDestroy(); // tmpBuf |
|
257 } |
|
258 } |
|
259 } |
|
260 |
195 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
261 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
196 if ( !iEverFocused ) |
262 if ( !iEverFocused ) |
197 { |
263 { |
198 iEditor->SetFocus( ETrue ); |
264 iEditor->SetFocus( ETrue ); |
199 } |
265 } |
200 |
266 |
201 if ( !iEverFocused ) |
267 if ( !iEverFocused ) |
202 { |
268 { |
203 iEditor->SetFocus( IsFocused() ); |
269 iEditor->SetFocus( IsFocused() ); |
204 iEverFocused = ETrue; |
270 iEverFocused = ETrue; |
205 } |
271 } |
206 SetEditingL( !aCancelEditing ); |
272 SetEditingL( !aCancelEditing ); |
207 DrawDeferred(); |
273 DrawDeferred(); |
208 } |
274 } |
209 |
275 |
210 // release font if it was used |
276 // release font if it was used |
211 if(font != NULL) |
277 if (font != NULL) |
212 { |
278 { |
213 CEikonEnv::Static()->ScreenDevice()->ReleaseFont(font); |
279 CEikonEnv::Static()->ScreenDevice()->ReleaseFont(font); |
214 } |
280 } |
215 |
281 |
216 } |
282 } |
217 |
283 |
218 // --------------------------------------------------------- |
284 // --------------------------------------------------------- |
219 // CBrowserBookmarksGotoPane::GetTextL |
285 // CBrowserBookmarksGotoPane::GetTextL |
220 // --------------------------------------------------------- |
286 // --------------------------------------------------------- |
254 |
322 |
255 // --------------------------------------------------------- |
323 // --------------------------------------------------------- |
256 // CBrowserBookmarksGotoPane::OfferKeyEventL |
324 // CBrowserBookmarksGotoPane::OfferKeyEventL |
257 // --------------------------------------------------------- |
325 // --------------------------------------------------------- |
258 // |
326 // |
|
327 // Note: |
|
328 // |
|
329 // Below, there are several keys in the ISO-Latin-1 range that we |
|
330 // exclude from use in a URL: |
|
331 // |
|
332 // - EStdKeyDevice10 0xC9 E-accent acute Northwest |
|
333 // - EStdKeyDevice11 0xCA E-accent circumflex Northeast |
|
334 // - EStdKeyDevice12 0xCB E-umlaut Southeast |
|
335 // - EStdKeyDevice13 0xCC I-accent grave Southwest |
|
336 // |
|
337 // While these ought to be vaguely acceptable in certain parts of a URL, |
|
338 // they are also used by some navigation drivers as our "diagonal event" |
|
339 // codes so turn up as the user navigates the cursor. Because of this, |
|
340 // today, we prevent them from being inserted as characters. There's |
|
341 // a second set of code ranges (in the 0x8XXX range) that's also defined |
|
342 // for these events; if the driver writers ever manage to get all of |
|
343 // the navigation drivers using this "out-of-band" range, we can |
|
344 // eliminate filtering the ISO-Latin-1 range of characters that we |
|
345 // do here. |
|
346 // |
|
347 // |
|
348 |
259 TKeyResponse CBrowserBookmarksGotoPane::OfferKeyEventL |
349 TKeyResponse CBrowserBookmarksGotoPane::OfferKeyEventL |
260 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
350 ( const TKeyEvent& aKeyEvent, TEventCode aType ) |
261 { |
351 { |
262 TKeyResponse response = EKeyWasNotConsumed; |
352 TKeyResponse response = EKeyWasNotConsumed; |
263 TChar iInputChar = TChar( aKeyEvent.iScanCode ); |
353 TChar iInputChar = TChar( aKeyEvent.iScanCode ); |
264 |
354 |
265 |
355 |
266 if ( iBAdaptiveListPopup ) |
356 if ( iBAdaptiveListPopup ) |
267 { |
357 { |
268 response = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType ); |
358 response = iBAdaptiveListPopup->OfferKeyEventL( aKeyEvent, aType ); |
269 } |
359 } |
270 |
360 |
271 if ( iEditing && response != EKeyWasConsumed) |
361 if ( iEditing && response != EKeyWasConsumed) |
272 { |
362 { |
273 // Editing; most keys simply forwarded to the editor. |
363 |
274 switch ( aKeyEvent.iCode ) |
364 switch ( aKeyEvent.iCode ) // Already editing; most keys simply forwarded to the editor. |
275 { |
365 { |
276 case EKeyOK: |
366 |
|
367 case EKeyOK: |
277 { |
368 { |
278 // MSK is now handled through HandleCommand in BrowserBookmarksView |
369 response = EKeyWasConsumed; // MSK is now handled through HandleCommand in BrowserBookmarksView |
|
370 break; |
|
371 } |
|
372 |
|
373 case EKeyRightUpArrow: // Northeast |
|
374 case EStdKeyDevice11: // : Extra KeyEvent supports diagonal event simulator wedge |
|
375 case EKeyRightDownArrow: // Southeast |
|
376 case EStdKeyDevice12: // : Extra KeyEvent supports diagonal event simulator wedge |
|
377 case EKeyLeftDownArrow: // Southwest |
|
378 case EStdKeyDevice13: // : Extra KeyEvent supports diagonal event simulator wedge |
|
379 case EKeyLeftUpArrow: // Northwest |
|
380 case EStdKeyDevice10: // : Extra KeyEvent supports diagonal event simulator wedge |
|
381 { // Here, "eat" all of the diagonals so they have no effect... |
279 response = EKeyWasConsumed; |
382 response = EKeyWasConsumed; |
280 break; |
383 break; |
281 } |
384 } |
282 case EKeyEnter: |
385 |
283 // Handle EnterKey as "GOTO" for Touch, VKB's enter key |
386 case EKeyEnter: // Handle EnterKey as "GOTO" for Touch, VKB's enter key |
284 if( AknLayoutUtils::PenEnabled() ) |
387 if ( AknLayoutUtils::PenEnabled() ) |
285 { |
388 { |
286 CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo); |
389 CBrowserAppUi::Static()->ActiveView()->HandleCommandL(EWmlCmdGotoPaneGoTo); |
287 break; |
390 // In case of search feature, we need to pass EKeyWasConsumed for EKeyEnter |
288 } |
391 if ( iView->ApiProvider().Preferences().SearchFeature() ) |
289 // FALL through to default in case Pen is not enabled. |
392 { |
|
393 response = EKeyWasConsumed; |
|
394 } |
|
395 break; |
|
396 } // Else *FALL THROUGH* to default in case Pen is not enabled. |
290 default: |
397 default: |
291 { |
398 { |
292 response = iEditor->OfferKeyEventL(aKeyEvent, aType ); |
399 response = iEditor->OfferKeyEventL(aKeyEvent, aType ); |
293 break; |
400 break; |
294 } |
401 } |
295 } |
402 } |
296 |
403 |
|
404 // In the absence of search feature |
297 // Force key event to be consumed if you're editing |
405 // Force key event to be consumed if you're editing |
298 // regardless of what's happened to it. |
406 // regardless of what's happened to it. |
299 // |
407 // |
300 // This forces user to press cancel to continue other tasks |
408 // This forces user to press cancel to continue other tasks |
301 response = EKeyWasConsumed; |
409 if ( !iView->ApiProvider().Preferences().SearchFeature() ) |
302 } |
410 { |
303 else if ( response != EKeyWasConsumed ) |
411 response = EKeyWasConsumed; |
304 { |
412 } |
305 |
413 } |
|
414 else if ( response != EKeyWasConsumed ) // Key consumed yet? If not, process onwards... |
|
415 { |
|
416 |
306 if ( (aKeyEvent.iScanCode == EStdKeyHash) || |
417 if ( (aKeyEvent.iScanCode == EStdKeyHash) || |
307 ( aKeyEvent.iModifiers & |
418 ( aKeyEvent.iModifiers & |
308 ( EModifierShift | EModifierLeftShift | EModifierRightShift | |
419 ( EModifierShift | EModifierLeftShift | EModifierRightShift | |
309 EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) ) |
420 EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) ) |
310 { |
421 { |
311 |
422 |
312 // Hash key press will be used for Mark/UnMark functionality |
423 // Hash key press will be used for Mark/UnMark functionality |
313 // Let Platform Listbox handle this. |
424 // Let Platform Listbox handle this. |
314 response = EKeyWasNotConsumed; |
425 response = EKeyWasNotConsumed; |
315 } |
426 } |
316 |
427 |
317 // |
428 // |
318 // Not currently editing the GoTo pane. |
429 // Not currently editing the GoTo pane. |
319 // Catch alpha and numeric to pop |
430 // Catch alpha and numeric to pop up the GoTo pane |
320 // up goto pane |
|
321 // |
431 // |
322 // Only popup the GoTo Pane with a KeyDown event. |
432 // Only popup the GoTo Pane with a KeyDown event. |
323 // Otherwise, if browser is pushed to the backround (but still active) |
433 // Otherwise, if browser is pushed to the backround (but still active) |
324 // in favor of the App Shell, A long "0" press will reactivate the browser and |
434 // in favor of the App Shell, A long "0" press will reactivate the browser and |
325 // leave a KeyUp to (wrongly) pop the pane up |
435 // leave a KeyUp to (wrongly) pop the pane up |
326 // |
436 // |
327 // Note that we exclude Unicode 0xC4 and 0xC5 which |
437 // Note that we exclude Unicode 0xC4 and 0xC5 which |
328 // are defined by EStdkeyYes and EStdkeyNo. These |
438 // are defined as EStdkeyYes and EStdkeyNo. These |
329 // map to the Send and End keys respectively. Normally, |
439 // map to the Send and End keys respectively. Normally, |
330 // 0xC4 and 0xC5 can be considered alpha digits, but we exclude them so that |
440 // 0xC4 and 0xC5 can be considered alpha digits, but we |
331 // they will not pop the goto pane |
441 // exclude them so that they will not pop the GoTo pane |
332 // |
442 // |
333 // key event is generated again (to channel through FEP) |
443 // We do the same thing for all of the diagonal motion events |
334 // |
444 // so they have no effect either. |
335 else if ( !iFrozen && |
445 // |
336 aType == EEventKeyDown && |
446 // Otherwise, key event is generated again (to channel through FEP) |
337 iInputChar.IsAlphaDigit() && |
447 // |
338 iInputChar != EStdKeyYes && |
448 else if ( !iFrozen |
339 iInputChar != EStdKeyNo) |
449 && aType == EEventKeyDown |
340 { |
450 && iInputChar.IsAlphaDigit() |
341 // These keys activate the Goto Pane. |
451 && iInputChar != EStdKeyYes |
342 response = EKeyWasConsumed; |
452 && iInputChar != EStdKeyNo |
343 |
453 && iInputChar != EKeyRightUpArrow // Northeast |
|
454 && iInputChar != EStdKeyDevice11 // : Extra KeyEvent supports diagonal event simulator wedge |
|
455 && iInputChar != EKeyRightDownArrow // Southeast |
|
456 && iInputChar != EStdKeyDevice12 // : Extra KeyEvent supports diagonal event simulator wedge |
|
457 && iInputChar != EKeyLeftDownArrow // Southwest |
|
458 && iInputChar != EStdKeyDevice13 // : Extra KeyEvent supports diagonal event simulator wedge |
|
459 && iInputChar != EKeyLeftUpArrow // Northwest |
|
460 && iInputChar != EStdKeyDevice10 ) // : Extra KeyEvent supports diagonal event simulator wedge |
|
461 { // Most other alphanumeric keys activate the Goto Pane... |
|
462 response = EKeyWasConsumed; // We'll consume the key event so it ends here |
344 BeginEditingL(); |
463 BeginEditingL(); |
345 |
|
346 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
464 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
347 iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
465 iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
348 iCoeEnv->SimulateKeyEventL( aKeyEvent, aType ); |
466 iCoeEnv->SimulateKeyEventL( aKeyEvent, aType ); |
349 |
|
350 } |
467 } |
351 else |
468 else |
352 { |
469 { // Other keys do not activate the Goto Pane. |
353 // Other keys do not activate the Goto Pane. |
470 response = EKeyWasNotConsumed; // Let someone else take the key event |
354 response = EKeyWasNotConsumed; |
|
355 } |
471 } |
356 } |
472 } |
357 return response; |
473 return response; |
358 } |
474 } |
359 |
475 |
403 |
519 |
404 // --------------------------------------------------------- |
520 // --------------------------------------------------------- |
405 // CBrowserBookmarksGotoPane::CBrowserBookmarksGotoPane |
521 // CBrowserBookmarksGotoPane::CBrowserBookmarksGotoPane |
406 // --------------------------------------------------------- |
522 // --------------------------------------------------------- |
407 // |
523 // |
408 CBrowserBookmarksGotoPane::CBrowserBookmarksGotoPane(CBrowserFavouritesView* aView) |
524 CBrowserBookmarksGotoPane::CBrowserBookmarksGotoPane(CBrowserFavouritesView* aView, TBool aSearchPaneMode) |
409 : iView(aView), iEditing( EFalse ), iFrozen( EFalse ) |
525 : iView( aView ), |
|
526 iEditing( EFalse ), |
|
527 iFrozen( EFalse ), |
|
528 iBAdaptiveListPopup( NULL ), |
|
529 iSearchPaneMode( aSearchPaneMode ) |
410 { |
530 { |
411 } |
531 } |
412 |
532 |
413 // --------------------------------------------------------- |
533 // --------------------------------------------------------- |
414 // CBrowserBookmarksGotoPane::ConstructL |
534 // CBrowserBookmarksGotoPane::ConstructL |
415 // --------------------------------------------------------- |
535 // --------------------------------------------------------- |
416 // |
536 // |
417 void CBrowserBookmarksGotoPane::ConstructL |
537 void CBrowserBookmarksGotoPane::ConstructL ( const CCoeControl& aParent, const TDesC& aBitmapfile, |
418 ( const CCoeControl& aParent ) |
538 TInt aIconBitmapId, TInt aIconMaskId, TBool aPopupListStatus ) |
419 { |
539 |
|
540 { |
420 SetContainerWindowL( aParent ); // This is now non-window owning control |
541 SetContainerWindowL( aParent ); // This is now non-window owning control |
421 SetMopParent(const_cast<CCoeControl*>(&aParent)); |
542 SetMopParent(const_cast<CCoeControl*>(&aParent)); |
422 iEditor = new (ELeave) CEikEdwin; |
543 iEditor = new (ELeave) CEikEdwin; |
423 iInputFrame = CAknInputFrame::NewL( iEditor, EFalse, KAvkonBitmapFile, |
544 iInputFrame = CAknInputFrame::NewL( iEditor, EFalse, aBitmapfile, |
424 EMbmAvkonQgn_indi_find_goto, |
545 aIconBitmapId, aIconMaskId, 0 ); |
425 EMbmAvkonQgn_indi_find_goto_mask, |
|
426 0 ); |
|
427 iInputFrame->SetContainerWindowL( *this ); |
546 iInputFrame->SetContainerWindowL( *this ); |
428 iEditor->SetContainerWindowL( *this ); |
547 iEditor->SetContainerWindowL( *this ); |
429 AknEditUtils::ConstructEditingL(iEditor, KFavouritesMaxUrlGotoPaneDefine, 1, EAknEditorCharactersLowerCase, EAknEditorAlignRight, EFalse, ETrue, EFalse); |
548 AknEditUtils::ConstructEditingL(iEditor, KFavouritesMaxUrlGotoPaneDefine, 1, EAknEditorCharactersLowerCase, EAknEditorAlignRight, EFalse, ETrue, EFalse); |
430 iEditor->AddFlagToUserFlags( CEikEdwin::EAlwaysShowSelection ); |
549 iEditor->AddFlagToUserFlags( CEikEdwin::EAlwaysShowSelection ); |
431 iEditor->SetBorder( TGulBorder::ENone ); |
550 iEditor->SetBorder( TGulBorder::ENone ); |
432 iEditor->SetAknEditorCase( EAknEditorLowerCase ); |
551 iEditor->SetAknEditorCase( EAknEditorLowerCase ); |
433 iEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
552 iEditor->SetAknEditorInputMode( EAknEditorTextInputMode ); |
434 iEditor->SetSkinBackgroundControlContextL(NULL); |
553 iEditor->SetSkinBackgroundControlContextL(NULL); |
435 if (AVKONAPAC) |
554 if (AVKONAPAC) |
436 { |
555 { |
437 // Disallow chinese input. |
556 // Disallow chinese input. |
438 iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | EAknEditorNumericInputMode ); |
557 iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | EAknEditorNumericInputMode ); |
439 } |
558 } |
440 |
559 |
441 TInt editorFlags( EAknEditorFlagLatinInputModesOnly | EAknEditorFlagUseSCTNumericCharmap ); |
560 // In Search Mode we allow all types of inputs |
|
561 TInt editorFlags( (iSearchPaneMode ? EAknEditorFlagDefault : EAknEditorFlagLatinInputModesOnly) | EAknEditorFlagUseSCTNumericCharmap ); |
442 #ifdef RD_INTELLIGENT_TEXT_INPUT |
562 #ifdef RD_INTELLIGENT_TEXT_INPUT |
443 TInt physicalKeyboards = 0; |
563 TInt physicalKeyboards = 0; |
444 CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep ); |
564 CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep ); |
445 User::LeaveIfNull( aknFepRepository ); |
565 User::LeaveIfNull( aknFepRepository ); |
446 |
566 |
447 aknFepRepository->Get( KAknFepPhysicalKeyboards, physicalKeyboards ); |
567 aknFepRepository->Get( KAknFepPhysicalKeyboards, physicalKeyboards ); |
448 delete aknFepRepository; |
568 delete aknFepRepository; |
449 |
569 |
450 if ( physicalKeyboards && EPtiKeyboardQwerty3x11 ) { |
570 if ( physicalKeyboards && EPtiKeyboardQwerty3x11 ) { |
451 editorFlags = (editorFlags | EAknEditorFlagNoT9); |
571 editorFlags = (editorFlags | EAknEditorFlagNoT9); |
452 } |
572 } |
453 #endif |
573 #endif |
454 iEditor->SetAknEditorFlags( editorFlags ); |
574 iEditor->SetAknEditorFlags( editorFlags ); |
455 |
575 |
456 |
576 |
457 iEditor->SetAknEditorPermittedCaseModes( EAknEditorUpperCase | EAknEditorLowerCase ); |
577 iEditor->SetAknEditorPermittedCaseModes( EAknEditorUpperCase | EAknEditorLowerCase ); |
458 |
578 |
459 iEditor->CreateTextViewL(); |
579 iEditor->CreateTextViewL(); |
460 SetupSkinContextL(); |
580 SetupSkinContextL(); |
461 iEditing = EFalse; |
581 iEditing = EFalse; |
|
582 TBool searchFeature = iView->ApiProvider().Preferences().SearchFeature(); |
|
583 if ( searchFeature ) |
|
584 { |
|
585 iDefaultSearchText = StringLoader::LoadL( R_IS_WEB_SEARCH ); |
|
586 } |
|
587 |
462 //adaptive popuplist |
588 //adaptive popuplist |
463 iBAdaptiveListPopup = NULL; |
589 iBAdaptiveListPopup = NULL; |
464 if( AUTOCOMP ) //ask the feature manager |
590 if( aPopupListStatus && AUTOCOMP ) //ask the feature manager |
465 { |
591 { |
466 iBAdaptiveListPopup= new (ELeave) CBrowserAdaptiveListPopup( |
592 iBAdaptiveListPopup= new (ELeave) CBrowserAdaptiveListPopup( |
467 iEditor, this, EBookmarksGotoPane); |
593 iEditor, this, EBookmarksGotoPane, searchFeature); |
468 iBAdaptiveListPopup->ConstructL(); |
594 iBAdaptiveListPopup->ConstructL(); |
469 iEditor->SetObserver( iBAdaptiveListPopup ); |
595 iEditor->SetObserver( iBAdaptiveListPopup ); |
470 if (iView) |
596 if (iView) |
471 { |
597 { |
472 iBAdaptiveListPopup->SetUrlSuffixList(iView->ApiProvider().Preferences().URLSuffixList()); |
598 iBAdaptiveListPopup->SetUrlSuffixList(iView->ApiProvider().Preferences().URLSuffixList()); |
473 iBAdaptiveListPopup->SetMaxRecentUrls(iView->ApiProvider().Preferences().MaxRecentUrls()); |
599 iBAdaptiveListPopup->SetMaxRecentUrls(iView->ApiProvider().Preferences().MaxRecentUrls()); |
474 } |
600 } |
475 } |
601 } |
476 |
602 |
477 ActivateL(); |
603 ActivateL(); |
478 MakeVisible( EFalse ); |
604 MakeVisible( EFalse ); |
479 } |
605 } |
480 |
606 |
481 // --------------------------------------------------------- |
607 // --------------------------------------------------------- |
482 // CBrowserBookmarksGotoPane::SizeChanged |
608 // CBrowserBookmarksGotoPane::SizeChanged |
483 // --------------------------------------------------------- |
609 // --------------------------------------------------------- |
484 // |
610 // |
485 void CBrowserBookmarksGotoPane::SizeChanged() |
611 void CBrowserBookmarksGotoPane::SizeChanged() |
486 { |
612 { |
487 TAknLayoutRect layoutRectTemp; |
613 TAknLayoutRect layoutRectTemp; |
488 TAknWindowLineLayout windowLayoutTmp, windowLayoutTmp2; |
614 TAknWindowLineLayout windowLayoutTmp, windowLayoutTmp2; |
489 |
615 |
490 windowLayoutTmp = AknLayout::Find_pane_elements_Line_4(); |
616 windowLayoutTmp = AknLayout::Find_pane_elements_Line_4(); |
491 windowLayoutTmp2 = windowLayoutTmp; |
617 windowLayoutTmp2 = windowLayoutTmp; |
492 layoutRectTemp.LayoutRect( Rect(), windowLayoutTmp2 ); |
618 layoutRectTemp.LayoutRect( Rect(), windowLayoutTmp2 ); |
493 iEditor->SetRect( layoutRectTemp.Rect() ); |
619 iEditor->SetRect( layoutRectTemp.Rect() ); |
494 iInputFrame->SetRect( Rect() ); |
620 iInputFrame->SetRect( Rect() ); |
495 TRAP_IGNORE(SetupSkinContextL()); |
621 TRAP_IGNORE(SetupSkinContextL()); |
496 } |
622 } |
497 |
623 |
498 // --------------------------------------------------------- |
624 // --------------------------------------------------------- |
499 // CBrowserBookmarksGotoPane::SetEditingL |
625 // CBrowserBookmarksGotoPane::SetEditingL |
587 // CBrowserBookmarksGotoPane::SetupSkinContextL |
711 // CBrowserBookmarksGotoPane::SetupSkinContextL |
588 // ---------------------------------------------------------------------------- |
712 // ---------------------------------------------------------------------------- |
589 void CBrowserBookmarksGotoPane::SetupSkinContextL() |
713 void CBrowserBookmarksGotoPane::SetupSkinContextL() |
590 { |
714 { |
591 TAknsItemID tileIID = KAknsIIDQsnBgColumnA; |
715 TAknsItemID tileIID = KAknsIIDQsnBgColumnA; |
592 |
716 |
593 TAknWindowLineLayout tile = |
717 TAknWindowLineLayout tile = |
594 Column_background_and_list_slice_skin_placing_Line_2(); |
718 Column_background_and_list_slice_skin_placing_Line_2(); |
595 |
719 |
596 TAknLayoutRect mainPane; |
720 TAknLayoutRect mainPane; |
597 mainPane.LayoutRect( |
721 mainPane.LayoutRect( |
598 iAvkonAppUi->ApplicationRect(), |
722 iAvkonAppUi->ApplicationRect(), |
599 AKN_LAYOUT_WINDOW_main_pane( iAvkonAppUi->ApplicationRect(), |
723 AKN_LAYOUT_WINDOW_main_pane( iAvkonAppUi->ApplicationRect(), |
600 0, 0, 1) ); |
724 0, 0, 1) ); |
601 TAknLayoutRect listRect; |
725 TAknLayoutRect listRect; |
602 listRect.LayoutRect( mainPane.Rect(), AknLayout::list_gen_pane(0) ); |
726 listRect.LayoutRect( mainPane.Rect(), AknLayout::list_gen_pane(0) ); |
603 |
727 |
604 TAknLayoutRect tileRect; |
728 TAknLayoutRect tileRect; |
605 tileRect.LayoutRect(mainPane.Rect(), tile); |
729 tileRect.LayoutRect(mainPane.Rect(), tile); |
606 |
730 |
607 if ( !iSkinContext ) |
731 if ( !iSkinContext ) |
608 { |
732 { |
609 iSkinContext = CAknsListBoxBackgroundControlContext::NewL( |
733 iSkinContext = CAknsListBoxBackgroundControlContext::NewL( |
610 KAknsIIDQsnBgAreaMainListGene, |
734 KAknsIIDQsnBgAreaMainListGene, |
611 listRect.Rect(), |
735 listRect.Rect(), |
612 EUseSkinContext & EParentAbsolute, |
736 EUseSkinContext & EParentAbsolute, |
613 tileIID, |
737 tileIID, |
614 tileRect.Rect() ); |
738 tileRect.Rect() ); |
615 } |
739 } |
616 else |
740 else |
627 |
751 |
628 iInputFrame->SetInputContext(iInputContext); |
752 iInputFrame->SetInputContext(iInputContext); |
629 iEditor->SetSkinBackgroundControlContextL(iInputContext); |
753 iEditor->SetSkinBackgroundControlContextL(iInputContext); |
630 |
754 |
631 } |
755 } |
632 |
756 |
633 // ---------------------------------------------------------------------------- |
757 // ---------------------------------------------------------------------------- |
634 // CBrowserBookmarksGotoPane::ActivateVKB |
758 // CBrowserBookmarksGotoPane::ActivateVkbL |
635 // ---------------------------------------------------------------------------- |
759 // ---------------------------------------------------------------------------- |
636 void CBrowserBookmarksGotoPane::ActivateVKB() |
760 void CBrowserBookmarksGotoPane::ActivateVkbL() |
637 { |
761 { |
638 if (iEditor && iEditor->TextView()) |
762 if (iEditor && iEditor->TextView()) |
639 { |
763 { |
640 // make sure observer is set |
764 // make sure observer is set |
641 iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
765 iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus(); |
642 |
766 |
643 // simulate pointer event to force VKB |
767 // simulate pointer event to force VKB |
644 |
768 |
645 // first get point at cursor location |
769 // first get point at cursor location |
646 TInt pos = iEditor->CursorPos(); |
770 TInt pos = iEditor->CursorPos(); |
647 CTextView* textView = iEditor->TextView(); |
771 CTextView* textView = iEditor->TextView(); |
648 TPoint curPos; |
772 TPoint curPos; |
649 textView->DocPosToXyPosL(pos, curPos); |
773 textView->DocPosToXyPosL(pos, curPos); |
650 |
774 |
651 TPointerEvent pe; |
775 TPointerEvent pe; |
652 pe.iPosition = curPos; |
776 pe.iPosition = curPos; |
653 |
777 |
654 pe.iType = TPointerEvent::EButton1Down; |
778 pe.iType = TPointerEvent::EButton1Down; |
655 iEditor->HandlePointerEventL(pe); |
779 iEditor->HandlePointerEventL(pe); |
656 |
780 |
657 // VKB will only activate is nothing selected |
781 // VKB will only activate if nothing selected |
658 iEditor->SetSelectionL(pos,pos); |
782 iEditor->SetSelectionL(pos, pos); |
659 |
783 |
660 pe.iType = TPointerEvent::EButton1Up; |
784 pe.iType = TPointerEvent::EButton1Up; |
661 iEditor->HandlePointerEventL(pe); |
785 iEditor->HandlePointerEventL(pe); |
662 } |
786 iEditor->SetCursorPosL( iEditor->TextLength(), EFalse ); |
663 } |
787 |
664 |
788 } |
|
789 } |
|
790 |
|
791 |
|
792 // ---------------------------------------------------------------------------- |
|
793 // CBrowserBookmarksGotoPane::SetTextModeItalic |
|
794 // ---------------------------------------------------------------------------- |
|
795 void CBrowserBookmarksGotoPane::SetTextModeItalicL( ) |
|
796 { |
|
797 |
|
798 // Editor Control is laid in a scalable way, so we need to get the correct font |
|
799 // specification for setting CharFormatLayer, We could have used GetNearestFontInTwips, |
|
800 // as done above in SetTextL() but it does not provide correct fonts for editor. |
|
801 // We do not need to set the FontPosture back to EPostureUpright ( Normal ), as it |
|
802 // is automatically handled by AknLayoutUtils::LayoutEdwinScalable called by |
|
803 // iInputFrame->SetRect(), which overwrites all the properties for Editor. |
|
804 |
|
805 TAknTextComponentLayout editorLayout; |
|
806 TBool apac( AknLayoutUtils::Variant() == EApacVariant && ( CAknInputFrame::EShowIndicators ) ); |
|
807 editorLayout = AknLayoutScalable_Avkon::input_find_pane_t1( apac ? 1: 0 ); |
|
808 TAknTextLineLayout lineLayout = editorLayout.LayoutLine(); |
|
809 TInt fontid = lineLayout.FontId(); |
|
810 const CAknLayoutFont *font = AknLayoutUtils::LayoutFontFromId( fontid ); |
|
811 |
|
812 TCharFormat charFormat; |
|
813 TCharFormatMask charFormatMask; |
|
814 charFormat.iFontSpec = font->FontSpecInTwips(); |
|
815 charFormat.iFontSpec.iFontStyle.SetPosture( EPostureItalic ); |
|
816 charFormatMask.SetAttrib(EAttFontTypeface); |
|
817 charFormatMask.SetAttrib(EAttFontHeight); |
|
818 charFormatMask.SetAttrib(EAttFontStrokeWeight); |
|
819 charFormatMask.SetAttrib(EAttFontPosture); |
|
820 |
|
821 // Owner ship of charFormatLayer is taken by Editor |
|
822 CCharFormatLayer* charFormatLayer = NULL; |
|
823 charFormatLayer = CCharFormatLayer::NewL(charFormat,charFormatMask); |
|
824 iEditor->SetCharFormatLayer(charFormatLayer); |
|
825 } |
|
826 |
|
827 // ---------------------------------------------------------------------------- |
|
828 // CBrowserBookmarksGotoPane::SetVKBFlag |
|
829 // ---------------------------------------------------------------------------- |
|
830 void CBrowserBookmarksGotoPane::SetVKBFlag( TBool aVKBFlag ) |
|
831 { |
|
832 if( aVKBFlag ) |
|
833 { |
|
834 iEditor->RemoveFlagFromUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
835 } |
|
836 else |
|
837 { |
|
838 iEditor->AddFlagToUserFlags( CEikEdwin::EAvkonDisableVKB ); |
|
839 } |
|
840 } |
665 // End of File |
841 // End of File |