taskswitcher/server/src/tsdatalist.cpp
changeset 116 305818acdca4
child 119 50e220be30d1
equal deleted inserted replaced
112:dbfb5e38438b 116:305818acdca4
       
     1 /*
       
     2  * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  File containing application list classes
       
    15  *
       
    16  */
       
    17 
       
    18 //INCLUDES:
       
    19 #include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
       
    20 #include <e32debug.h>
       
    21 #include <apgwgnam.h>
       
    22 #include <bitstd.h>
       
    23 #include <AknIconUtils.h> // avkon
       
    24 #include <apgicnfl.h> // fbsbitmap
       
    25 #include <AknIconSrvClient.h> 
       
    26 #include <fbs.h>
       
    27 #include <apgwgnam.h>
       
    28 #include <QSizeF>
       
    29 #include <camenuiconutility.h>
       
    30 
       
    31 #include "tsdatalist.h"
       
    32 #include "tsentrykeygenerator.h"
       
    33 #include "tsscreenshotmsg.h"
       
    34 #include "tsunregscreenshotmsg.h"
       
    35 #include "tsvisibilitymsg.h"
       
    36 
       
    37 // size for the created app icons
       
    38 const TInt KAppIconWidth = 128;
       
    39 const TInt KAppIconHeight = 128;
       
    40 
       
    41 //uids to be hidden
       
    42 const TUid KHsApplicationUid = { 0x20022F35 };
       
    43 
       
    44 // ================= MEMBER FUNCTIONS =======================
       
    45 
       
    46 // --------------------------------------------------------------------------
       
    47 /**
       
    48  * Two-phased constructor.
       
    49  */
       
    50 CTsDataList* CTsDataList::NewL( MTsResourceManager& aResources,
       
    51                                 MTsWindowGroupsMonitor& aMonitor, 
       
    52                                 MTsDataObserver& aObserver )
       
    53     {
       
    54     CTsDataList* self = new (ELeave) CTsDataList( aResources, 
       
    55                                                   aMonitor, 
       
    56                                                   aObserver );
       
    57     CleanupStack::PushL( self );
       
    58     self->ConstructL();
       
    59     CleanupStack::Pop( self );
       
    60     return self;
       
    61     }
       
    62 
       
    63 // --------------------------------------------------------------------------
       
    64 /**
       
    65  * Constructor.
       
    66  */
       
    67 CTsDataList::CTsDataList(MTsResourceManager& aResources,
       
    68                          MTsWindowGroupsMonitor &aMonitor, 
       
    69                          MTsDataObserver& aObserver ) 
       
    70 :
       
    71     CTsWindowGroupsObserver( aMonitor ),
       
    72     iResources( aResources ),
       
    73     iObserver( aObserver )
       
    74     {
       
    75     }
       
    76 
       
    77 // --------------------------------------------------------------------------
       
    78 /*
       
    79  * Destructor
       
    80  */
       
    81 CTsDataList::~CTsDataList()
       
    82     {
       
    83     iData.ResetAndDestroy();
       
    84     iVisibleData.Close();
       
    85     iHiddenUids.Close();
       
    86     RFbsSession::Disconnect();
       
    87     RAknIconSrvClient::Disconnect();
       
    88     delete iDefaultIcon;
       
    89     }
       
    90 
       
    91 // --------------------------------------------------------------------------
       
    92 /**
       
    93  * Performs 2nd phase construction.
       
    94  */
       
    95 void CTsDataList::ConstructL()
       
    96     {
       
    97     BaseConstructL();
       
    98     iHiddenUids.AppendL( KHsApplicationUid );
       
    99     User::LeaveIfError(RFbsSession::Connect());
       
   100     RAknIconSrvClient::Connect();
       
   101     QT_TRYCATCH_LEAVING(
       
   102         iDefaultIcon = HbIcon2CFbsBitmap( HbIcon("qtg_large_application") );)
       
   103     }
       
   104 
       
   105 // --------------------------------------------------------------------------
       
   106 /**
       
   107  * Returns a reference to the current content.
       
   108  * Also performs sanity checks, e.g. associates application icons
       
   109  * when no screenshot has been received.
       
   110  * @return  ref to content array
       
   111  */
       
   112 const RTsFswArray& CTsDataList::Data() const
       
   113     {
       
   114     return iVisibleData;
       
   115     }
       
   116 
       
   117 // --------------------------------------------------------------------------
       
   118 /**
       
   119  * Interface implementation
       
   120  * @see MTsWindowGroupsObserver HandleWindowGroupChanged
       
   121  */
       
   122 void CTsDataList::HandleWindowGroupChanged(
       
   123                       MTsResourceManager &, 
       
   124                       const TArray<RWsSession::TWindowGroupChainInfo>& aWgList)
       
   125     {
       
   126     TRAP_IGNORE(RDebug::Print(_L("[TaskSwitcher] processing started"));
       
   127                 RTsFswArray newAppsList;
       
   128                 CleanupResetAndDestroyPushL(newAppsList);
       
   129                 CollectAppsL(newAppsList, aWgList);
       
   130                 RDebug::Print(_L("[TaskSwitcher] gathered app info"));
       
   131                 FitDataToListL(newAppsList);
       
   132                 CleanupStack::PopAndDestroy(&newAppsList);
       
   133                 RDebug::Print(_L("[TaskSwitcher] processing finished"));
       
   134                 );
       
   135     }
       
   136 
       
   137 // --------------------------------------------------------------------------
       
   138 /**
       
   139  * Adds running apps to the list.
       
   140  * @param aAppsList array to add to
       
   141  */
       
   142 void CTsDataList::CollectAppsL(RTsFswArray& aAppsList, 
       
   143                                const TArray<RWsSession::TWindowGroupChainInfo> &aWgList)
       
   144     {
       
   145     for( TInt i(0); i < aWgList.Count(); ++i )
       
   146         {
       
   147         TTsEntryKey key;
       
   148         TInt err = TsEntryKeyGeneraror::Generate(key, aWgList[i].iId, aWgList);
       
   149         //skip this entry if it is already on list or generate key failed
       
   150         if( err!=KErrNone || FindEntry( aAppsList, key ) >= 0 ) 
       
   151             {
       
   152             continue;
       
   153             }
       
   154 
       
   155         // get window group name
       
   156         CApaWindowGroupName* windowName = 
       
   157             CApaWindowGroupName::NewLC( iResources.WsSession(), 
       
   158                                         key.WindowGroupId() );
       
   159         TUid appUid = windowName->AppUid();
       
   160         
       
   161          // get screen number (-1=console, 0=main screen, 1=cover ui)
       
   162         TInt appScreen = 0;
       
   163         TInt scrNumErr = 
       
   164             iResources.ApaSession().GetDefaultScreenNumber( appScreen, 
       
   165                                                             appUid );
       
   166         
       
   167         if( appUid.iUid && 
       
   168             !windowName->Hidden() && 
       
   169             (appScreen == 0 || appScreen == -1) && 
       
   170             scrNumErr == KErrNone )
       
   171             {
       
   172             AddEntryL( key, appUid, windowName, aAppsList );
       
   173             }
       
   174 
       
   175         CleanupStack::PopAndDestroy( windowName );
       
   176         }
       
   177     }
       
   178 
       
   179 // --------------------------------------------------------------------------
       
   180 /**
       
   181  * Called from CollectTasksL for each entry in the task list.
       
   182  * @param   aKey       entry key
       
   183  * @param   aAppUid    application uid
       
   184  * @param   aWgName    window group name or NULL
       
   185  * @param   aNewList   list to add to
       
   186  */
       
   187 void CTsDataList::AddEntryL( const TTsEntryKey& aKey, 
       
   188                              const TUid& aAppUid,
       
   189                              CApaWindowGroupName* aWgName, 
       
   190                              RTsFswArray& aNewList )
       
   191     {
       
   192     CTsEntry* entry = CTsEntry::NewLC( aKey, iObserver );
       
   193     // check if present in old list and if yes then take some of the old data
       
   194     TBool found = ConsiderOldDataL( aKey );
       
   195     // if not present previously then find out app name
       
   196     // and check if screenshot is already available
       
   197     if( !found )
       
   198         {
       
   199         entry->SetAppUid(aAppUid);
       
   200         HBufC* name = FindAppNameLC( aWgName, aAppUid, aKey.WindowGroupId() );
       
   201         entry->SetAppNameL(*name);
       
   202         CleanupStack::PopAndDestroy( name );
       
   203         //transfer ownership to entry
       
   204         entry->SetAppIcon( GetAppIconL( aAppUid ) );
       
   205         }
       
   206     if(aWgName)
       
   207         {
       
   208         entry->SetCloseableApp( !aWgName->IsSystem() );
       
   209         }
       
   210     // add to new list, ownership is transferred
       
   211     aNewList.AppendL( entry );
       
   212     CleanupStack::Pop( entry );
       
   213     }
       
   214 
       
   215 // --------------------------------------------------------------------------
       
   216 /**
       
   217  * Checks if there is an entry for same app in the content list.
       
   218  * If yes then it takes some of the data for the entry that
       
   219  * will correspond to the same app in the refreshed content list.
       
   220  * @param   aKey      new key in content list
       
   221  * @return  ETrue if app was found
       
   222  */
       
   223 TBool CTsDataList::ConsiderOldDataL( const TTsEntryKey& aKey )
       
   224     {
       
   225     for(TInt entryIdx = 0, oldCount = iData.Count(); entryIdx < oldCount; ++entryIdx) 
       
   226         {
       
   227         if (iData[entryIdx]->Key() == aKey) 
       
   228             {
       
   229             return ETrue;
       
   230             }
       
   231         }
       
   232     return EFalse;
       
   233     }
       
   234 
       
   235 // --------------------------------------------------------------------------
       
   236 /**
       
   237  * Finds out the application name.
       
   238  * @param   aWindowName window group name or NULL
       
   239  * @param   aAppUId     application uid
       
   240  * @param   aWgId       window group id
       
   241  * @return  application name, ownership transferred to caller
       
   242  */
       
   243 HBufC* CTsDataList::FindAppNameLC( CApaWindowGroupName* aWindowName, 
       
   244                                    const TUid& aAppUid, 
       
   245                                    TInt aWgId )
       
   246     {
       
   247     //Retrieve the app name
       
   248     TApaAppInfo info;
       
   249     iResources.ApaSession().GetAppInfo( info, aAppUid );
       
   250     TPtrC caption = info.iShortCaption;
       
   251 
       
   252     HBufC* tempName( 0 );
       
   253     if (!caption.Length() && aWindowName) // if not set - use thread name instead
       
   254         {
       
   255         if (aWindowName->Caption().Length()) 
       
   256             {
       
   257             tempName = aWindowName->Caption().AllocLC();
       
   258             }
       
   259         else
       
   260             {
       
   261             TThreadId threadId;
       
   262             if(KErrNone == iResources.WsSession().GetWindowGroupClientThreadId( aWgId, threadId ) ) 
       
   263                 {
       
   264                 RThread thread;
       
   265                 CleanupClosePushL( thread );
       
   266                 if( KErrNone == thread.Open( threadId ) )
       
   267                     {
       
   268                     tempName = thread.Name().AllocL(); // codescanner::forgottoputptroncleanupstack
       
   269                     }
       
   270                 // tempName put on cleanupstack after the if
       
   271                 CleanupStack::PopAndDestroy( &thread );
       
   272                 if(tempName)
       
   273                     {
       
   274                     CleanupStack::PushL(tempName);
       
   275                     }
       
   276                 }
       
   277             }
       
   278         }
       
   279     else
       
   280         {
       
   281         tempName = caption.AllocLC();
       
   282         }
       
   283     if( 0 == tempName )
       
   284         {
       
   285         tempName = KNullDesC16().AllocLC();
       
   286         }
       
   287     return tempName;
       
   288     }
       
   289 
       
   290 // --------------------------------------------------------------------------
       
   291 /**
       
   292  * Fit existing class contained data list into give one.
       
   293  * Data is being changed with application type consideration that is based 
       
   294  * on aConsiderWidgets param. 
       
   295  * Function removes or add entries into data depend on given list.
       
   296  * @param   aListToFit          list with actual data  
       
   297  */
       
   298 void CTsDataList::FitDataToListL( RTsFswArray& aListToFit )
       
   299     {
       
   300     TBool changed = EFalse;
       
   301     TInt dataCount = iData.Count();
       
   302     
       
   303     //remove items that dont't exists in newly collected list
       
   304     for (TInt i = dataCount - 1; i >= 0; --i) 
       
   305         {
       
   306         if( !CheckIfExists( *iData[i], aListToFit ) )
       
   307             {
       
   308             delete iData[i];
       
   309             iData.Remove( i );
       
   310             changed = ETrue;
       
   311             }
       
   312         }
       
   313     RArray<TTsEntryKey> allKeys;
       
   314     
       
   315     //add new items at start
       
   316     for(TInt i = aListToFit.Count() - 1; i >= 0; --i)
       
   317         {        
       
   318         User::LeaveIfError( allKeys.Insert(aListToFit[i]->Key(), 0) );
       
   319         if( !CheckIfExists( *aListToFit[i], iData ) ) 
       
   320             {
       
   321             HideEntryIfNotAllowed( aListToFit[i] );
       
   322             User::LeaveIfError( iData.Insert( aListToFit[i], 0 ) );
       
   323             TTime currentTimestamp;
       
   324             currentTimestamp.UniversalTime();
       
   325             iData[0]->SetTimestamp( currentTimestamp );
       
   326             aListToFit[i] = 0;
       
   327             changed = ETrue;
       
   328             }
       
   329         }
       
   330     //establish order
       
   331     TBool orderChanged = EstablishOrder( allKeys );
       
   332     //update entries data
       
   333     TBool dataChanged = UpdateEntryData( aListToFit );
       
   334     RebuildVisibleDataListL();
       
   335     if( changed || orderChanged || dataChanged )
       
   336         {
       
   337         iObserver.DataChanged();
       
   338         }
       
   339     allKeys.Close();
       
   340     }
       
   341 
       
   342 // --------------------------------------------------------------------------
       
   343 /**
       
   344  * Checks if there is an entry for same app in the given list.
       
   345  * @param   aEntry      entry
       
   346  * @param   aList    ref to list
       
   347  * @return  ETrue if app was found
       
   348  */
       
   349 
       
   350 TBool CTsDataList::CheckIfExists( const CTsEntry& aEntry, 
       
   351                                   const RTsFswArray& aList ) const
       
   352     {
       
   353     return 0 <= FindEntry( aList, aEntry.Key() );
       
   354     }
       
   355 
       
   356 // --------------------------------------------------------------------------
       
   357 /**
       
   358  * Retrieves the bitmap for the icon of the given app.
       
   359  * @param   aAppUid application uid
       
   360  * @return  app CFbsBitmap
       
   361  */
       
   362 CFbsBitmap* CTsDataList::GetAppIconL( const TUid& aAppUid )
       
   363     {
       
   364     
       
   365     CFbsBitmap* iconBitmap(0);
       
   366     TRAPD(errNo, 
       
   367           QT_TRYCATCH_LEAVING(
       
   368           const QSize size(KAppIconWidth, KAppIconHeight);
       
   369           HbIcon icon = CaMenuIconUtility::getApplicationIcon( aAppUid.iUid, size);
       
   370           iconBitmap = HbIcon2CFbsBitmap( icon );)
       
   371           User::LeaveIfNull(iconBitmap); )
       
   372     if( KErrNone != errNo )
       
   373         {
       
   374         iconBitmap = new(ELeave) CFbsBitmap;
       
   375         CleanupStack::PushL(iconBitmap);
       
   376         User::LeaveIfError( iconBitmap->Duplicate( iDefaultIcon->Handle() ) );
       
   377         CleanupStack::Pop(iconBitmap);
       
   378         }
       
   379     return iconBitmap; 
       
   380     }
       
   381 
       
   382 // --------------------------------------------------------------------------
       
   383 /**
       
   384  * Converts HbIcon to CFbsBitmap
       
   385  * @param   aIcon icon to be coverted
       
   386  * @return  CFbsBitmap
       
   387  */
       
   388 CFbsBitmap* CTsDataList::HbIcon2CFbsBitmap( const HbIcon& aIcon )
       
   389     {
       
   390     CFbsBitmap* retValue(0);
       
   391     QIcon qicon = aIcon.qicon();
       
   392     QPixmap pixmap = qicon.pixmap(QSize(KAppIconWidth, KAppIconHeight));
       
   393     if( !pixmap.isNull() )
       
   394         {
       
   395         retValue = pixmap.toSymbianCFbsBitmap();
       
   396         }
       
   397     return retValue; 
       
   398     }
       
   399 // --------------------------------------------------------------------------
       
   400 TBool CTsDataList::IsSupported( TInt aFunction ) const
       
   401     {
       
   402     return ( RegisterScreenshotMessage == aFunction ||
       
   403              UnregisterScreenshotMessage == aFunction ||
       
   404              VisibilityChange == aFunction || 
       
   405              WindowGroupToBackgroundMessage == aFunction );
       
   406     }
       
   407 
       
   408 // --------------------------------------------------------------------------
       
   409 void CTsDataList::HandleDataL( TInt aFunction, RReadStream& aDataStream )
       
   410     {
       
   411     switch( aFunction )
       
   412         {
       
   413         case RegisterScreenshotMessage:
       
   414             RegisterScreenshotL( aDataStream );
       
   415             break;
       
   416         case UnregisterScreenshotMessage:
       
   417             UnregisterScreenshotL( aDataStream );
       
   418             break;
       
   419         case VisibilityChange:
       
   420             ChangeVisibilityL( aDataStream );
       
   421             break;        
       
   422         case WindowGroupToBackgroundMessage:
       
   423             UpdateTaskTimestampL( aDataStream );
       
   424             break;
       
   425         }
       
   426     }
       
   427 
       
   428 // --------------------------------------------------------------------------
       
   429 void CTsDataList::RegisterScreenshotL( RReadStream& aDataStream )
       
   430     {
       
   431     CTsScreenshotMsg* msg = CTsScreenshotMsg::NewLC( aDataStream );
       
   432     const TInt pos = FindEntry( iData, GenerateKeyL(msg->WindowGroupId() ) );
       
   433     User::LeaveIfError(pos);
       
   434     iData[pos]->SetScreenshotL( msg->Screenshot(), msg->Priority(), msg->Rotation() );
       
   435     CleanupStack::PopAndDestroy(msg);
       
   436     }
       
   437 // --------------------------------------------------------------------------
       
   438 void CTsDataList::UnregisterScreenshotL(RReadStream& aDataStream)
       
   439 {
       
   440     CTsUnregisterScreenshotMsg* msg = 
       
   441         CTsUnregisterScreenshotMsg::NewLC(aDataStream);
       
   442     const TInt pos = FindEntry( iData, GenerateKeyL(msg->windowGroupId() ) );
       
   443     User::LeaveIfError(pos);
       
   444     iData[pos]->RemoveScreenshotL();
       
   445     CleanupStack::PopAndDestroy(msg);
       
   446 }
       
   447 // --------------------------------------------------------------------------
       
   448 void CTsDataList::ChangeVisibilityL( RReadStream& aDataStream )
       
   449     {
       
   450     CTsVisibilitMsg* msg = CTsVisibilitMsg::NewLC(aDataStream);
       
   451     const TInt pos = FindEntry( iData, GenerateKeyL( msg->windowGroupId() ) );
       
   452     User::LeaveIfError(pos);
       
   453     
       
   454     msg->visibility() == iData[pos]->GetVisibility() ? 
       
   455     User::Leave( KErrInUse ) : 
       
   456     iData[pos]->SetVisibility( msg->visibility() );
       
   457     
       
   458     CleanupStack::PopAndDestroy(msg);
       
   459     RebuildVisibleDataListL();
       
   460     iObserver.DataChanged();
       
   461     }
       
   462 // --------------------------------------------------------------------------
       
   463 void CTsDataList::UpdateTaskTimestampL( RReadStream& aDataStream )
       
   464     {
       
   465     const TInt wgId = aDataStream.ReadInt32L();
       
   466     const TInt pos = FindEntry( iData, GenerateKeyL( wgId ) );
       
   467     User::LeaveIfError( pos );
       
   468 
       
   469     TTime currentTimestamp;
       
   470     currentTimestamp.UniversalTime();
       
   471     iData[pos]->SetTimestamp( currentTimestamp );
       
   472 
       
   473     iObserver.DataChanged();
       
   474     }
       
   475 
       
   476 // --------------------------------------------------------------------------
       
   477 /**
       
   478  * Checks if given uid is on hidden list
       
   479  * @param   aUid uid to be checked
       
   480  * @return  ETrue if uid is on hidden list
       
   481  */
       
   482 TBool CTsDataList::IsHiddenUid( TUid aUid )
       
   483     {
       
   484     return 0 < iHiddenUids.Find( aUid );
       
   485     }
       
   486 
       
   487 // --------------------------------------------------------------------------
       
   488 /**
       
   489  * Finds entry in array
       
   490  * @param   aList list to find
       
   491  * @param   aKey finding key
       
   492  * @return   position or KErrNotFound
       
   493  */
       
   494 TInt CTsDataList::FindEntry( const RTsFswArray& aList, 
       
   495                              const TTsEntryKey& aKey ) const
       
   496     {
       
   497     TInt pos(KErrNotFound);
       
   498     for(TInt entryIdx = 0; 
       
   499         entryIdx < aList.Count() && KErrNotFound == pos; 
       
   500         ++entryIdx)
       
   501         {
       
   502         if (aList[entryIdx]->Key() == aKey)
       
   503             {
       
   504             pos = entryIdx;
       
   505             }
       
   506         }
       
   507     return pos;
       
   508     }
       
   509 
       
   510 // --------------------------------------------------------------------------
       
   511 /**
       
   512  * Establish entry order accridung to aKeyList, all keys MUST be in iData
       
   513  * @param   aKeyList reference key list
       
   514  * @return   ETrue if changes occured
       
   515  */
       
   516 TBool CTsDataList::EstablishOrder( const RArray<TTsEntryKey>& aKeyList )
       
   517     {
       
   518     TBool changed( EFalse );
       
   519     TInt lastChangedItem( KErrNotFound );
       
   520     __ASSERT_ALWAYS( iData.Count() == aKeyList.Count(), User::Panic(_L("EstablishOrder 1"), KErrBadHandle) );
       
   521     for (TInt i = 0; i < aKeyList.Count(); i++)
       
   522         {
       
   523         const TTsEntryKey& currentdataKey = iData[i]->Key();
       
   524         const TTsEntryKey& referenceKey = aKeyList[i];
       
   525         if( !(currentdataKey == referenceKey) )
       
   526             {
       
   527             TInt foundPos = FindEntry( iData, referenceKey );
       
   528             __ASSERT_ALWAYS(foundPos>=0,  User::Panic(_L("EstablishOrder 2"), KErrBadHandle));
       
   529             CTsEntry* entry = iData[foundPos];
       
   530             iData.Remove( foundPos );
       
   531             iData.Insert( entry, i );
       
   532             changed = ETrue;
       
   533             lastChangedItem = i;
       
   534             }
       
   535         }
       
   536     TTime currentTimestamp;
       
   537     currentTimestamp.UniversalTime();
       
   538     for (TInt i = lastChangedItem; i >= 0; --i)
       
   539         {
       
   540         iData[i]->SetTimestamp(currentTimestamp);
       
   541         }
       
   542     return changed;
       
   543     }
       
   544 
       
   545 // --------------------------------------------------------------------------
       
   546 /**
       
   547  * Updates entry data on mData according to list
       
   548  * @param   aList reference entires list
       
   549  * @return   ETrue if changes occured
       
   550  */
       
   551 TBool CTsDataList::UpdateEntryData( const RTsFswArray& aList )
       
   552 {
       
   553     __ASSERT_ALWAYS( iData.Count() == aList.Count(), 
       
   554                      User::Panic(_L("UpdateEntryData 1"), KErrBadHandle) );
       
   555     TBool changed( EFalse );
       
   556     for( TInt i=0; i<aList.Count(); i++ )
       
   557         {
       
   558         if(aList[i]) 
       
   559             {
       
   560             __ASSERT_ALWAYS(iData[i]->Key() == aList[i]->Key(), 
       
   561                             User::Panic(_L("UpdateEntryData 2"), KErrBadHandle));
       
   562             if( iData[i]->CloseableApp() != aList[i]->CloseableApp() )
       
   563                 {
       
   564                 iData[i]->SetCloseableApp(aList[i]->CloseableApp());
       
   565                 changed = ETrue;
       
   566                 }
       
   567             }
       
   568         }
       
   569     return changed;
       
   570 }
       
   571 
       
   572 // --------------------------------------------------------------------------
       
   573 /**
       
   574  * Function generate task key using window group id
       
   575  * @param wgId - window group id of running application
       
   576  * @param entry key 
       
   577  */
       
   578 TTsEntryKey CTsDataList::GenerateKeyL( TInt aWgId )
       
   579     {
       
   580     RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
       
   581     CleanupClosePushL( allWgIds );
       
   582     User::LeaveIfError( iResources.WsSession().WindowGroupList( 0, &allWgIds ) );
       
   583     TTsEntryKey key;
       
   584     User::LeaveIfError(TsEntryKeyGeneraror::Generate(key, aWgId, allWgIds.Array()));
       
   585     CleanupStack::PopAndDestroy( &allWgIds );
       
   586     return key;
       
   587     }
       
   588 
       
   589 // --------------------------------------------------------------------------
       
   590 /**
       
   591  * Hides entrie if exist on mHiddenUids
       
   592  * @param   entry
       
   593  */
       
   594 void CTsDataList::HideEntryIfNotAllowed( CTsEntry* aEntry )
       
   595     {
       
   596     if( iHiddenUids.Find( aEntry->AppUid() ) >= 0 )
       
   597         {
       
   598         aEntry->SetVisibility(Invisible);
       
   599         }
       
   600     }
       
   601 
       
   602 void CTsDataList::RebuildVisibleDataListL()
       
   603     {
       
   604     iVisibleData.Reset();
       
   605     RArray<TInt> visibleItems(iData.Count() ? iData.Count() : 1);
       
   606     CleanupClosePushL(visibleItems);
       
   607     for( TInt iter = 0; iter < iData.Count(); ++iter )
       
   608         {
       
   609         if( Visible == iData[iter]->GetVisibility() )
       
   610             {
       
   611             visibleItems.AppendL(iter);
       
   612             }
       
   613         }
       
   614     for( TInt iter = 0; iter < visibleItems.Count(); ++iter ) 
       
   615         {
       
   616         iVisibleData.AppendL( iData[visibleItems[iter]] );
       
   617         }
       
   618     CleanupStack::PopAndDestroy(&visibleItems);
       
   619     }
       
   620 // end of file