290 |
290 |
291 void CBrowserAdaptiveListPopup::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
291 void CBrowserAdaptiveListPopup::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
292 { |
292 { |
293 if (iList && iTouchSupported) |
293 if (iList && iTouchSupported) |
294 { |
294 { |
295 TInt idx = iList->CurrentItemIndex(); |
|
296 |
|
297 //the first time |
|
298 if ( !iList->HighLightEnabled() ) |
|
299 { |
|
300 iList->SetHighLight( ETrue ); |
|
301 |
|
302 //save the original content |
|
303 if ( iFirstGotoContent != NULL ) |
|
304 { |
|
305 delete iFirstGotoContent; |
|
306 iFirstGotoContent = NULL; |
|
307 } |
|
308 iFirstGotoContent = iEditor->GetTextInHBufL(); |
|
309 if ( iFirstGotoContent == NULL ) |
|
310 { |
|
311 iFirstGotoContent = KNullDesC().AllocL(); |
|
312 } |
|
313 } |
|
314 |
|
315 //using ComponentControl(0) instead of iList because need access to a |
295 //using ComponentControl(0) instead of iList because need access to a |
316 //protected function |
296 //protected function |
317 ComponentControl(0)->HandlePointerEventL( aPointerEvent ); |
297 ComponentControl(0)->HandlePointerEventL( aPointerEvent ); |
318 TInt idx2 = iList->CurrentItemIndex(); |
|
319 if ((idx2 != idx) || (idx == 0)) // 0 is pre-selected |
|
320 { |
|
321 idx2 = iItems->Count() - idx2 - 1; |
|
322 TPtrC16 item; |
|
323 TPtrC rightSide; |
|
324 item.Set( (*iItems)[ idx2 ] ); |
|
325 //cut the slash from the end if needed |
|
326 //permanent sollution until AHLE does not |
|
327 //solve this problem related to ID: TMCN-5TTRXV error |
|
328 if ( item[item.Length() - 1] != KSlash ) |
|
329 { |
|
330 rightSide.Set( item.Left( item.Length() ) ); |
|
331 } |
|
332 else |
|
333 { |
|
334 rightSide.Set( item.Left( item.Length() - 1 ) ); |
|
335 } |
|
336 |
|
337 //if true then append the suffix(rightSide), to the |
|
338 //user-typed data |
|
339 //else just use the recent URLs text(rightSide) only |
|
340 if ( iUrlCompletionMode ) |
|
341 { |
|
342 HBufC* currentCompletion = HBufC::NewLC( |
|
343 iFirstGotoContent->Des().Length() + rightSide.Length() + 1 ); |
|
344 TPtr currentCompletionPtr = currentCompletion->Des(); |
|
345 |
|
346 currentCompletionPtr.Copy( iFirstGotoContent->Des() ); |
|
347 currentCompletionPtr.Append( rightSide ); |
|
348 currentCompletionPtr.ZeroTerminate(); |
|
349 iEditor->SetTextL( currentCompletion ); |
|
350 iEditor->SetCursorPosL( currentCompletionPtr.Length(), EFalse ); |
|
351 CleanupStack::PopAndDestroy( currentCompletion ); |
|
352 } |
|
353 else |
|
354 { |
|
355 iEditor->SetTextL( &rightSide ); |
|
356 iEditor->SetCursorPosL( rightSide.Length(), EFalse ); |
|
357 } |
|
358 iEditor->HandleTextChangedL(); |
|
359 |
|
360 delete iPrevGotoContent; |
|
361 iPrevGotoContent = NULL; |
|
362 iPrevGotoContent = item.AllocL(); |
|
363 iEditor->DrawNow(); |
|
364 //change the CBA depending on whether the highlight is |
|
365 //on url or domain |
|
366 CBrowserAppUi::Static()->UpdateCbaL(); |
|
367 } |
|
368 } |
298 } |
369 } |
299 } |
370 |
300 |
371 void CBrowserAdaptiveListPopup::HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType) |
301 void CBrowserAdaptiveListPopup::HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType) |
372 { |
302 { |
390 { |
320 { |
391 CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
321 CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKeyUp ); |
392 } |
322 } |
393 } |
323 } |
394 break; |
324 break; |
|
325 case MEikListBoxObserver::EEventItemClicked: |
|
326 HandleItemClickedL( aListBox ); |
|
327 break; |
395 default: |
328 default: |
396 break; |
329 break; |
397 } |
330 } |
398 } |
331 } |
399 } |
332 } |
|
333 |
|
334 void CBrowserAdaptiveListPopup::HandleItemClickedL( CEikListBox* aListBox ) |
|
335 { |
|
336 //the first time |
|
337 if ( !iList->HighLightEnabled() ) |
|
338 { |
|
339 iList->SetHighLight( ETrue ); |
|
340 |
|
341 //save the original content |
|
342 if ( !iFirstGotoContent ) |
|
343 { |
|
344 delete iFirstGotoContent; |
|
345 iFirstGotoContent = NULL; |
|
346 } |
|
347 iFirstGotoContent = iEditor->GetTextInHBufL(); |
|
348 if ( !iFirstGotoContent ) |
|
349 { |
|
350 iFirstGotoContent = KNullDesC().AllocL(); |
|
351 } |
|
352 } |
|
353 TInt index = aListBox->CurrentItemIndex(); |
|
354 index = iItems->Count() - index - 1; |
|
355 TPtrC16 item((*iItems)[ index ] ); |
|
356 TPtrC rightSide; |
|
357 |
|
358 //cut the slash from the end if needed |
|
359 //permanent sollution until AHLE does not |
|
360 //solve this problem related to ID: TMCN-5TTRXV error |
|
361 if ( item[item.Length() - 1] != KSlash ) |
|
362 { |
|
363 rightSide.Set( item.Left( item.Length() ) ); |
|
364 } |
|
365 else |
|
366 { |
|
367 rightSide.Set( item.Left( item.Length() - 1 ) ); |
|
368 } |
|
369 |
|
370 //if true then append the suffix(rightSide), to the |
|
371 //user-typed data |
|
372 //else just use the recent URLs text(rightSide) only |
|
373 if ( iUrlCompletionMode ) |
|
374 { |
|
375 HBufC* currentCompletion = HBufC::NewLC( |
|
376 iFirstGotoContent->Des().Length() + rightSide.Length() + 1 ); |
|
377 TPtr currentCompletionPtr = currentCompletion->Des(); |
|
378 |
|
379 currentCompletionPtr.Copy( iFirstGotoContent->Des() ); |
|
380 currentCompletionPtr.Append( rightSide ); |
|
381 currentCompletionPtr.ZeroTerminate(); |
|
382 iEditor->SetTextL( currentCompletion ); |
|
383 iEditor->SetCursorPosL( currentCompletionPtr.Length(), EFalse ); |
|
384 CleanupStack::PopAndDestroy( currentCompletion ); |
|
385 } |
|
386 else |
|
387 { |
|
388 iEditor->SetTextL( &rightSide ); |
|
389 iEditor->SetCursorPosL( rightSide.Length(), EFalse ); |
|
390 } |
|
391 iEditor->HandleTextChangedL(); |
|
392 |
|
393 delete iPrevGotoContent; |
|
394 iPrevGotoContent = NULL; |
|
395 iPrevGotoContent = item.AllocL(); |
|
396 iEditor->DrawNow(); |
|
397 //change the CBA depending on whether the highlight is |
|
398 //on url or domain |
|
399 CBrowserAppUi::Static()->UpdateCbaL(); |
|
400 } |
|
401 |
400 |
402 |
401 //------------------------------------------------------------------ |
403 //------------------------------------------------------------------ |
402 // CBrowserAdaptiveListPopup::ShowSingleItemPopupListWithGraphicsL(TBool aShowTitle) |
404 // CBrowserAdaptiveListPopup::ShowSingleItemPopupListWithGraphicsL(TBool aShowTitle) |
403 // shows "List pane for single item with graphic" |
405 // shows "List pane for single item with graphic" |
404 //------------------------------------------------------------------ |
406 //------------------------------------------------------------------ |
519 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); |
521 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); |
520 windowLineLayoutMain = AknLayout::main_pane( rect, 0, 2, 1 ); |
522 windowLineLayoutMain = AknLayout::main_pane( rect, 0, 2, 1 ); |
521 windowLineLayoutMainTmp = windowLineLayoutMain; |
523 windowLineLayoutMainTmp = windowLineLayoutMain; |
522 layoutMainRect.LayoutRect( rect, windowLineLayoutMainTmp ); |
524 layoutMainRect.LayoutRect( rect, windowLineLayoutMainTmp ); |
523 |
525 |
524 if ( iParentType == EBookmarksGotoPane ) |
526 |
525 { |
527 windowLineLayoutLW = AppLayout::popup_wml_address_window( 1, itemstoshow ); |
526 windowLineLayoutLW = AppLayout::popup_wml_address_window( 1, itemstoshow ); |
528 |
527 } |
|
528 else |
|
529 { |
|
530 windowLineLayoutLW = AppLayout::popup_wml_address_window( 1, itemstoshow ); |
|
531 } |
|
532 windowLineLayoutLWTmp = windowLineLayoutLW; |
529 windowLineLayoutLWTmp = windowLineLayoutLW; |
533 layoutLWRect.LayoutRect( layoutMainRect.Rect(), windowLineLayoutLWTmp ); |
530 layoutLWRect.LayoutRect( layoutMainRect.Rect(), windowLineLayoutLWTmp ); |
534 windowLineLayoutSLW = AknLayoutScalable_Apps::listscroll_popup_wml_pane(); |
531 windowLineLayoutSLW = AknLayoutScalable_Apps::listscroll_popup_wml_pane(); |
535 windowLineLayoutSLWTmp = windowLineLayoutSLW; |
532 windowLineLayoutSLWTmp = windowLineLayoutSLW; |
536 layoutSLWRect.LayoutRect( layoutLWRect.Rect(), windowLineLayoutSLWTmp ); |
533 layoutSLWRect.LayoutRect( layoutLWRect.Rect(), windowLineLayoutSLWTmp ); |