174 |
165 |
175 // background context |
166 // background context |
176 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
167 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
177 KAknsIIDQsnBgScreen, ScreenRect() , ETrue); |
168 KAknsIIDQsnBgScreen, ScreenRect() , ETrue); |
178 |
169 |
179 // Read needed values from cenrep |
170 // load configuration |
180 TRAP_IGNORE( FetchRepositoryDataL(); ); |
171 iConfiguration = CWmConfiguration::NewL( iWmPlugin.ResourceLoader() ); |
181 |
172 |
182 // set up controls |
173 // set up controls |
183 InitializeControlsL( aRect ); |
174 InitializeControlsL( aRect ); |
184 |
175 |
185 // set size and activate |
176 // set size and activate |
186 SetRect( aRect ); |
177 SetRect( aRect ); |
187 ActivateL(); |
178 ActivateL(); |
188 |
179 |
189 } |
180 } |
190 |
181 |
191 // --------------------------------------------------------- |
|
192 // CWmMainContainer::FetchRepositoryDataL |
|
193 // --------------------------------------------------------- |
|
194 // |
|
195 void CWmMainContainer::FetchRepositoryDataL() |
|
196 { |
|
197 iOviStoreUrl = NULL; |
|
198 iOviStoreClientBundleId = NULL; |
|
199 iOviStoreClientParam = NULL; |
|
200 |
|
201 CRepository *repository = CRepository::NewLC( |
|
202 TUid::Uid( KCrWidgetManagerm ) ); |
|
203 TInt err = KErrNone; |
|
204 |
|
205 //read localized data from cenrep |
|
206 TLanguage sysLang = User::Language(); |
|
207 for( TUint32 i = KLangId0; i <= KLangId9; i+=4 ) |
|
208 { |
|
209 TInt crLang = 0; |
|
210 err = repository->Get( i, crLang ); |
|
211 |
|
212 if ( sysLang == crLang && err == KErrNone ) |
|
213 { |
|
214 // system langauge matches langauge in cenrep |
|
215 iOviStoreUrl = HBufC::NewL( |
|
216 NCentralRepositoryConstants::KMaxUnicodeStringLength ); |
|
217 TPtr ptr( iOviStoreUrl->Des() ); |
|
218 |
|
219 // get localized ovi store url |
|
220 err = repository->Get( i + KOviStoreBrowserUrlOffset, ptr ); |
|
221 if ( err != KErrNone ) |
|
222 { |
|
223 delete iOviStoreUrl; |
|
224 iOviStoreUrl = NULL; |
|
225 } |
|
226 } |
|
227 } |
|
228 |
|
229 //read other data from cenrep |
|
230 iOviStoreClientBundleId = HBufC::NewL( |
|
231 NCentralRepositoryConstants::KMaxUnicodeStringLength ); |
|
232 TPtr ptr( iOviStoreClientBundleId->Des() ); |
|
233 err = repository->Get( KOviStoreBunbleId, ptr ); |
|
234 if ( err != KErrNone ) |
|
235 { |
|
236 delete iOviStoreClientBundleId; |
|
237 iOviStoreClientBundleId = NULL; |
|
238 } |
|
239 |
|
240 iOviStoreClientParam = HBufC::NewL( |
|
241 NCentralRepositoryConstants::KMaxUnicodeStringLength ); |
|
242 ptr.Set( iOviStoreClientParam->Des() ); |
|
243 err = repository->Get( KOviStoreClientParam, ptr ); |
|
244 if ( err != KErrNone ) |
|
245 { |
|
246 delete iOviStoreClientParam; |
|
247 iOviStoreClientParam = NULL; |
|
248 } |
|
249 |
|
250 CleanupStack::PopAndDestroy( repository ); |
|
251 } |
|
252 |
|
253 // --------------------------------------------------------- |
182 // --------------------------------------------------------- |
254 // CWmMainContainer::SizeChanged |
183 // CWmMainContainer::SizeChanged |
255 // --------------------------------------------------------- |
184 // --------------------------------------------------------- |
256 // |
185 // |
257 void CWmMainContainer::SizeChanged() |
186 void CWmMainContainer::SizeChanged() |
314 // --------------------------------------------------------- |
244 // --------------------------------------------------------- |
315 // CWmMainContainer::OfferKeyEventL |
245 // CWmMainContainer::OfferKeyEventL |
316 // --------------------------------------------------------- |
246 // --------------------------------------------------------- |
317 // |
247 // |
318 TKeyResponse CWmMainContainer::OfferKeyEventL( |
248 TKeyResponse CWmMainContainer::OfferKeyEventL( |
319 const TKeyEvent& aKeyEvent, |
249 const TKeyEvent& aKeyEvent, |
320 TEventCode aType ) |
250 TEventCode aType ) |
321 { |
251 { |
322 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
252 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
323 |
253 |
324 if ( iFindbox ) |
254 // This is a bug fix for ou1cimx1#217716 & ou1cimx1#217667. |
325 { |
255 // For some weird reason homescreen is genarating one extra EEventKey |
326 // open search field with alpha digit numbers |
256 // when using Nokia SU-8W bluetooth keyboard & backspace key. This if is to |
327 if ( aType == EEventKeyDown && !iFindPaneIsVisible && |
257 // ignore that event. Extra event allways has iModifiers set to |
328 aKeyEvent.iScanCode < EStdKeyF1 && |
258 // EModifierAutorepeatable. |
329 TChar(aKeyEvent.iScanCode).IsAlphaDigit() ) |
259 if ( aType == EEventKey && |
330 { |
260 aKeyEvent.iScanCode == EStdKeyBackspace && |
331 ActivateFindPaneL(); |
261 aKeyEvent.iModifiers == EModifierAutorepeatable ) |
332 |
262 { |
333 if ( iFindPaneIsVisible ) |
263 return EKeyWasNotConsumed; |
334 { |
264 } |
335 return EKeyWasConsumed; |
265 |
336 } |
266 // Handle search keyevent |
337 } |
267 keyResponse = HandleSearchKeyEventL( aKeyEvent, aType ); |
|
268 |
|
269 // Move focus between controls |
|
270 if ( keyResponse == EKeyWasNotConsumed ) |
|
271 { |
|
272 keyResponse = MoveFocusByKeys( aKeyEvent, aType ); |
|
273 } |
|
274 |
|
275 // Handle list keyevent |
|
276 if ( keyResponse == EKeyWasNotConsumed ) |
|
277 { |
|
278 keyResponse = HandleListKeyEventL( aKeyEvent, aType ); |
|
279 } |
|
280 |
|
281 // Handle buttons keyevent |
|
282 if ( keyResponse == EKeyWasNotConsumed ) |
|
283 { |
|
284 keyResponse = HandleButtonKeyEventL( aKeyEvent, aType ); |
|
285 } |
|
286 |
|
287 // Update ui if needed |
|
288 if ( keyResponse == EKeyWasConsumed ) |
|
289 { |
|
290 DrawDeferred(); |
|
291 } |
|
292 |
|
293 // Do not let UI framework forward the keys to child controls as |
|
294 // we have already done that. |
|
295 return EKeyWasConsumed; |
|
296 } |
|
297 |
|
298 TKeyResponse CWmMainContainer::HandleSearchKeyEventL( |
|
299 const TKeyEvent& aKeyEvent, |
|
300 TEventCode aType ) |
|
301 { |
|
302 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
303 |
|
304 // open search field with alpha digit numbers |
|
305 if ( aType == EEventKeyDown && !iFindPaneIsVisible && |
|
306 aKeyEvent.iScanCode < EStdKeyF1 && |
|
307 TChar( aKeyEvent.iScanCode ).IsAlphaDigit() ) |
|
308 { |
|
309 ActivateFindPaneL(); |
338 |
310 |
339 if ( iFindPaneIsVisible ) |
311 if ( iFindPaneIsVisible ) |
340 { |
312 { |
341 // deactive the FindPane when Back has been pressed |
313 return EKeyWasConsumed; |
342 if ( aType == EEventKeyDown && |
314 } |
343 aKeyEvent.iScanCode == EStdKeyBackspace ) |
315 } |
344 { |
316 |
345 TBuf<KTextLimit> searchText; |
317 if ( iFindPaneIsVisible && aType == EEventKey ) |
346 iFindbox->GetSearchText( searchText ); |
318 { |
347 if ( searchText == KNullDesC ) |
319 if ( aKeyEvent.iScanCode == EStdKeyNo || aKeyEvent.iCode == EKeyNo ) |
348 { |
320 { |
349 DeactivateFindPaneL(); |
321 DeactivateFindPaneL(); |
350 return EKeyWasConsumed; |
322 return EKeyWasConsumed; |
351 } |
323 } |
352 } |
324 |
353 |
325 TBool needsRefresh( EFalse ); |
354 // Cancel-selected need to unfocus findbox |
326 |
355 // to receive event in ProcessCommand |
327 if ( iFindbox->TextLength() == 0 |
356 if ( aType == EEventKeyDown |
328 && aKeyEvent.iScanCode == EStdKeyBackspace ) |
357 && aKeyEvent.iScanCode == EStdKeyDevice1 ) |
329 { |
358 { |
330 // if lenght is 0 and backspace is pressed AknFind will deactivate |
359 iFindbox->SetFocus( EFalse ); |
331 // searchbox so we don't want to pass this event to AknFind |
360 UpdateFocusMode(); |
332 keyResponse = EKeyWasConsumed; |
361 return EKeyWasConsumed; |
333 } |
362 } |
334 else |
363 |
335 { |
364 if ( aKeyEvent.iScanCode == EStdKeyNo || |
|
365 aKeyEvent.iCode == EKeyNo ) |
|
366 { |
|
367 DeactivateFindPaneL(); |
|
368 return EKeyWasConsumed; |
|
369 } |
|
370 |
|
371 // find items with all event codes (that's the reason why there is EEventKey instead of aType) |
|
372 TBool needsRefresh( EFalse ); |
|
373 keyResponse = AknFind::HandleFindOfferKeyEventL( |
336 keyResponse = AknFind::HandleFindOfferKeyEventL( |
374 aKeyEvent, EEventKey, this, |
337 aKeyEvent, aType, this, |
375 iWidgetsList, iFindbox, ETrue, needsRefresh ); |
338 iWidgetsList, iFindbox, ETrue, needsRefresh ); |
376 if ( needsRefresh ) |
339 } |
377 { |
340 if ( needsRefresh ) |
378 DrawNow(); |
341 { |
379 } |
342 DrawNow(); |
380 } |
343 } |
381 } |
344 } |
382 |
345 |
383 // check special cases for movement between controls |
346 return keyResponse; |
384 if ( keyResponse == EKeyWasNotConsumed && !iFindPaneIsVisible ) |
347 } |
385 { |
348 |
386 keyResponse = MoveFocusByKeys( aKeyEvent, aType ); |
349 TKeyResponse CWmMainContainer::HandleListKeyEventL( |
387 } |
350 const TKeyEvent& aKeyEvent, |
388 |
351 TEventCode aType ) |
|
352 { |
|
353 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
354 |
389 // pass key event except backpace or delete key event to widgets list if focused |
355 // pass key event except backpace or delete key event to widgets list if focused |
390 if ( keyResponse == EKeyWasNotConsumed && iWidgetsList->IsFocused() ) |
356 if ( iWidgetsList->IsFocused() ) |
391 { |
357 { |
392 if ( (aType == EEventKey) && (aKeyEvent.iCode == EKeyBackspace || aKeyEvent.iCode == EKeyDelete)) |
358 if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyBackspace |
|
359 || aKeyEvent.iCode == EKeyDelete ) ) |
393 { |
360 { |
394 if( CanDoUninstall() ) |
361 if( CanDoUninstall() ) |
395 { |
362 { |
396 UninstallWidgetL(); |
363 UninstallWidgetL(); |
397 } |
364 } |
400 CWmWidgetData* data = iWidgetsList->WidgetData(); |
367 CWmWidgetData* data = iWidgetsList->WidgetData(); |
401 if( data != NULL ) |
368 if( data != NULL ) |
402 iWmPlugin.ResourceLoader().InfoPopupL( |
369 iWmPlugin.ResourceLoader().InfoPopupL( |
403 R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() ); |
370 R_QTN_WM_UNINST_NOT_ALLOWED, data->Name() ); |
404 } |
371 } |
|
372 keyResponse = EKeyWasConsumed; |
405 } |
373 } |
406 else |
374 else |
407 { |
375 { |
408 //passing to listbox handler |
376 //passing to listbox handler |
409 keyResponse = iWidgetsList->OfferKeyEventL( |
377 keyResponse = iWidgetsList->OfferKeyEventL( |
410 aKeyEvent, aType ); |
378 aKeyEvent, aType ); |
411 } |
379 } |
412 } |
380 } |
413 |
381 |
414 // pass key event to OVI portal if focused |
382 return keyResponse; |
415 if ( keyResponse == EKeyWasNotConsumed && iOviPortal->IsFocused() ) |
383 } |
416 { |
384 |
417 keyResponse = iOviPortal->OfferKeyEventL( |
385 TKeyResponse CWmMainContainer::HandleButtonKeyEventL( |
|
386 const TKeyEvent& aKeyEvent, |
|
387 TEventCode aType ) |
|
388 { |
|
389 TKeyResponse keyResponse( EKeyWasNotConsumed ); |
|
390 |
|
391 // pass key event to portal button if focused |
|
392 if ( iPortalButtonOne->IsFocused() ) |
|
393 { |
|
394 keyResponse = iPortalButtonOne->OfferKeyEventL( |
418 aKeyEvent, aType ); |
395 aKeyEvent, aType ); |
419 } |
396 } |
420 |
397 |
421 if ( keyResponse == EKeyWasConsumed ) |
398 // pass key event to the other portal button if exists and focused |
422 DrawDeferred(); |
399 if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
423 |
400 { |
424 // Do not let UI framework forward the keys to child controls as |
401 keyResponse = iPortalButtonTwo->OfferKeyEventL( |
425 // we have already done that. |
402 aKeyEvent, aType ); |
426 return EKeyWasConsumed; |
403 } |
427 } |
404 |
428 |
405 return keyResponse; |
|
406 } |
429 |
407 |
430 // --------------------------------------------------------- |
408 // --------------------------------------------------------- |
431 // CWmMainContainer::MoveFocusByKeys |
409 // CWmMainContainer::MoveFocusByKeys |
432 // --------------------------------------------------------- |
410 // --------------------------------------------------------- |
433 // |
411 // |
446 aKeyEvent.iScanCode == EStdKeyUpArrow && |
424 aKeyEvent.iScanCode == EStdKeyUpArrow && |
447 iWidgetsList->CurrentItemIndex() == 0 ) |
425 iWidgetsList->CurrentItemIndex() == 0 ) |
448 { |
426 { |
449 // widget list top -> up -> ovi button (portrait) |
427 // widget list top -> up -> ovi button (portrait) |
450 if ( aType == EEventKey ) |
428 if ( aType == EEventKey ) |
451 SetFocusToOviButton(); |
429 SetFocusToPortalButton( 0 ); |
452 keyResponse = EKeyWasConsumed; |
430 keyResponse = EKeyWasConsumed; |
453 } |
431 } |
454 else if ( iLayout == EPortrait && |
432 else if ( iLayout == EPortrait && |
455 aKeyEvent.iScanCode == EStdKeyDownArrow && |
433 aKeyEvent.iScanCode == EStdKeyDownArrow && |
456 iWidgetsList->CurrentItemIndex() == |
434 iWidgetsList->CurrentItemIndex() == |
457 iWidgetsList->Model()->NumberOfItems() - 1 ) |
435 iWidgetsList->Model()->NumberOfItems() - 1 ) |
458 { |
436 { |
459 // widget list bottom -> down -> ovi button (portrait) |
437 // widget list bottom -> down -> ovi button (portrait) |
460 if ( aType == EEventKey ) |
438 if ( aType == EEventKey ) |
461 SetFocusToOviButton(); |
439 SetFocusToPortalButton( 0 ); |
462 keyResponse = EKeyWasConsumed; |
440 keyResponse = EKeyWasConsumed; |
463 } |
441 } |
464 else if ( iLayout == ELandscape && |
442 else if ( iLayout == ELandscape && |
465 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
443 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
466 { |
444 { |
467 // widget list -> right -> ovi button (landscape) |
445 // widget list -> right -> ovi button (landscape) |
468 if ( aType == EEventKey ) |
446 if ( aType == EEventKey ) |
469 SetFocusToOviButton(); |
447 SetFocusToPortalButton( 0 ); |
470 keyResponse = EKeyWasConsumed; |
448 keyResponse = EKeyWasConsumed; |
471 } |
449 } |
472 else if ( iLayout == ELandscapeMirrored && |
450 else if ( iLayout == ELandscapeMirrored && |
473 aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
451 aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
474 { |
452 { |
475 // widget list -> left -> ovi button (landscape mirrored) |
453 // widget list -> left -> ovi button (landscape mirrored) |
476 if ( aType == EEventKey ) |
454 if ( aType == EEventKey ) |
477 SetFocusToOviButton(); |
455 SetFocusToPortalButton( 0 ); |
478 keyResponse = EKeyWasConsumed; |
456 keyResponse = EKeyWasConsumed; |
479 } |
457 } |
480 } |
458 } |
481 else if ( iOviPortal->IsFocused() ) |
459 else if ( iPortalButtonOne->IsFocused() ) |
482 { |
460 { |
483 // ------------------------------------ |
461 // ------------------------------------ |
484 // focus is in the OVI PORTAL BUTTON |
462 // focus is in the FIRST PORTAL BUTTON |
485 // ------------------------------------ |
463 // ------------------------------------ |
486 if ( iLayout == EPortrait && |
464 if ( iLayout == EPortrait && |
487 aKeyEvent.iScanCode == EStdKeyDownArrow ) |
465 aKeyEvent.iScanCode == EStdKeyDownArrow ) |
488 { |
466 { |
489 // ovi button -> down -> widget list top (portrait) |
467 // left portal -> down -> widget list top |
490 if ( aType == EEventKey ) |
468 if ( aType == EEventKey ) |
491 SetFocusToWidgetList( 0 ); |
469 SetFocusToWidgetList( 0 ); |
492 keyResponse = EKeyWasConsumed; |
470 keyResponse = EKeyWasConsumed; |
493 } |
471 } |
494 else if ( iLayout == EPortrait && |
472 else if ( iLayout == EPortrait && |
495 aKeyEvent.iScanCode == EStdKeyUpArrow ) |
473 aKeyEvent.iScanCode == EStdKeyUpArrow ) |
496 { |
474 { |
497 // obi button -> up -> widget list bottom (portrait) |
475 // left portal -> up -> widget list bottom |
498 if ( aType == EEventKey ) |
476 if ( aType == EEventKey ) |
499 SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 ); |
477 SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 ); |
|
478 keyResponse = EKeyWasConsumed; |
|
479 } |
|
480 else if ( iLayout == EPortrait && |
|
481 aKeyEvent.iScanCode == EStdKeyRightArrow && |
|
482 iConfiguration->PortalButtonCount() > 1 ) |
|
483 { |
|
484 // left portal -> right -> right portal |
|
485 if ( aType == EEventKey ) |
|
486 SetFocusToPortalButton( 1 ); |
500 keyResponse = EKeyWasConsumed; |
487 keyResponse = EKeyWasConsumed; |
501 } |
488 } |
502 else if ( iLayout == ELandscape && |
489 else if ( iLayout == ELandscape && |
503 aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
490 aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
504 { |
491 { |
505 // ovi button -> left -> widget list (landscape) |
492 // upper portal -> left -> widget list |
506 if ( aType == EEventKey ) |
493 if ( aType == EEventKey ) |
507 SetFocusToWidgetList(); |
494 SetFocusToWidgetList(); |
508 keyResponse = EKeyWasConsumed; |
495 keyResponse = EKeyWasConsumed; |
509 } |
496 } |
510 else if ( iLayout == ELandscapeMirrored && |
497 else if ( iLayout == ELandscapeMirrored && |
511 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
498 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
512 { |
499 { |
513 // ovi button -> right -> widget list (landscape mirrored) |
500 // upper portal -> right -> widget list (mirrored) |
514 if ( aType == EEventKey ) |
501 if ( aType == EEventKey ) |
515 SetFocusToWidgetList(); |
502 SetFocusToWidgetList(); |
|
503 keyResponse = EKeyWasConsumed; |
|
504 } |
|
505 else if ( ( iLayout == ELandscape || |
|
506 iLayout == ELandscapeMirrored ) && |
|
507 aKeyEvent.iScanCode == EStdKeyDownArrow && |
|
508 iConfiguration->PortalButtonCount() > 1 ) |
|
509 { |
|
510 // upper portal -> down -> lower portal |
|
511 if ( aType == EEventKey ) |
|
512 SetFocusToPortalButton( 1 ); |
|
513 keyResponse = EKeyWasConsumed; |
|
514 } |
|
515 } |
|
516 else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
|
517 { |
|
518 // ------------------------------------ |
|
519 // focus is in the SECOND PORTAL BUTTON |
|
520 // ------------------------------------ |
|
521 if ( iLayout == EPortrait && |
|
522 aKeyEvent.iScanCode == EStdKeyDownArrow ) |
|
523 { |
|
524 // right portal -> down -> widget list top |
|
525 if ( aType == EEventKey ) |
|
526 SetFocusToWidgetList( 0 ); |
|
527 keyResponse = EKeyWasConsumed; |
|
528 } |
|
529 else if ( iLayout == EPortrait && |
|
530 aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
531 { |
|
532 // right portal -> up -> widget list bottom |
|
533 if ( aType == EEventKey ) |
|
534 SetFocusToWidgetList( iWidgetsList->Model()->NumberOfItems()-1 ); |
|
535 keyResponse = EKeyWasConsumed; |
|
536 } |
|
537 else if ( iLayout == EPortrait && |
|
538 aKeyEvent.iScanCode == EStdKeyRightArrow && |
|
539 iConfiguration->PortalButtonCount() > 1 ) |
|
540 { |
|
541 // right portal -> right -> left portal |
|
542 if ( aType == EEventKey ) |
|
543 SetFocusToPortalButton( 0 ); |
|
544 keyResponse = EKeyWasConsumed; |
|
545 } |
|
546 else if ( iLayout == ELandscape && |
|
547 aKeyEvent.iScanCode == EStdKeyLeftArrow ) |
|
548 { |
|
549 // lower portal -> left -> widget list |
|
550 if ( aType == EEventKey ) |
|
551 SetFocusToWidgetList(); |
|
552 keyResponse = EKeyWasConsumed; |
|
553 } |
|
554 else if ( iLayout == ELandscapeMirrored && |
|
555 aKeyEvent.iScanCode == EStdKeyRightArrow ) |
|
556 { |
|
557 // lower portal -> right -> widget list (mirrored) |
|
558 if ( aType == EEventKey ) |
|
559 SetFocusToWidgetList(); |
|
560 keyResponse = EKeyWasConsumed; |
|
561 } |
|
562 else if ( ( iLayout == ELandscape || |
|
563 iLayout == ELandscapeMirrored ) && |
|
564 aKeyEvent.iScanCode == EStdKeyUpArrow ) |
|
565 { |
|
566 // lower portal -> up -> upper portal |
|
567 if ( aType == EEventKey ) |
|
568 SetFocusToPortalButton( 0 ); |
516 keyResponse = EKeyWasConsumed; |
569 keyResponse = EKeyWasConsumed; |
517 } |
570 } |
518 } |
571 } |
519 else |
572 else |
520 { |
573 { |
535 |
588 |
536 return keyResponse; |
589 return keyResponse; |
537 } |
590 } |
538 |
591 |
539 // --------------------------------------------------------- |
592 // --------------------------------------------------------- |
540 // CWmMainContainer::SetFocusToOviButton |
593 // CWmMainContainer::SetFocusToPortalButton |
541 // --------------------------------------------------------- |
594 // --------------------------------------------------------- |
542 // |
595 // |
543 void CWmMainContainer::SetFocusToOviButton() |
596 void CWmMainContainer::SetFocusToPortalButton( TInt aIndex ) |
544 { |
597 { |
545 iWidgetsList->SetFocus(EFalse); |
598 if ( aIndex != 0 && iPortalButtonTwo ) |
546 iOviPortal->SetFocus(ETrue); |
599 { |
|
600 iWidgetsList->SetFocus(EFalse); |
|
601 iPortalButtonOne->SetFocus(EFalse); |
|
602 iPortalButtonTwo->SetFocus(ETrue); |
|
603 } |
|
604 else |
|
605 { |
|
606 iWidgetsList->SetFocus(EFalse); |
|
607 if ( iPortalButtonTwo ) |
|
608 iPortalButtonTwo->SetFocus(EFalse); |
|
609 iPortalButtonOne->SetFocus(ETrue); |
|
610 } |
547 DrawDeferred(); |
611 DrawDeferred(); |
548 UpdateFocusMode(); |
612 UpdateFocusMode(); |
549 } |
613 } |
550 |
614 |
551 // --------------------------------------------------------- |
615 // --------------------------------------------------------- |
552 // CWmMainContainer::SetFocusToWidgetList |
616 // CWmMainContainer::SetFocusToWidgetList |
553 // --------------------------------------------------------- |
617 // --------------------------------------------------------- |
554 // |
618 // |
555 void CWmMainContainer::SetFocusToWidgetList( TInt aIndex ) |
619 void CWmMainContainer::SetFocusToWidgetList( TInt aIndex ) |
556 { |
620 { |
557 iOviPortal->SetFocus(EFalse); |
621 iPortalButtonOne->SetFocus(EFalse); |
|
622 if ( iPortalButtonTwo ) |
|
623 iPortalButtonTwo->SetFocus(EFalse); |
|
624 if ( aIndex >= 0 && aIndex < iWidgetsList->Model()->NumberOfItems() ) |
|
625 { |
|
626 iWidgetsList->SetCurrentItemIndex( aIndex ); |
|
627 } |
558 iWidgetsList->SetFocus(ETrue); |
628 iWidgetsList->SetFocus(ETrue); |
559 if ( aIndex >= 0 && aIndex < iWidgetsList->Model()->NumberOfItems() ) |
|
560 { |
|
561 iWidgetsList->SetCurrentItemIndex( aIndex ); |
|
562 } |
|
563 DrawDeferred(); |
629 DrawDeferred(); |
564 UpdateFocusMode(); |
630 UpdateFocusMode(); |
565 } |
631 } |
566 |
632 |
567 // --------------------------------------------------------- |
633 // --------------------------------------------------------- |
568 // CWmMainContainer::UpdateFocusMode |
634 // CWmMainContainer::UpdateFocusMode |
569 // --------------------------------------------------------- |
635 // --------------------------------------------------------- |
570 // |
636 // |
571 void CWmMainContainer::UpdateFocusMode() |
637 void CWmMainContainer::UpdateFocusMode() |
572 { |
638 { |
573 if ( iOviPortal->IsFocused() ) |
639 if ( iPortalButtonOne->IsFocused() ) |
574 { |
640 { |
575 // OVI BUTTON is focused |
641 // PORTAL BUTTON is focused |
576 iFocusMode = EOvi; |
642 iFocusMode = EPortal; |
|
643 } |
|
644 else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
|
645 { |
|
646 // SECOND PORTAL BUTTON is focused |
|
647 iFocusMode = EPortal; |
577 } |
648 } |
578 else if( ( iFindPaneIsVisible ) && |
649 else if( ( iFindPaneIsVisible ) && |
579 ( iFindbox->IsFocused() || iWidgetsList->IsFocused() ) ) |
650 ( iFindbox->IsFocused() || iWidgetsList->IsFocused() ) ) |
580 { |
651 { |
581 // FIND MODE |
652 // FIND MODE |
1074 // |
1172 // |
1075 void CWmMainContainer::UninstallWidgetL() |
1173 void CWmMainContainer::UninstallWidgetL() |
1076 { |
1174 { |
1077 if ( CanDoUninstall() ) |
1175 if ( CanDoUninstall() ) |
1078 { |
1176 { |
1079 CWmWidgetData* data = iWidgetsList->WidgetData(); |
1177 iWidgetsList->WidgetData()->UnInstallL(); |
1080 |
1178 } |
1081 SwiUI::RSWInstLauncher installer; |
1179 } |
1082 User::LeaveIfError( installer.Connect() ); |
1180 |
1083 |
1181 // --------------------------------------------------------------------------- |
1084 installer.Uninstall( data->PublisherUid(), KWrtMime ); |
1182 // CWmMainContainer::OpenPortalL |
1085 installer.Close(); |
1183 // --------------------------------------------------------------------------- |
1086 } |
1184 // |
1087 } |
1185 void CWmMainContainer::OpenPortalL() |
1088 |
|
1089 // --------------------------------------------------------------------------- |
|
1090 // CWmMainContainer::OpenOviPortalL |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // |
|
1093 void CWmMainContainer::OpenOviPortalL() |
|
1094 { |
1186 { |
1095 if ( !iClosingDown ) |
1187 if ( !iClosingDown ) |
1096 { |
1188 { |
1097 RApaLsSession session; |
1189 // execute whichever of the portal buttons happens to be active |
1098 User::LeaveIfError( session.Connect() ); |
1190 if ( iPortalButtonOne->IsFocused() ) |
1099 CleanupClosePushL( session ); |
1191 iPortalButtonOne->ExecuteL(); |
1100 TApaAppInfo appInfo; |
1192 else if ( iPortalButtonTwo && iPortalButtonTwo->IsFocused() ) |
1101 TUid launchUid; |
1193 iPortalButtonTwo->ExecuteL(); |
1102 |
1194 else if ( !iPortalButtonTwo ) |
1103 // Get ovi store uid |
1195 iPortalButtonOne->ExecuteL(); |
1104 RWidgetRegistryClientSession widgetSession; |
|
1105 User::LeaveIfError( widgetSession.Connect() ); |
|
1106 CleanupClosePushL( widgetSession ); |
|
1107 |
|
1108 launchUid.iUid = widgetSession.GetWidgetUidL( *iOviStoreClientBundleId ); |
|
1109 CleanupStack::PopAndDestroy( &widgetSession ); |
|
1110 |
|
1111 TInt err = session.GetAppInfo( appInfo, launchUid ); |
|
1112 if ( err == KErrNone ) |
|
1113 { |
|
1114 CApaCommandLine* commandLine = CApaCommandLine::NewLC(); |
|
1115 commandLine->SetExecutableNameL(appInfo.iFullName); |
|
1116 HBufC8* buf8 = HBufC8::NewLC( iOviStoreClientParam->Des().Length() ); |
|
1117 buf8->Des().Copy( *iOviStoreClientParam ); |
|
1118 |
|
1119 //cmdLine->SetOpaqueDataL( *buf8 ); |
|
1120 commandLine->SetTailEndL( *buf8 ); |
|
1121 err = session.StartApp( *commandLine ); |
|
1122 CleanupStack::PopAndDestroy( buf8 ); |
|
1123 CleanupStack::PopAndDestroy( commandLine ); |
|
1124 } |
|
1125 else |
|
1126 { |
|
1127 if( iOviStoreUrl ) |
|
1128 { |
|
1129 // Ovi store not found start browser |
|
1130 const TUid KOSSBrowserUidValue = { 0x10008D39 }; |
|
1131 HBufC* param = HBufC::NewLC( iOviStoreUrl->Length() + |
|
1132 KBrowserPrefix().Length() ); |
|
1133 |
|
1134 param->Des().Copy( KBrowserPrefix ); |
|
1135 param->Des().Append( *iOviStoreUrl ); |
|
1136 |
|
1137 TUid id( KOSSBrowserUidValue ); |
|
1138 |
|
1139 TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); |
|
1140 TApaTask task = taskList.FindApp(id); |
|
1141 if( task.Exists() ) |
|
1142 { |
|
1143 task.BringToForeground(); |
|
1144 HBufC8* param8 = HBufC8::NewLC(param->Length()); |
|
1145 param8->Des().Append(*param); |
|
1146 task.SendMessage(TUid::Uid(0), *param8); // UID not used |
|
1147 CleanupStack::PopAndDestroy(param8); |
|
1148 } |
|
1149 else |
|
1150 { |
|
1151 if( !session.Handle() ) |
|
1152 { |
|
1153 User::LeaveIfError( session.Connect() ); |
|
1154 } |
|
1155 TThreadId thread; |
|
1156 User::LeaveIfError(session.StartDocument(*param, KOSSBrowserUidValue, thread)); |
|
1157 |
|
1158 } |
|
1159 CleanupStack::PopAndDestroy( param ); |
|
1160 } |
|
1161 } |
|
1162 CleanupStack::PopAndDestroy( &session ); |
|
1163 } |
1196 } |
1164 } |
1197 } |
1165 |
1198 |
1166 // --------------------------------------------------------------------------- |
1199 // --------------------------------------------------------------------------- |
1167 // CWmMainContainer::SelectL |
1200 // CWmMainContainer::SelectL |