taskswitcher/contextengine/tsfswserver/engine/src/tsfswdatalist.cpp
branchRCL_3
changeset 50 137ebc85284b
parent 47 7be2816dbabd
equal deleted inserted replaced
47:7be2816dbabd 50:137ebc85284b
    26 #include "enginelogging.h"
    26 #include "enginelogging.h"
    27 #include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
    27 #include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
    28 #include <featmgr.h>
    28 #include <featmgr.h>
    29 #include <apgwgnam.h>
    29 #include <apgwgnam.h>
    30 
    30 
    31 
    31 // Special case: ovi store secure widget UID
       
    32 const TUid KTsOviStoreSecureWidgetUid = { 0x2001A93E };
    32 
    33 
    33 // ================= MEMBER FUNCTIONS =======================
    34 // ================= MEMBER FUNCTIONS =======================
    34 
    35 
    35 // --------------------------------------------------------------------------
    36 // --------------------------------------------------------------------------
    36 // CTsFswDataList::NewL
    37 // CTsFswDataList::NewL
   111 
   112 
   112     // check the dirty flag and refresh if needed
   113     // check the dirty flag and refresh if needed
   113     if ( iTaskListDirty )
   114     if ( iTaskListDirty )
   114         {
   115         {
   115         CollectTasksL();
   116         CollectTasksL();
   116         // dirty flag is cleared in the above call
   117         // clear dirty flag
       
   118 		SetDirty(EFalse);
   117         }
   119         }
   118     
   120     
   119     // Get app icon for entries without screenshot,
   121     // Get app icon for entries without screenshot,
   120     // do this only here as the app icon is not needed in case a screenshot
   122     // do this only here as the app icon is not needed in case a screenshot
   121     // is already available.
   123     // is already available.
   151 // --------------------------------------------------------------------------
   153 // --------------------------------------------------------------------------
   152 //
   154 //
   153 TBool CTsFswDataList::CollectTasksL()
   155 TBool CTsFswDataList::CollectTasksL()
   154     {
   156     {
   155     // clear dirty flag
   157     // clear dirty flag
   156     iTaskListDirty = EFalse;
   158     TBool changed = iTaskListDirty;
   157     TBool changed = EFalse;
       
   158     
   159     
   159     RTsFswArray newAppsList;
   160     RTsFswArray newAppsList;
   160     RTsFswArray newWidgetsList;
   161     RTsFswArray newWidgetsList;
   161     
   162     
   162     CleanupResetAndDestroyPushL(newAppsList);
   163     CleanupResetAndDestroyPushL(newAppsList);
   204 
   205 
   205 // --------------------------------------------------------------------------
   206 // --------------------------------------------------------------------------
   206 // CTsFswDataList::SetDirty()
   207 // CTsFswDataList::SetDirty()
   207 // --------------------------------------------------------------------------
   208 // --------------------------------------------------------------------------
   208 //
   209 //
   209 void CTsFswDataList::SetDirty()
   210 void CTsFswDataList::SetDirty(TBool aDirty)
   210     {
   211     {
   211     iTaskListDirty = ETrue;
   212     iTaskListDirty = aDirty;
   212     }
   213     }
   213 
   214 
   214 // --------------------------------------------------------------------------
   215 // --------------------------------------------------------------------------
   215 // CTsFswDataList::SetAppDataRefreshNeeded()
   216 // CTsFswDataList::SetAppDataRefreshNeeded()
   216 // --------------------------------------------------------------------------
   217 // --------------------------------------------------------------------------
   250 //
   251 //
   251 TBool CTsFswDataList::RemoveScreenshot(TInt aId)
   252 TBool CTsFswDataList::RemoveScreenshot(TInt aId)
   252     {
   253     {
   253     TBool changed = EFalse;
   254     TBool changed = EFalse;
   254     CFbsBitmap** bmp = iScreenshots.Find( aId );
   255     CFbsBitmap** bmp = iScreenshots.Find( aId );
       
   256 
   255     if ( bmp )
   257     if ( bmp )
   256         {
   258         {
       
   259         changed |= AssignScreenshotHandle( aId, 0 );
       
   260         changed |= RemoveScreenshotFromParent( (*bmp)->Handle());
   257         delete *bmp;
   261         delete *bmp;
   258         iScreenshots.Remove( aId );
   262         iScreenshots.Remove( aId );
   259         changed = AssignScreenshotHandle( aId, 0 );
       
   260         }
   263         }
   261     return changed;
   264     return changed;
   262     }
   265     }
       
   266 
       
   267 
   263 
   268 
   264 // --------------------------------------------------------------------------
   269 // --------------------------------------------------------------------------
   265 // CTsFswDataList::FindScreenshotByWgId
   270 // CTsFswDataList::FindScreenshotByWgId
   266 // --------------------------------------------------------------------------
   271 // --------------------------------------------------------------------------
   267 //
   272 //
   274 
   279 
   275 // --------------------------------------------------------------------------
   280 // --------------------------------------------------------------------------
   276 // CTsFswDataList::MoveEntryAtStart
   281 // CTsFswDataList::MoveEntryAtStart
   277 // --------------------------------------------------------------------------
   282 // --------------------------------------------------------------------------
   278 //
   283 //
   279 void CTsFswDataList::MoveEntryAtStart(TInt aAppId, TBool aWidget)
   284 TBool CTsFswDataList::MoveEntryAtStart(TInt aAppId, TBool aWidget)
   280     {
   285     {
   281     TSLOG_CONTEXT( MoveEntryAtStart, TSLOG_LOCAL );
   286     TSLOG_CONTEXT( MoveEntryAtStart, TSLOG_LOCAL );
   282     
   287     
       
   288     TBool wasMoved(EFalse);
   283     TInt appId(0);
   289     TInt appId(0);
   284     //check embeded case
   290     //check embeded case
   285     if( !aWidget )
   291     if( !aWidget )
   286     	{
   292     	{
   287 		TInt wgId(0);
   293 		TInt wgId(0);
   300 		appId = aAppId;
   306 		appId = aAppId;
   301     	}
   307     	}
   302  
   308  
   303     for ( TInt i = 0; i < iData.Count(); ++i )
   309     for ( TInt i = 0; i < iData.Count(); ++i )
   304         {
   310         {
   305         if( iData[i]->AppUid().iUid == appId && iData[i]->Widget() == aWidget)
   311         if( iData[i]->AppUid().iUid == appId &&
       
   312             ((iData[i]->Widget() == aWidget) || (iData[i]->AppUid() == KTsOviStoreSecureWidgetUid )))
   306             {
   313             {
   307             CTsFswEntry* entry = iData[i];
   314             CTsFswEntry* entry = iData[i];
   308             iData.Remove(i);
   315             iData.Remove(i);
   309             iData.Insert(entry, 0);
   316             iData.Insert(entry, 0);
       
   317             SetDirty(ETrue);
       
   318             wasMoved = ETrue;
   310             break;
   319             break;
   311             }
   320             }
   312         }
   321         }
   313     TSLOG_OUT();
   322     TSLOG_OUT();
       
   323     return wasMoved;
   314     }
   324     }
   315 
   325 
   316 // --------------------------------------------------------------------------
   326 // --------------------------------------------------------------------------
   317 // CTsFswDataList::
   327 // CTsFswDataList::
   318 // --------------------------------------------------------------------------
   328 // --------------------------------------------------------------------------
   627         TInt aBitmapHandle, TBool& aAsigned)
   637         TInt aBitmapHandle, TBool& aAsigned)
   628     {
   638     {
   629     aAsigned = EFalse;
   639     aAsigned = EFalse;
   630     for (TInt i = 0, ie = iData.Count(); i != ie; ++i)
   640     for (TInt i = 0, ie = iData.Count(); i != ie; ++i)
   631         {
   641         {
   632         if (iData[i]->Widget())
   642         if (iData[i]->Widget() || iData[i]->AppUid() == KTsOviStoreSecureWidgetUid )
   633             {
   643             {
   634             TInt widgetId = iData[i]->AppUid().iUid;
   644             TInt widgetId = iData[i]->AppUid().iUid;
   635             if (widgetId == aWgIdForScreenshot)
   645             if (widgetId == aWgIdForScreenshot)
   636                 {
   646                 {
   637                 iData[i]->SetScreenshotHandle(aBitmapHandle);
   647                 iData[i]->SetScreenshotHandle(aBitmapHandle);
   638                 aAsigned = ETrue;
   648                 aAsigned = ETrue;
       
   649                 SetDirty(ETrue);
   639                 break;
   650                 break;
   640                 }  
   651                 }  
   641 			continue;          
   652 			continue;          
   642             }
   653             }
   643         TInt appWgId = iData[i]->WgId();
   654         TInt appWgId = iData[i]->WgId();
   644         if (appWgId == aWgIdForScreenshot)
   655         if (appWgId == aWgIdForScreenshot)
   645             {
   656             {
   646             iData[i]->SetScreenshotHandle(aBitmapHandle);
   657             iData[i]->SetScreenshotHandle(aBitmapHandle);
   647             aAsigned = ETrue;
   658             aAsigned = ETrue;
       
   659             SetDirty(ETrue);          
   648             break;
   660             break;
   649             }
   661             }
   650         }
   662         }
   651     }
   663     }
   652 
   664 
   798     TUid appUid = windowName->AppUid();
   810     TUid appUid = windowName->AppUid();
   799     CleanupStack::PopAndDestroy( windowName );
   811     CleanupStack::PopAndDestroy( windowName );
   800     return appUid;
   812     return appUid;
   801     }
   813     }
   802 
   814 
       
   815 // --------------------------------------------------------------------------
       
   816 // CTsFswDataList::RemoveScreenshotFromParent
       
   817 // --------------------------------------------------------------------------
       
   818 //
       
   819 TBool CTsFswDataList::RemoveScreenshotFromParent( TInt aBmpHandle )
       
   820     {
       
   821     TBool changed(EFalse);
       
   822     for( TInt i = 0; i < iData.Count(); ++i)
       
   823         {
       
   824         if ( !iData[i]->Widget() && iData[i]->ScreenshotHandle() == aBmpHandle )
       
   825             {
       
   826             changed = ETrue;
       
   827             iData[i]->SetScreenshotHandle(
       
   828                     LookupScreenshotHandle( iData[i]->WgId()) );
       
   829             }
       
   830         }
       
   831     return changed;
       
   832     }
       
   833 
       
   834 
   803 // end of file
   835 // end of file