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 ) |
86 if ( aErr == KErrTooBig || aErr == KErrNoMemory ) |
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; |
|
93 } |
89 } |
94 else if ( aErr == KErrCancel || aErr == KErrCouldNotConnect || |
90 else if ( aErr == KErrCancel || aErr == KErrCouldNotConnect || |
95 aErr == KErrCANoRights ) |
91 aErr == KErrCANoRights ) |
96 { |
92 { |
97 // Ignore these |
93 // Ignore these |
141 // ----------------------------------------------------------------------------- |
137 // ----------------------------------------------------------------------------- |
142 // |
138 // |
143 CXnBackgroundManager::CXnBackgroundManager( CXnViewManager& aViewManager, CHspsWrapper& aWrapper ) |
139 CXnBackgroundManager::CXnBackgroundManager( CXnViewManager& aViewManager, CHspsWrapper& aWrapper ) |
144 : iViewManager( aViewManager ), |
140 : iViewManager( aViewManager ), |
145 iHspsWrapper( aWrapper ), |
141 iHspsWrapper( aWrapper ), |
146 iStoreWallpaper( ETrue ), |
142 iStoreWallpaper( ETrue ) |
147 iImageChanged( EFalse ) |
|
148 { |
143 { |
149 } |
144 } |
150 |
145 |
151 // ----------------------------------------------------------------------------- |
146 // ----------------------------------------------------------------------------- |
152 // Symbian 2nd phase constructor. |
147 // Symbian 2nd phase constructor. |
229 // |
224 // |
230 void CXnBackgroundManager::Draw(const TRect& aRect) const |
225 void CXnBackgroundManager::Draw(const TRect& aRect) const |
231 { |
226 { |
232 CFbsBitmap* wallpaper( NULL ); |
227 CFbsBitmap* wallpaper( NULL ); |
233 |
228 |
234 if( iImageChanged ) |
229 if( iType == EPageSpecific ) |
235 { |
|
236 iImageChanged = EFalse; |
|
237 wallpaper = iWallpaper; |
|
238 iWallpaper = NULL; |
|
239 } |
|
240 else if( iType == EPageSpecific ) |
|
241 { |
230 { |
242 CXnViewData& viewData( iViewManager.ActiveViewData() ); |
231 CXnViewData& viewData( iViewManager.ActiveViewData() ); |
243 wallpaper = viewData.WallpaperImage(); |
232 wallpaper = viewData.WallpaperImage(); |
244 } |
233 } |
245 else if( iType == ECommon ) |
234 else if( iType == ECommon ) |
352 else if( aEvent.iInfo.iType == EMediaNotPresent ) |
341 else if( aEvent.iInfo.iType == EMediaNotPresent ) |
353 { |
342 { |
354 TRAP_IGNORE( RemovableDiskRemovedL() ); |
343 TRAP_IGNORE( RemovableDiskRemovedL() ); |
355 } |
344 } |
356 } |
345 } |
357 else if( aEvent.iType == MDiskNotifyHandlerCallback::EDiskAdded ) |
|
358 { |
|
359 if( aEvent.iInfo.iType == EMediaHardDisk ) |
|
360 { |
|
361 TRAP_IGNORE( RemovableDiskInsertedL() ); |
|
362 } |
|
363 } |
|
364 else if( aEvent.iType == MDiskNotifyHandlerCallback::EDiskRemoved ) |
|
365 { |
|
366 if( aEvent.iInfo.iType == EMediaNotPresent ) |
|
367 { |
|
368 TRAP_IGNORE( RemovableDiskRemovedL() ); |
|
369 } |
|
370 } |
|
371 } |
346 } |
372 |
347 |
373 // ----------------------------------------------------------------------------- |
348 // ----------------------------------------------------------------------------- |
374 // CXnBackgroundManager::ConstructWallpaper |
349 // CXnBackgroundManager::ConstructWallpaper |
375 // ----------------------------------------------------------------------------- |
350 // ----------------------------------------------------------------------------- |
425 appui.EffectManager()->BeginFullscreenEffectL( KGfxContextOpenWallpaperView ); |
400 appui.EffectManager()->BeginFullscreenEffectL( KGfxContextOpenWallpaperView ); |
426 } |
401 } |
427 else |
402 else |
428 { |
403 { |
429 // Potentially not enough memory |
404 // Potentially not enough memory |
430 HandleErrorL( KErrNoMemory ); |
405 iViewManager.OomSysHandler().HandlePotentialOomL(); |
431 } |
406 } |
432 } |
407 } |
433 } |
408 } |
434 |
409 |
435 // --------------------------------------------------------------------------- |
410 // --------------------------------------------------------------------------- |
500 const TDesC& newwp( aNewView.WallpaperImagePath() ); |
475 const TDesC& newwp( aNewView.WallpaperImagePath() ); |
501 |
476 |
502 if ( oldwp.Compare( newwp ) ) |
477 if ( oldwp.Compare( newwp ) ) |
503 { |
478 { |
504 iStoreWallpaper = ETrue; |
479 iStoreWallpaper = ETrue; |
505 iImageChanged = ETrue; |
480 |
506 iWallpaper = aNewView.WallpaperImage(); |
|
507 if ( aDrawNow ) |
481 if ( aDrawNow ) |
508 { |
482 { |
509 DrawNow(); |
483 DrawNow(); |
510 } |
484 } |
511 } |
485 } |
764 { |
738 { |
765 CXnViewData* viewData = static_cast<CXnViewData*>( rootDataArr[i] ); |
739 CXnViewData* viewData = static_cast<CXnViewData*>( rootDataArr[i] ); |
766 const TDesC& path = viewData->WallpaperImagePath(); |
740 const TDesC& path = viewData->WallpaperImagePath(); |
767 if( path != KNullDesC ) |
741 if( path != KNullDesC ) |
768 { |
742 { |
769 CFbsBitmap* bitmap = iSkinSrv.WallpaperImageL( path ); |
743 CFbsBitmap* bitmap = NULL; |
770 if( bitmap ) |
744 TRAPD( err, bitmap = iSkinSrv.WallpaperImageL( path ) ); |
|
745 if( err == KErrNone && bitmap ) |
771 { |
746 { |
772 viewData->SetWallpaperImage( bitmap ); |
747 viewData->SetWallpaperImage( bitmap ); |
|
748 } |
|
749 else |
|
750 { |
|
751 viewData->SetWallpaperImage( NULL ); |
773 } |
752 } |
774 } |
753 } |
775 } |
754 } |
776 } |
755 } |
777 |
756 |
797 CXnViewData* viewData = static_cast<CXnViewData*>( rootDataArr[i] ); |
776 CXnViewData* viewData = static_cast<CXnViewData*>( rootDataArr[i] ); |
798 const TDesC& path = viewData->WallpaperImagePath(); |
777 const TDesC& path = viewData->WallpaperImagePath(); |
799 CFbsBitmap* bitmap = viewData->WallpaperImage(); |
778 CFbsBitmap* bitmap = viewData->WallpaperImage(); |
800 if( path != KNullDesC && bitmap ) |
779 if( path != KNullDesC && bitmap ) |
801 { |
780 { |
802 if ( !BaflUtils::FileExists( fs, path ) && path.Compare( KNullDesC ) != KErrNone ) |
781 if ( !BaflUtils::FileExists( fs, path ) ) |
803 { |
782 { |
804 iSkinSrv.RemoveWallpaper( path ); |
783 RemoveWallpaperFromCache( path, viewData ); |
805 viewData->SetWallpaperImage( NULL ); |
784 viewData->SetWallpaperImage( NULL ); |
806 if( viewData == &iViewManager.ActiveViewData() ) |
785 if( viewData == &iViewManager.ActiveViewData() ) |
807 { |
786 { |
808 drawingNeeded = ETrue; |
787 drawingNeeded = ETrue; |
809 } |
788 } |
813 } |
792 } |
814 else |
793 else |
815 { |
794 { |
816 if( iBgImagePath && iBgImage ) |
795 if( iBgImagePath && iBgImage ) |
817 { |
796 { |
818 if ( !BaflUtils::FileExists( fs, *iBgImagePath ) && iBgImagePath->Compare( KNullDesC ) != KErrNone ) |
797 if ( !BaflUtils::FileExists( fs, *iBgImagePath ) ) |
819 { |
798 { |
820 iSkinSrv.RemoveWallpaper( *iBgImagePath ); |
799 RemoveWallpaperFromCache( *iBgImagePath ); |
821 delete iBgImage; |
800 delete iBgImage; |
822 iBgImage = NULL; |
801 iBgImage = NULL; |
823 drawingNeeded = ETrue; |
802 drawingNeeded = ETrue; |
824 } |
803 } |
825 } |
804 } |
942 TInt err( KErrNone ); |
921 TInt err( KErrNone ); |
943 iIntUpdate++; |
922 iIntUpdate++; |
944 |
923 |
945 if( aFileName == KNullDesC ) |
924 if( aFileName == KNullDesC ) |
946 { |
925 { |
947 if( viewData.WallpaperImagePath() == KNullDesC ) |
926 err = AknsWallpaperUtils::SetIdleWallpaper( aFileName, NULL ); |
948 { |
|
949 // Default already set as background. |
|
950 err = KErrCancel; |
|
951 } |
|
952 else |
|
953 { |
|
954 err = AknsWallpaperUtils::SetIdleWallpaper( aFileName, NULL ); |
|
955 } |
|
956 } |
927 } |
957 else |
928 else |
958 { |
929 { |
959 // Wallpaper is also added into the cache if it is not there already. |
930 // Wallpaper is also added into the cache if it is not there already. |
960 err = AknsWallpaperUtils::SetIdleWallpaper( aFileName, CCoeEnv::Static()/*, |
931 err = AknsWallpaperUtils::SetIdleWallpaper( aFileName, CCoeEnv::Static(), |
961 R_QTN_HS_PROCESSING_NOTE, R_CHANGE_WALLPAPER_WAIT_DIALOG */ ); |
932 R_QTN_HS_PROCESSING_NOTE, R_CHANGE_WALLPAPER_WAIT_DIALOG ); |
962 } |
933 } |
963 |
|
964 if( err == KErrNone ) |
934 if( err == KErrNone ) |
965 { |
935 { |
966 // Remove old wallpaper from the cache |
936 // Remove old wallpaper from the cache |
967 const TDesC& oldPath = viewData.WallpaperImagePath(); |
937 const TDesC& oldPath = viewData.WallpaperImagePath(); |
968 RemoveWallpaperFromCache( oldPath ); |
938 RemoveWallpaperFromCache( oldPath ); |
1147 CXnViewData& activeView = iViewManager.ActiveViewData(); |
1117 CXnViewData& activeView = iViewManager.ActiveViewData(); |
1148 const TDesC& path( activeView.WallpaperImagePath() ); |
1118 const TDesC& path( activeView.WallpaperImagePath() ); |
1149 RFs& fs( CEikonEnv::Static()->FsSession() ); |
1119 RFs& fs( CEikonEnv::Static()->FsSession() ); |
1150 if ( path != KNullDesC && BaflUtils::FileExists( fs, path ) ) |
1120 if ( path != KNullDesC && BaflUtils::FileExists( fs, path ) ) |
1151 { |
1121 { |
1152 |
|
1153 iIntUpdate++; |
1122 iIntUpdate++; |
1154 TInt err( AknsWallpaperUtils::SetIdleWallpaper( path, NULL ) ); |
1123 TInt err( AknsWallpaperUtils::SetIdleWallpaper( path, NULL ) ); |
|
1124 |
1155 if( err ) |
1125 if( err ) |
1156 { |
1126 { |
1157 iIntUpdate--; |
1127 iIntUpdate--; |
1158 |
1128 |
1159 if ( err == KErrCANoRights ) |
1129 if ( err == KErrCANoRights ) |
1172 iIntUpdate++; |
1142 iIntUpdate++; |
1173 TInt err( AknsWallpaperUtils::SetIdleWallpaper( KNullDesC, NULL ) ); |
1143 TInt err( AknsWallpaperUtils::SetIdleWallpaper( KNullDesC, NULL ) ); |
1174 if( err ) |
1144 if( err ) |
1175 { |
1145 { |
1176 iIntUpdate--; |
1146 iIntUpdate--; |
1177 } |
1147 } |
1178 |
1148 } |
1179 // If the drive was formatted or temporarily detached or the image was removed |
|
1180 if( path.Length() ) |
|
1181 { |
|
1182 iViewManager.ActiveViewData().SetWallpaperImage( NULL ); |
|
1183 iSkinSrv.RemoveWallpaper( path ); |
|
1184 DrawNow(); |
|
1185 } |
|
1186 } |
|
1187 } |
1149 } |
1188 } |
1150 } |
1189 |
1151 |
1190 // ----------------------------------------------------------------------------- |
1152 // ----------------------------------------------------------------------------- |
1191 // CXnBackgroundManager::UpdateStatuspaneMaskL |
1153 // CXnBackgroundManager::UpdateStatuspaneMaskL |