128 iSwiProp.Close(); |
130 iSwiProp.Close(); |
129 |
131 |
130 delete iUpdateStarter; |
132 delete iUpdateStarter; |
131 delete iPreviewProvider; |
133 delete iPreviewProvider; |
132 |
134 |
133 // delete the bitmaps as the hash map cannot do that |
|
134 THashMapIter<TInt, CFbsBitmap*> iter( iScreenshots ); |
|
135 while ( const TInt* key = iter.NextKey() ) |
|
136 { |
|
137 CFbsBitmap** value = iter.CurrentValue(); |
|
138 delete *value; |
|
139 } |
|
140 iScreenshots.Close(); |
|
141 delete iAppIcons; |
|
142 |
|
143 iData.ResetAndDestroy(); |
|
144 iWgIds.Close(); |
135 iWgIds.Close(); |
145 |
136 |
146 delete iHiddenAppList; |
|
147 delete iAlwaysShownAppList; |
|
148 delete iWidgetList; |
|
149 iAppArcSession.Close(); |
137 iAppArcSession.Close(); |
150 iWsSession.Close(); |
138 iWsSession.Close(); |
151 |
139 |
152 for ( TInt i = 0; i < iRotaTasks.Count(); i++ ) |
140 for ( TInt i = 0; i < iRotaTasks.Count(); i++ ) |
153 { |
141 { |
154 iRotaTasks[i]->Cancel(); |
142 iRotaTasks[i]->Cancel(); |
155 delete iRotaTasks[i]; |
143 delete iRotaTasks[i]; |
156 } |
144 } |
157 iRotaTasks.Close(); |
145 iRotaTasks.Close(); |
158 // delete iContextUtility; |
146 delete iDataList; |
|
147 delete iCpsWidgetPublisher; |
159 } |
148 } |
160 |
149 |
161 // -------------------------------------------------------------------------- |
150 // -------------------------------------------------------------------------- |
162 // CTsFswEngine::FswDataL |
151 // CTsFswEngine::FswDataL |
163 // -------------------------------------------------------------------------- |
152 // -------------------------------------------------------------------------- |
164 // |
153 // |
165 EXPORT_C const RTsFswArray& CTsFswEngine::FswDataL() |
154 EXPORT_C const RTsFswArray& CTsFswEngine::FswDataL() |
166 { |
155 { |
167 TSLOG_CONTEXT( FswDataL, TSLOG_LOCAL ); |
156 TSLOG_CONTEXT( FswDataL, TSLOG_LOCAL ); |
168 TSLOG1_IN( "dirty flag = %d", iTaskListDirty ); |
157 TSLOG_OUT(); |
169 |
158 return iDataList->FswDataL(); |
170 // check the dirty flag and refresh if needed |
|
171 if ( iTaskListDirty ) |
|
172 { |
|
173 CollectTasksL(); |
|
174 // dirty flag is cleared in the above call |
|
175 } |
|
176 |
|
177 // Get app icon for entries without screenshot, |
|
178 // do this only here as the app icon is not needed in case a screenshot |
|
179 // is already available. |
|
180 for ( TInt i = 0, ie = iData.Count(); i != ie; ++i ) |
|
181 { |
|
182 if ( !iData[i]->ScreenshotHandle() ) |
|
183 { |
|
184 CFbsBitmap* bmp; |
|
185 CFbsBitmap* mask; |
|
186 TUid appUid = iData[i]->AppUid(); |
|
187 // this will leave with -46 in case of widgets if we do not have AllFiles cap |
|
188 TRAPD( err, iAppIcons->GetIconL( appUid, bmp, mask ) ); |
|
189 if ( err == KErrNone && bmp ) |
|
190 { |
|
191 iData[i]->SetAppIconHandles( bmp->Handle(), |
|
192 mask ? mask->Handle() : 0 ); |
|
193 } |
|
194 else |
|
195 { |
|
196 iAppIcons->DefaultIcon( bmp, mask ); |
|
197 iData[i]->SetAppIconHandles( bmp->Handle(), |
|
198 mask ? mask->Handle() : 0 ); |
|
199 } |
|
200 } |
|
201 } |
|
202 |
|
203 TSLOG_OUT(); |
|
204 return iData; |
|
205 } |
159 } |
206 |
160 |
207 // -------------------------------------------------------------------------- |
161 // -------------------------------------------------------------------------- |
208 // CTsFswEngine::CloseAppL |
162 // CTsFswEngine::CloseAppL |
209 // -------------------------------------------------------------------------- |
163 // -------------------------------------------------------------------------- |
408 // -------------------------------------------------------------------------- |
348 // -------------------------------------------------------------------------- |
409 // |
349 // |
410 TBool CTsFswEngine::CollectTasksL() |
350 TBool CTsFswEngine::CollectTasksL() |
411 { |
351 { |
412 TSLOG_CONTEXT( CollectTasksL, TSLOG_LOCAL ); |
352 TSLOG_CONTEXT( CollectTasksL, TSLOG_LOCAL ); |
413 TSLOG_IN(); |
353 TBool changed = iDataList->CollectTasksL(); |
414 |
|
415 // clear dirty flag |
|
416 iTaskListDirty = EFalse; |
|
417 |
|
418 TBool changed = EFalse; |
|
419 RTsFswArray newList; |
|
420 CleanupResetAndDestroyPushL( newList ); |
|
421 |
|
422 // update app data if needed |
|
423 // (usually on startup and when new apps might have been installed) |
|
424 if ( iAppDataRefreshNeeded ) |
|
425 { |
|
426 TSLOG0( TSLOG_INFO, "refreshing app data" ); |
|
427 iAppArcSession.GetAllApps(); |
|
428 iAlwaysShownAppList->InitializeAlwaysShownListL(); |
|
429 iAppDataRefreshNeeded = EFalse; |
|
430 } |
|
431 |
|
432 // get all window groups |
|
433 RArray<RWsSession::TWindowGroupChainInfo> allWgIds; |
|
434 CleanupClosePushL( allWgIds ); |
|
435 User::LeaveIfError( iWsSession.WindowGroupList( 0, &allWgIds ) ); |
|
436 TInt count = allWgIds.Count(); |
|
437 |
|
438 for ( TInt i = 0; i < count; ++i ) |
|
439 { |
|
440 // ignore uninteresting entries (e.g. embedded apps) |
|
441 if ( allWgIds[i].iParentId > 0 ) |
|
442 { |
|
443 continue; |
|
444 } |
|
445 |
|
446 // get window group name |
|
447 TInt wgId = allWgIds[i].iId; |
|
448 CApaWindowGroupName* windowName = |
|
449 CApaWindowGroupName::NewLC( iWsSession, wgId ); |
|
450 TUid appUid = windowName->AppUid(); |
|
451 |
|
452 // ignore entries with null uid |
|
453 if ( !appUid.iUid ) |
|
454 { |
|
455 CleanupStack::PopAndDestroy( windowName ); |
|
456 continue; |
|
457 } |
|
458 |
|
459 // will append the task to our own list only if it is not hidden |
|
460 TBool onHiddenList = iHiddenAppList->IsHiddenL( |
|
461 appUid, iWsSession, wgId ); |
|
462 |
|
463 // get screen number (-1=console, 0=main screen, 1=cover ui) |
|
464 TInt appScreen = 0; |
|
465 TInt scrNumErr = iAppArcSession.GetDefaultScreenNumber( appScreen, appUid ); |
|
466 |
|
467 // check if it is on always-shown list |
|
468 TBool mustShow = iAlwaysShownAppList->IsAlwaysShownApp( appUid ); |
|
469 |
|
470 #ifdef _DEBUG |
|
471 const TDesC& captionDbg( windowName->Caption() ); |
|
472 TSLOG4( TSLOG_INFO, "[%d] wgid=%d appuid=%x (%S)", i, wgId, |
|
473 appUid.iUid, &captionDbg ); |
|
474 TSLOG4( TSLOG_INFO, "hidden=%d onhiddenlist=%d mustshow=%d scrno=%d", |
|
475 windowName->Hidden(), onHiddenList, mustShow, appScreen ); |
|
476 #endif |
|
477 |
|
478 // if this is the widget app then save wgid for later use |
|
479 // and ignore it, but include running widgets instead |
|
480 if ( iWidgetsSupported && appUid.iUid == KWidgetAppUidValue ) |
|
481 { |
|
482 changed = ETrue; |
|
483 } |
|
484 // add item to task list if it is always-shown OR it is not hidden |
|
485 // and it is not on cover ui |
|
486 else if ( mustShow |
|
487 || ( !onHiddenList |
|
488 && !windowName->Hidden() |
|
489 && ( appScreen == 0 || appScreen == -1 ) |
|
490 && scrNumErr == KErrNone ) ) |
|
491 { |
|
492 if ( AddEntryL( wgId, appUid, windowName, newList, EFalse ) ) |
|
493 { |
|
494 changed = ETrue; |
|
495 } |
|
496 } |
|
497 CleanupStack::PopAndDestroy( windowName ); |
|
498 } |
|
499 CleanupStack::PopAndDestroy( &allWgIds ); |
|
500 CheckWidgetsL(newList); |
|
501 |
|
502 // if counts for old and new lists do not match then there is a change for sure, |
|
503 // probably an app has been closed |
|
504 if ( iData.Count() != newList.Count() ) |
|
505 { |
|
506 changed = ETrue; |
|
507 } |
|
508 |
|
509 // move pointers from the temporary list into the real one |
|
510 iData.ResetAndDestroy(); |
|
511 TInt newListCount = newList.Count(); |
|
512 TSLOG1( TSLOG_INFO, "new list count = %d", newListCount ); |
|
513 for ( TInt i = 0; i < newListCount; ++i ) |
|
514 { |
|
515 TSLOG3( TSLOG_INFO, "[%d] %S wgid=%d", |
|
516 i, &newList[i]->AppName(), newList[i]->WgId() ); |
|
517 iData.AppendL( newList[i] ); |
|
518 newList[i] = 0; |
|
519 } |
|
520 CleanupStack::PopAndDestroy( &newList ); |
|
521 |
|
522 TSLOG1_OUT( "change flag = %d", changed ); |
354 TSLOG1_OUT( "change flag = %d", changed ); |
523 return changed; |
355 return changed; |
524 } |
356 } |
525 |
357 |
526 // -------------------------------------------------------------------------- |
358 |
527 // CTsFswEngine::AddEntryL |
|
528 // -------------------------------------------------------------------------- |
|
529 // |
|
530 TBool CTsFswEngine::AddEntryL( TInt aWgId, const TUid& aAppUid, |
|
531 CApaWindowGroupName* aWgName, RTsFswArray& aNewList, |
|
532 TBool aIsWidget ) |
|
533 { |
|
534 TBool changed = EFalse; |
|
535 CTsFswEntry* entry = CTsFswEntry::NewLC(); |
|
536 entry->SetWgId( aWgId ); |
|
537 entry->SetAppUid( aAppUid ); |
|
538 entry->SetWidget( aIsWidget ); |
|
539 |
|
540 // check if present in old list and if yes then take some of the old data |
|
541 TBool found = CheckIfExistsL( *entry, aAppUid, changed, aNewList ); |
|
542 |
|
543 // if not present previously then find out app name |
|
544 // and check if screenshot is already available |
|
545 if ( !found ) |
|
546 { |
|
547 // when adding a new entry to the list it is changed for sure |
|
548 changed = ETrue; |
|
549 HBufC* name = FindAppNameLC( aWgName, aAppUid, aWgId ); |
|
550 if ( name ) |
|
551 { |
|
552 entry->SetAppNameL( *name ); |
|
553 } |
|
554 CleanupStack::PopAndDestroy( name ); |
|
555 TInt h = LookupScreenshotHandle( aWgId ); |
|
556 if ( h ) |
|
557 { |
|
558 entry->SetScreenshotHandle( h ); |
|
559 } |
|
560 entry->SetAlwaysShown( iAlwaysShownAppList->IsAlwaysShownApp( aAppUid ) ); |
|
561 if ( aWgName ) |
|
562 { |
|
563 entry->SetSystemApp( aWgName->IsSystem() ); |
|
564 } |
|
565 } |
|
566 |
|
567 // add to new list, ownership is transferred |
|
568 aNewList.AppendL( entry ); |
|
569 CleanupStack::Pop( entry ); |
|
570 return changed; |
|
571 } |
|
572 |
|
573 // -------------------------------------------------------------------------- |
|
574 // CTsFswEngine::CheckIfExistsL |
|
575 // -------------------------------------------------------------------------- |
|
576 // |
|
577 TBool CTsFswEngine::CheckIfExistsL( CTsFswEntry& aEntry, |
|
578 const TUid& aAppUid, |
|
579 TBool& aChanged, |
|
580 RTsFswArray& aNewList ) |
|
581 { |
|
582 for ( TInt entryIdx = 0, oldCount = iData.Count(); |
|
583 entryIdx < oldCount; ++entryIdx ) |
|
584 { |
|
585 // Enough to check appuid, no need to bother with wgid as the |
|
586 // screenshot handle is up-to-date or will be updated later anyway. |
|
587 if ( iData[entryIdx]->AppUid() == aAppUid ) |
|
588 { |
|
589 // if positions do not match then the list is different than before |
|
590 if ( entryIdx != aNewList.Count() ) |
|
591 { |
|
592 aChanged = ETrue; |
|
593 } |
|
594 CTsFswEntry* oldEntry = iData[entryIdx]; |
|
595 aEntry.SetAppNameL( oldEntry->AppName() ); |
|
596 aEntry.SetScreenshotHandle( oldEntry->ScreenshotHandle() ); |
|
597 aEntry.SetAlwaysShown( oldEntry->AlwaysShown() ); |
|
598 aEntry.SetSystemApp( oldEntry->SystemApp() ); |
|
599 return ETrue; |
|
600 } |
|
601 } |
|
602 return EFalse; |
|
603 } |
|
604 |
|
605 // -------------------------------------------------------------------------- |
|
606 // CTsFswEngine::CheckWidgetsL |
|
607 // -------------------------------------------------------------------------- |
|
608 // |
|
609 void CTsFswEngine::CheckWidgetsL( RTsFswArray& aNewList ) |
|
610 { |
|
611 if( iWidgetsSupported ) |
|
612 { |
|
613 iWidgetList->InitializeWidgetListL(); |
|
614 const RWidgetInfoArray& arr( iWidgetList->RunningWidgets() ); |
|
615 for ( TInt i = 0, ie = arr.Count(); i != ie; ++i ) |
|
616 { |
|
617 //verify if widget is working in full screen mode |
|
618 if( arr[i]->iFileSize ) |
|
619 { |
|
620 // wgid will be a special negative value |
|
621 // windowgroupname is not needed here so pass NULL |
|
622 AddEntryL( -(i+1), arr[i]->iUid, 0, aNewList, ETrue ); |
|
623 } |
|
624 } |
|
625 } |
|
626 } |
|
627 |
|
628 // -------------------------------------------------------------------------- |
|
629 // CTsFswEngine::HiddenAppListUpdated |
359 // CTsFswEngine::HiddenAppListUpdated |
630 // Callback from the hidden app list watcher |
360 // Callback from the hidden app list watcher |
631 // -------------------------------------------------------------------------- |
361 // -------------------------------------------------------------------------- |
632 // |
362 // |
633 void CTsFswEngine::HiddenAppListUpdated() |
363 void CTsFswEngine::HiddenAppListUpdated() |
634 { |
364 { |
635 UpdateTaskList(); |
365 UpdateTaskList(); |
636 } |
366 } |
637 |
367 |
638 // -------------------------------------------------------------------------- |
368 // -------------------------------------------------------------------------- |
639 // CTsFswEngine::AppUidForWgIdL |
|
640 // -------------------------------------------------------------------------- |
|
641 // |
|
642 TUid CTsFswEngine::AppUidForWgIdL( TInt aWgId ) |
|
643 { |
|
644 CApaWindowGroupName* windowName = |
|
645 CApaWindowGroupName::NewLC( iWsSession, aWgId ); |
|
646 TUid appUid = windowName->AppUid(); |
|
647 CleanupStack::PopAndDestroy( windowName ); |
|
648 return appUid; |
|
649 } |
|
650 |
|
651 // -------------------------------------------------------------------------- |
|
652 // CTsFswEngine::FindParentWgId |
|
653 // -------------------------------------------------------------------------- |
|
654 // |
|
655 TInt CTsFswEngine::FindParentWgId( TInt aWgId ) |
|
656 { |
|
657 TInt parent( KErrNotFound ); |
|
658 RArray<RWsSession::TWindowGroupChainInfo> allWgIds; |
|
659 // Ask for window group list from RWsSession |
|
660 TInt error = iWsSession.WindowGroupList( 0, &allWgIds ); |
|
661 if ( !error ) |
|
662 { |
|
663 TInt count( allWgIds.Count() ); |
|
664 for ( TInt i( 0 ); i < count; i++ ) |
|
665 { |
|
666 RWsSession::TWindowGroupChainInfo info = allWgIds[i]; |
|
667 if ( info.iId == aWgId && info.iParentId > 0) |
|
668 { |
|
669 parent = info.iParentId; |
|
670 break; |
|
671 } |
|
672 } |
|
673 } |
|
674 allWgIds.Close(); |
|
675 return parent; |
|
676 } |
|
677 |
|
678 // -------------------------------------------------------------------------- |
|
679 // CTsFswEngine::FindMostTopParentWgId |
|
680 // -------------------------------------------------------------------------- |
|
681 // |
|
682 TInt CTsFswEngine::FindMostTopParentWgId( TInt aWgId ) |
|
683 { |
|
684 TInt parent( KErrNotFound ); |
|
685 parent = FindParentWgId( aWgId ); |
|
686 if( parent != KErrNotFound) |
|
687 { |
|
688 TInt topParent = FindMostTopParentWgId(parent); |
|
689 if( topParent != KErrNotFound ) |
|
690 { |
|
691 parent = topParent; |
|
692 } |
|
693 } |
|
694 return parent; |
|
695 } |
|
696 |
|
697 // -------------------------------------------------------------------------- |
|
698 // CTsFswEngine::FindAppNameLC |
|
699 // -------------------------------------------------------------------------- |
|
700 // |
|
701 HBufC* CTsFswEngine::FindAppNameLC( CApaWindowGroupName* aWindowName, |
|
702 const TUid& aAppUid, |
|
703 TInt aWgId ) |
|
704 { |
|
705 //Retrieve the app name |
|
706 TApaAppInfo info; |
|
707 iAppArcSession.GetAppInfo( info, aAppUid ); |
|
708 TPtrC caption = info.iShortCaption; |
|
709 |
|
710 HBufC* tempName = 0; |
|
711 if ( !caption.Length() && aWindowName ) // if not set - use thread name instead |
|
712 { |
|
713 if ( aWindowName->Caption().Length() ) |
|
714 { |
|
715 tempName = aWindowName->Caption().AllocL(); |
|
716 //put on cleanupstack after the if |
|
717 } |
|
718 else |
|
719 { |
|
720 TThreadId threadId; |
|
721 TInt err = iWsSession.GetWindowGroupClientThreadId( |
|
722 aWgId, threadId ); |
|
723 if ( err == KErrNone ) |
|
724 { |
|
725 RThread thread; |
|
726 CleanupClosePushL( thread ); |
|
727 err = thread.Open ( threadId ); |
|
728 if ( err==KErrNone ) |
|
729 { |
|
730 tempName = thread.Name().AllocL(); // codescanner::forgottoputptroncleanupstack |
|
731 // tempName put on cleanupstack after the if |
|
732 } |
|
733 CleanupStack::PopAndDestroy( &thread ); |
|
734 } |
|
735 } |
|
736 } |
|
737 else |
|
738 { |
|
739 tempName = caption.AllocL(); |
|
740 //put on cleanupstack after the if |
|
741 } |
|
742 CleanupStack::PushL( tempName ); |
|
743 return tempName; |
|
744 } |
|
745 |
|
746 // -------------------------------------------------------------------------- |
|
747 // CTsFswEngine::CopyBitmapL |
369 // CTsFswEngine::CopyBitmapL |
748 // -------------------------------------------------------------------------- |
370 // -------------------------------------------------------------------------- |
749 // |
371 // |
750 CFbsBitmap* CTsFswEngine::CopyBitmapL( TInt aFbsHandle, TBool aKeepAspectRatio ) |
372 CFbsBitmap* CTsFswEngine::CopyBitmapL( TInt aFbsHandle, TBool aKeepAspectRatio ) |
751 { |
373 { |
|
374 TSLOG_CONTEXT( CopyBitmapL, TSLOG_LOCAL ); |
|
375 |
752 CFbsBitmap* ret = new (ELeave) CFbsBitmap; |
376 CFbsBitmap* ret = new (ELeave) CFbsBitmap; |
753 CleanupStack::PushL( ret ); |
377 CleanupStack::PushL( ret ); |
754 CFbsBitmap* bmp = new (ELeave) CFbsBitmap; |
378 CFbsBitmap* bmp = new (ELeave) CFbsBitmap; |
755 CleanupStack::PushL( bmp ); |
379 CleanupStack::PushL( bmp ); |
756 User::LeaveIfError( bmp->Duplicate( aFbsHandle ) ); |
380 User::LeaveIfError( bmp->Duplicate( aFbsHandle ) ); |
966 iRotaTasks.Remove(idx); |
583 iRotaTasks.Remove(idx); |
967 } |
584 } |
968 |
585 |
969 if ( aError == KErrNone ) |
586 if ( aError == KErrNone ) |
970 { |
587 { |
971 if ( iScreenshots.Insert( aWgId, aBitmap ) != KErrNone ) |
588 StoreScreenshot(aWgId, aBitmap); |
972 { |
|
973 delete aBitmap; |
|
974 iScreenshots.Remove( aWgId ); |
|
975 AssignScreenshotHandle( aWgId, 0 ); |
|
976 } |
|
977 else |
|
978 { |
|
979 AssignScreenshotHandle( aWgId, aBitmap->Handle() ); |
|
980 } |
|
981 } |
589 } |
982 else |
590 else |
983 { |
591 { |
984 // Rotation failed, cleanup bitmap |
592 // Rotation failed, cleanup bitmap |
985 delete aBitmap; |
593 delete aBitmap; |
986 } |
594 } |
987 |
595 |
988 TSLOG_OUT(); |
596 TSLOG_OUT(); |
989 } |
|
990 |
|
991 |
|
992 // -------------------------------------------------------------------------- |
|
993 // CTsFswEngine::AssignScreenshotHandle |
|
994 // Called when a screenshot arrives to check if there is a corresponding |
|
995 // application in the task list. Firstly try to match screenshot into parental |
|
996 // application then into standalone one. |
|
997 // -------------------------------------------------------------------------- |
|
998 // |
|
999 void CTsFswEngine::AssignScreenshotHandle( TInt aWgIdForScreenshot, |
|
1000 TInt aBitmapHandle ) |
|
1001 { |
|
1002 TBool changed = EFalse; |
|
1003 TInt parentWgId = FindMostTopParentWgId( aWgIdForScreenshot ); |
|
1004 // now parentWgId is a valid wgid or KErrNotFound (-1) |
|
1005 if (parentWgId != KErrNotFound) |
|
1006 { |
|
1007 AssignScreenshotHandle( parentWgId, aBitmapHandle, changed ); |
|
1008 } |
|
1009 if (!changed) |
|
1010 { |
|
1011 AssignScreenshotHandle( aWgIdForScreenshot, aBitmapHandle, changed ); |
|
1012 } |
|
1013 if ( changed ) |
|
1014 { |
|
1015 iObserver.FswDataChanged(); |
|
1016 } |
|
1017 } |
|
1018 |
|
1019 // -------------------------------------------------------------------------- |
|
1020 // CTsFswEngine::AssignScreenshotHandle |
|
1021 // Called when a screenshot arrives to check if there is a corresponding |
|
1022 // application in the task list. It might be tried to be match into parental |
|
1023 // or standalone application. |
|
1024 // -------------------------------------------------------------------------- |
|
1025 // |
|
1026 void CTsFswEngine::AssignScreenshotHandle(TInt aWgIdForScreenshot, |
|
1027 TInt aBitmapHandle, TBool& aAsigned) |
|
1028 { |
|
1029 aAsigned = EFalse; |
|
1030 for (TInt i = 0, ie = iData.Count(); i != ie; ++i) |
|
1031 { |
|
1032 if (iData[i]->Widget()) |
|
1033 { |
|
1034 // Do not do anything for now => no screenshot for widgets. |
|
1035 continue; |
|
1036 } |
|
1037 TInt appWgId = iData[i]->WgId(); |
|
1038 if (appWgId == aWgIdForScreenshot) |
|
1039 { |
|
1040 iData[i]->SetScreenshotHandle(aBitmapHandle); |
|
1041 aAsigned = ETrue; |
|
1042 break; |
|
1043 } |
|
1044 } |
|
1045 } |
|
1046 |
|
1047 // -------------------------------------------------------------------------- |
|
1048 // CTsFswEngine::LookupScreenshotHandle |
|
1049 // Called to check if there is a screenshot already stored for the given |
|
1050 // app. (or a screenshot with a wgid for which aWgIdForApp is the parent) |
|
1051 // -------------------------------------------------------------------------- |
|
1052 // |
|
1053 TInt CTsFswEngine::LookupScreenshotHandle( TInt aWgIdForApp ) |
|
1054 { |
|
1055 CFbsBitmap** bmp = iScreenshots.Find( aWgIdForApp ); |
|
1056 if ( bmp ) |
|
1057 { |
|
1058 // there is a screenshot stored for this wgid |
|
1059 return (*bmp)->Handle(); |
|
1060 } |
|
1061 else if ( aWgIdForApp > 0 ) |
|
1062 { |
|
1063 // must check if there is a screenshot for which aWgIdForApp is the parent |
|
1064 THashMapIter<TInt, CFbsBitmap*> iter( iScreenshots ); |
|
1065 while ( const TInt* wgid = iter.NextKey() ) |
|
1066 { |
|
1067 if ( FindParentWgId( *wgid ) == aWgIdForApp ) |
|
1068 { |
|
1069 CFbsBitmap** bmp = iter.CurrentValue(); |
|
1070 return (*bmp)->Handle(); |
|
1071 } |
|
1072 } |
|
1073 } |
|
1074 else if ( aWgIdForApp < 0 ) |
|
1075 { |
|
1076 // Must be a widget, wgid is useless in this case. |
|
1077 // Do not do anything for now => no screenshot for widgets. |
|
1078 } |
|
1079 return 0; |
|
1080 } |
597 } |
1081 |
598 |
1082 // -------------------------------------------------------------------------- |
599 // -------------------------------------------------------------------------- |
1083 // CTsFswEngine::RunL |
600 // CTsFswEngine::RunL |
1084 // -------------------------------------------------------------------------- |
601 // -------------------------------------------------------------------------- |
1183 stream.WriteInt32L ( KCloseWidgetCmd ); |
697 stream.WriteInt32L ( KCloseWidgetCmd ); |
1184 CleanupStack::PopAndDestroy( &stream ); |
698 CleanupStack::PopAndDestroy( &stream ); |
1185 cmdLine->SetCommandL( EApaCommandBackgroundAndWithoutViews ); |
699 cmdLine->SetCommandL( EApaCommandBackgroundAndWithoutViews ); |
1186 cmdLine->SetOpaqueDataL( *opaque ); |
700 cmdLine->SetOpaqueDataL( *opaque ); |
1187 CleanupStack::PopAndDestroy( opaque ); |
701 CleanupStack::PopAndDestroy( opaque ); |
1188 cmdLine->SetExecutableNameL( KWidgetAppName ); |
702 |
1189 ls.StartApp( *cmdLine ); |
703 if (iDataList->Widgets()->IsCWRTWidget(widgetInfo->iUid)) |
|
704 { |
|
705 cmdLine->SetExecutableNameL( KWidgetAppNameWgt); |
|
706 } |
|
707 else |
|
708 { |
|
709 cmdLine->SetExecutableNameL( KWidgetAppName ); |
|
710 } |
|
711 |
|
712 iAppArcSession.StartApp( *cmdLine ); |
1190 CleanupStack::PopAndDestroy( cmdLine ); |
713 CleanupStack::PopAndDestroy( cmdLine ); |
1191 CleanupStack::PopAndDestroy( &ls ); |
714 TSLOG_OUT(); |
1192 TSLOG_OUT(); |
715 } |
1193 } |
716 |
1194 |
717 // -------------------------------------------------------------------------- |
1195 |
718 // CTsFswEngine::StoreScreenshot |
|
719 // -------------------------------------------------------------------------- |
|
720 // |
|
721 TBool CTsFswEngine::StoreScreenshot(TInt aWgId, CFbsBitmap* aBmp) |
|
722 { |
|
723 TSLOG_CONTEXT( StoreScreenshot, TSLOG_LOCAL ); |
|
724 //iDataList would take ownership |
|
725 TBool change = EFalse; |
|
726 change = iDataList->StoreScreenshot(aWgId, aBmp); |
|
727 if(change) |
|
728 { |
|
729 iObserver.FswDataChanged(); |
|
730 } |
|
731 TSLOG1_OUT( "Screenshot for = %d", aWgId ); |
|
732 return change; |
|
733 } |
|
734 |
|
735 // -------------------------------------------------------------------------- |
|
736 // CTsFswEngine::RemoveScreenshot() |
|
737 // -------------------------------------------------------------------------- |
|
738 // |
|
739 void CTsFswEngine::RemoveScreenshot(TInt aWgId) |
|
740 { |
|
741 TBool change = EFalse; |
|
742 change = iDataList->RemoveScreenshot(aWgId); |
|
743 if( change ) |
|
744 { |
|
745 iObserver.FswDataChanged(); |
|
746 } |
|
747 } |
|
748 |
|
749 // -------------------------------------------------------------------------- |
|
750 // CTsFswEngine::HandleWidgetUpdateL() |
|
751 // -------------------------------------------------------------------------- |
|
752 // |
|
753 void CTsFswEngine::HandleWidgetUpdateL(TInt aWidgetId, TInt aBitmapHandle) |
|
754 { |
|
755 TSLOG_CONTEXT( HandleWidgetUpdateL, TSLOG_LOCAL ); |
|
756 |
|
757 iDataList->MoveEntryAtStart(aWidgetId, ETrue); |
|
758 |
|
759 CFbsBitmap* bmp = 0; |
|
760 TBool contentChanged(EFalse); |
|
761 if( aBitmapHandle ) |
|
762 { |
|
763 TRAPD( err, bmp = CopyBitmapL( aBitmapHandle, EFalse ) ); |
|
764 if ( err == KErrNone ) |
|
765 { |
|
766 contentChanged = StoreScreenshot(aWidgetId, bmp); |
|
767 } |
|
768 } |
|
769 if(!contentChanged) |
|
770 { |
|
771 iObserver.FswDataChanged(); |
|
772 } |
|
773 |
|
774 TSLOG_OUT(); |
|
775 } |
1196 |
776 |
1197 // -------------------------------------------------------------------------- |
777 // -------------------------------------------------------------------------- |
1198 // CTsRotationListener::CTsRotationListener |
778 // CTsRotationListener::CTsRotationListener |
1199 // -------------------------------------------------------------------------- |
779 // -------------------------------------------------------------------------- |
1200 // |
780 // |