equal
deleted
inserted
replaced
81 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
82 // |
82 // |
83 void HandleErrorL( TInt aErr ) |
83 void HandleErrorL( TInt aErr ) |
84 { |
84 { |
85 TInt resourceId( NULL ); |
85 TInt resourceId( NULL ); |
86 if ( aErr == KErrTooBig || aErr == KErrNoMemory ) |
86 if ( aErr == KErrTooBig ) |
87 { |
87 { |
88 resourceId = R_QTN_HS_TOO_BIG_IMAGE_NOTE; |
88 resourceId = R_QTN_HS_TOO_BIG_IMAGE_NOTE; |
|
89 } |
|
90 else if( aErr == KErrNoMemory ) |
|
91 { |
|
92 resourceId = R_QTN_HS_WALLPAPER_OUT_OF_RAM; |
89 } |
93 } |
90 else if ( aErr == KErrCancel || aErr == KErrCouldNotConnect || |
94 else if ( aErr == KErrCancel || aErr == KErrCouldNotConnect || |
91 aErr == KErrCANoRights ) |
95 aErr == KErrCANoRights ) |
92 { |
96 { |
93 // Ignore these |
97 // Ignore these |
137 // ----------------------------------------------------------------------------- |
141 // ----------------------------------------------------------------------------- |
138 // |
142 // |
139 CXnBackgroundManager::CXnBackgroundManager( CXnViewManager& aViewManager, CHspsWrapper& aWrapper ) |
143 CXnBackgroundManager::CXnBackgroundManager( CXnViewManager& aViewManager, CHspsWrapper& aWrapper ) |
140 : iViewManager( aViewManager ), |
144 : iViewManager( aViewManager ), |
141 iHspsWrapper( aWrapper ), |
145 iHspsWrapper( aWrapper ), |
142 iStoreWallpaper( ETrue ) |
146 iStoreWallpaper( ETrue ), |
|
147 iImageChanged( EFalse ) |
143 { |
148 { |
144 } |
149 } |
145 |
150 |
146 // ----------------------------------------------------------------------------- |
151 // ----------------------------------------------------------------------------- |
147 // Symbian 2nd phase constructor. |
152 // Symbian 2nd phase constructor. |
224 // |
229 // |
225 void CXnBackgroundManager::Draw(const TRect& aRect) const |
230 void CXnBackgroundManager::Draw(const TRect& aRect) const |
226 { |
231 { |
227 CFbsBitmap* wallpaper( NULL ); |
232 CFbsBitmap* wallpaper( NULL ); |
228 |
233 |
229 if( iType == EPageSpecific ) |
234 if( iImageChanged ) |
|
235 { |
|
236 iImageChanged = EFalse; |
|
237 wallpaper = iWallpaper; |
|
238 iWallpaper = NULL; |
|
239 } |
|
240 else if( iType == EPageSpecific ) |
230 { |
241 { |
231 CXnViewData& viewData( iViewManager.ActiveViewData() ); |
242 CXnViewData& viewData( iViewManager.ActiveViewData() ); |
232 wallpaper = viewData.WallpaperImage(); |
243 wallpaper = viewData.WallpaperImage(); |
233 } |
244 } |
234 else if( iType == ECommon ) |
245 else if( iType == ECommon ) |
330 // ----------------------------------------------------------------------------- |
341 // ----------------------------------------------------------------------------- |
331 // |
342 // |
332 void CXnBackgroundManager::HandleNotifyDisk( TInt /*aError*/, |
343 void CXnBackgroundManager::HandleNotifyDisk( TInt /*aError*/, |
333 const TDiskEvent& aEvent ) |
344 const TDiskEvent& aEvent ) |
334 { |
345 { |
335 if( aEvent.iType == MDiskNotifyHandlerCallback::EDiskStatusChanged || |
346 if( aEvent.iType == MDiskNotifyHandlerCallback::EDiskStatusChanged ) |
336 aEvent.iType == MDiskNotifyHandlerCallback::EDiskAdded || |
347 { |
337 aEvent.iType == MDiskNotifyHandlerCallback::EDiskRemoved ) |
348 if( aEvent.iInfo.iType == EMediaHardDisk ) |
338 { |
349 { |
339 if( !( aEvent.iInfo.iDriveAtt & KDriveAttInternal ) ) |
350 TRAP_IGNORE( RemovableDiskInsertedL() ); |
340 { |
351 } |
341 TBool diskRemoved( aEvent.iInfo.iType == EMediaNotPresent ); |
352 else if( aEvent.iInfo.iType == EMediaNotPresent ) |
342 |
353 { |
343 if( diskRemoved ) |
354 TRAP_IGNORE( RemovableDiskRemovedL() ); |
344 { |
|
345 TRAP_IGNORE( RemovableDiskRemovedL() ); |
|
346 } |
|
347 else |
|
348 { |
|
349 TRAP_IGNORE( RemovableDiskInsertedL() ); |
|
350 } |
|
351 } |
355 } |
352 } |
356 } |
353 } |
357 } |
354 |
358 |
355 // ----------------------------------------------------------------------------- |
359 // ----------------------------------------------------------------------------- |
407 appui.EffectManager()->BeginFullscreenEffectL( KGfxContextOpenWallpaperView ); |
411 appui.EffectManager()->BeginFullscreenEffectL( KGfxContextOpenWallpaperView ); |
408 } |
412 } |
409 else |
413 else |
410 { |
414 { |
411 // Potentially not enough memory |
415 // Potentially not enough memory |
412 iViewManager.OomSysHandler().HandlePotentialOomL(); |
416 HandleErrorL( KErrNoMemory ); |
413 } |
417 } |
414 } |
418 } |
415 } |
419 } |
416 |
420 |
417 // --------------------------------------------------------------------------- |
421 // --------------------------------------------------------------------------- |
482 const TDesC& newwp( aNewView.WallpaperImagePath() ); |
486 const TDesC& newwp( aNewView.WallpaperImagePath() ); |
483 |
487 |
484 if ( oldwp.Compare( newwp ) ) |
488 if ( oldwp.Compare( newwp ) ) |
485 { |
489 { |
486 iStoreWallpaper = ETrue; |
490 iStoreWallpaper = ETrue; |
487 |
491 iImageChanged = ETrue; |
|
492 iWallpaper = aNewView.WallpaperImage(); |
488 if ( aDrawNow ) |
493 if ( aDrawNow ) |
489 { |
494 { |
490 DrawNow(); |
495 DrawNow(); |
491 } |
496 } |
492 } |
497 } |
778 CXnViewData* viewData = static_cast<CXnViewData*>( rootDataArr[i] ); |
783 CXnViewData* viewData = static_cast<CXnViewData*>( rootDataArr[i] ); |
779 const TDesC& path = viewData->WallpaperImagePath(); |
784 const TDesC& path = viewData->WallpaperImagePath(); |
780 CFbsBitmap* bitmap = viewData->WallpaperImage(); |
785 CFbsBitmap* bitmap = viewData->WallpaperImage(); |
781 if( path != KNullDesC && bitmap ) |
786 if( path != KNullDesC && bitmap ) |
782 { |
787 { |
783 if ( !BaflUtils::FileExists( fs, path ) ) |
788 if ( !BaflUtils::FileExists( fs, path ) && path.Compare( KNullDesC ) != KErrNone ) |
784 { |
789 { |
785 RemoveWallpaperFromCache( path, viewData ); |
790 iSkinSrv.RemoveWallpaper( path ); |
786 viewData->SetWallpaperImage( NULL ); |
791 viewData->SetWallpaperImage( NULL ); |
787 if( viewData == &iViewManager.ActiveViewData() ) |
792 if( viewData == &iViewManager.ActiveViewData() ) |
788 { |
793 { |
789 drawingNeeded = ETrue; |
794 drawingNeeded = ETrue; |
790 } |
795 } |
794 } |
799 } |
795 else |
800 else |
796 { |
801 { |
797 if( iBgImagePath && iBgImage ) |
802 if( iBgImagePath && iBgImage ) |
798 { |
803 { |
799 if ( !BaflUtils::FileExists( fs, *iBgImagePath ) ) |
804 if ( !BaflUtils::FileExists( fs, *iBgImagePath ) && iBgImagePath->Compare( KNullDesC ) != KErrNone ) |
800 { |
805 { |
801 RemoveWallpaperFromCache( *iBgImagePath ); |
806 iSkinSrv.RemoveWallpaper( *iBgImagePath ); |
802 delete iBgImage; |
807 delete iBgImage; |
803 iBgImage = NULL; |
808 iBgImage = NULL; |
804 drawingNeeded = ETrue; |
809 drawingNeeded = ETrue; |
805 } |
810 } |
806 } |
811 } |
923 TInt err( KErrNone ); |
928 TInt err( KErrNone ); |
924 iIntUpdate++; |
929 iIntUpdate++; |
925 |
930 |
926 if( aFileName == KNullDesC ) |
931 if( aFileName == KNullDesC ) |
927 { |
932 { |
928 err = AknsWallpaperUtils::SetIdleWallpaper( aFileName, NULL ); |
933 if( viewData.WallpaperImagePath() == KNullDesC ) |
|
934 { |
|
935 // Default already set as background. |
|
936 err = KErrCancel; |
|
937 } |
|
938 else |
|
939 { |
|
940 err = AknsWallpaperUtils::SetIdleWallpaper( aFileName, NULL ); |
|
941 } |
929 } |
942 } |
930 else |
943 else |
931 { |
944 { |
932 // Wallpaper is also added into the cache if it is not there already. |
945 // Wallpaper is also added into the cache if it is not there already. |
933 err = AknsWallpaperUtils::SetIdleWallpaper( aFileName, CCoeEnv::Static(), |
946 err = AknsWallpaperUtils::SetIdleWallpaper( aFileName, CCoeEnv::Static()/*, |
934 R_QTN_HS_PROCESSING_NOTE, R_CHANGE_WALLPAPER_WAIT_DIALOG ); |
947 R_QTN_HS_PROCESSING_NOTE, R_CHANGE_WALLPAPER_WAIT_DIALOG */ ); |
935 } |
948 } |
|
949 |
936 if( err == KErrNone ) |
950 if( err == KErrNone ) |
937 { |
951 { |
938 // Remove old wallpaper from the cache |
952 // Remove old wallpaper from the cache |
939 const TDesC& oldPath = viewData.WallpaperImagePath(); |
953 const TDesC& oldPath = viewData.WallpaperImagePath(); |
940 RemoveWallpaperFromCache( oldPath ); |
954 RemoveWallpaperFromCache( oldPath ); |