idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp
branchRCL_3
changeset 31 89165693e770
parent 28 d721605b30d0
child 32 f00a6757af32
equal deleted inserted replaced
28:d721605b30d0 31:89165693e770
   147 // Symbian 2nd phase constructor.
   147 // Symbian 2nd phase constructor.
   148 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   149 //
   149 //
   150 void CXnBackgroundManager::ConstructL()
   150 void CXnBackgroundManager::ConstructL()
   151     {    
   151     {    
   152     CreateWindowL();
   152     // Connect to skin server.
   153 
       
   154     iRect = TRect();
       
   155     iBgContext = CAknsLayeredBackgroundControlContext::NewL(
       
   156             KAknsIIDQsnBgScreenIdle, iRect, ETrue, 1 );
       
   157 
       
   158     TRect bgRect;
       
   159     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, bgRect );
       
   160     SetRect( bgRect );
       
   161 
       
   162     Window().SetOrdinalPosition( -1 );
       
   163 
       
   164     MakeVisible( ETrue );
       
   165     ActivateL();
       
   166     iIntUpdate = 0;
       
   167     
       
   168     User::LeaveIfError( iSkinSrv.Connect( this ) );
   153     User::LeaveIfError( iSkinSrv.Connect( this ) );
   169           
   154           
   170     // Start listening for drive events.
   155     // Start listening for drive events.
   171     User::LeaveIfError( iFsSession.Connect() );
   156     User::LeaveIfError( iFsSession.Connect() );
       
   157 
       
   158     CreateWindowL();
       
   159 
       
   160     iRect = TRect();
       
   161     iBgContext = CAknsLayeredBackgroundControlContext::NewL(
       
   162             KAknsIIDQsnBgScreenIdle, iRect, ETrue, 1 );
       
   163 
       
   164     TRect bgRect;
       
   165     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, bgRect );
       
   166     SetRect( bgRect );
       
   167 
       
   168     Window().SetOrdinalPosition( -1 );
       
   169 
       
   170     MakeVisible( ETrue );
       
   171     ActivateL();
       
   172     iIntUpdate = 0;
   172     
   173     
   173     // Start listening file server notifications.
   174     // Start listening file server notifications.
   174     iDiskNotifier = CDiskNotifyHandler::NewL( *this, iFsSession );
   175     iDiskNotifier = CDiskNotifyHandler::NewL( *this, iFsSession );
   175     User::LeaveIfError( iDiskNotifier->NotifyDisk() );
   176     User::LeaveIfError( iDiskNotifier->NotifyDisk() );
   176     
   177     
   177     // Reads from cenrep wheteher page specific wallpaper is enabled or not
   178     // Reads from cenrep wheteher page specific wallpaper is enabled or not
   178     CheckFeatureTypeL();   
   179     CheckFeatureTypeL();   
   179     
   180     
   180     GfxTransEffect::Register( this, KGfxContextBgAppear );       
   181     GfxTransEffect::Register( this, KGfxContextBgAppear );
   181     }
   182     }
   182 
   183 
   183 // -----------------------------------------------------------------------------
   184 // -----------------------------------------------------------------------------
   184 // Two-phased constructor.
   185 // Two-phased constructor.
   185 // -----------------------------------------------------------------------------
   186 // -----------------------------------------------------------------------------
   199 // Destructor.
   200 // Destructor.
   200 // -----------------------------------------------------------------------------
   201 // -----------------------------------------------------------------------------
   201 //
   202 //
   202 CXnBackgroundManager::~CXnBackgroundManager()
   203 CXnBackgroundManager::~CXnBackgroundManager()
   203     {
   204     {
   204     GfxTransEffect::Deregister( this );
   205     if ( GfxTransEffect::IsRegistered( this) )
       
   206         {
       
   207         GfxTransEffect::Deregister( this );
       
   208         }
   205         
   209         
   206     iSkinSrv.RemoveAllWallpapers();
   210     iSkinSrv.RemoveAllWallpapers();
   207     iSkinSrv.Close();
   211     iSkinSrv.Close();
   208     delete iDiskNotifier;
   212     delete iDiskNotifier;
   209     iFsSession.Close();
   213     iFsSession.Close();
  1110         {   
  1114         {   
  1111         iStoreWallpaper = EFalse;
  1115         iStoreWallpaper = EFalse;
  1112 
  1116 
  1113         CXnViewData& activeView = iViewManager.ActiveViewData();
  1117         CXnViewData& activeView = iViewManager.ActiveViewData();
  1114         const TDesC& path( activeView.WallpaperImagePath() );
  1118         const TDesC& path( activeView.WallpaperImagePath() );
  1115         if( path != KNullDesC && activeView.WallpaperImage() )
  1119         RFs& fs( CEikonEnv::Static()->FsSession() );
       
  1120         if ( path != KNullDesC && BaflUtils::FileExists( fs, path ) )
  1116             {
  1121             {
  1117             iIntUpdate++;
  1122             iIntUpdate++;
  1118             TInt err( AknsWallpaperUtils::SetIdleWallpaper( path, NULL ) ); 
  1123             TInt err( AknsWallpaperUtils::SetIdleWallpaper( path, NULL ) ); 
  1119                   
  1124                   
  1120             if( err )
  1125             if( err )