42 #include <imageconversion.h> |
42 #include <imageconversion.h> |
43 #include <bitmaptransforms.h> |
43 #include <bitmaptransforms.h> |
44 #include <StringLoader.h> |
44 #include <StringLoader.h> |
45 #include <aknnotewrappers.h> |
45 #include <aknnotewrappers.h> |
46 #include <bautils.h> |
46 #include <bautils.h> |
|
47 #include <UTF.h> |
47 |
48 |
48 #include <AknsUtils.h> |
49 #include <AknsUtils.h> |
49 #include <AknsDrawUtils.h> |
50 #include <AknsDrawUtils.h> |
50 #include <AknsControlContext.h> |
51 #include <AknsControlContext.h> |
51 #include <AknsLayeredBackgroundControlContext.h> |
52 #include <AknsLayeredBackgroundControlContext.h> |
101 ShowInfoNoteL( resourceId ); |
102 ShowInfoNoteL( resourceId ); |
102 } |
103 } |
103 } |
104 } |
104 |
105 |
105 // ----------------------------------------------------------------------------- |
106 // ----------------------------------------------------------------------------- |
106 // CreateSkinBitmapL |
107 // CreateBitmapFromColorL |
107 // ----------------------------------------------------------------------------- |
108 // Creates a bitmap object with the given size and fill color |
108 // |
109 // ----------------------------------------------------------------------------- |
109 CFbsBitmap* CreateSkinBitmapL( TAknsItemID aId, TRect aRect ) |
110 // |
|
111 static CFbsBitmap* CreateBitmapFromColorL( TSize aSize, TRgb aColor ) |
110 { |
112 { |
111 CFbsBitmap* newBitmap = new ( ELeave ) CFbsBitmap; |
113 CFbsBitmap* newBitmap = new ( ELeave ) CFbsBitmap; |
112 User::LeaveIfError( newBitmap->Create( aRect.Size(), EColor16M ) ); |
114 newBitmap->Create( aSize, EColor16M ); |
113 CleanupStack::PushL( newBitmap ); |
115 CleanupStack::PushL( newBitmap ); |
114 |
116 |
115 CFbsBitmapDevice* bitmapDev = CFbsBitmapDevice::NewL( newBitmap ); |
117 CFbsBitmapDevice* bitmapDev = CFbsBitmapDevice::NewL( newBitmap ); |
116 CleanupStack::PushL( bitmapDev ); |
118 CleanupStack::PushL( bitmapDev ); |
117 |
119 |
118 CBitmapContext* bc( NULL ); |
120 CFbsBitGc* bc = NULL; |
119 User::LeaveIfError( bitmapDev->CreateBitmapContext( bc ) ); |
121 User::LeaveIfError( bitmapDev->CreateContext( bc ) ); |
120 CleanupStack::PushL( bc ); |
122 CleanupStack::PushL( bc ); |
121 |
123 |
122 CAknsBasicBackgroundControlContext* context = |
124 bc->SetBrushColor( aColor ); |
123 CAknsBasicBackgroundControlContext::NewL( aId, aRect, EFalse ); |
125 bc->Clear(); // area is filled with the brush color |
124 CleanupStack::PushL( context ); |
126 |
125 |
127 CleanupStack::PopAndDestroy( bc ); |
126 AknsDrawUtils::Background( AknsUtils::SkinInstance(), |
128 CleanupStack::PopAndDestroy( bitmapDev ); |
127 context, static_cast< CWindowGc& >( *bc ), aRect ); |
|
128 |
|
129 CleanupStack::PopAndDestroy( 3, bitmapDev ); |
|
130 CleanupStack::Pop( newBitmap ); |
129 CleanupStack::Pop( newBitmap ); |
131 return newBitmap; |
130 return newBitmap; |
132 } |
131 } |
133 |
132 |
134 // ============================ MEMBER FUNCTIONS =============================== |
133 // ============================ MEMBER FUNCTIONS =============================== |
135 |
134 |
136 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
137 // C++ default constructor. |
136 // C++ default constructor. |
138 // ----------------------------------------------------------------------------- |
137 // ----------------------------------------------------------------------------- |
327 // ----------------------------------------------------------------------------- |
326 // ----------------------------------------------------------------------------- |
328 // |
327 // |
329 void CXnBackgroundManager::HandleNotifyDisk( TInt /*aError*/, |
328 void CXnBackgroundManager::HandleNotifyDisk( TInt /*aError*/, |
330 const TDiskEvent& aEvent ) |
329 const TDiskEvent& aEvent ) |
331 { |
330 { |
332 if( aEvent.iType == MDiskNotifyHandlerCallback::EDiskStatusChanged ) |
331 if( aEvent.iType == MDiskNotifyHandlerCallback::EDiskStatusChanged || |
|
332 aEvent.iType == MDiskNotifyHandlerCallback::EDiskAdded || |
|
333 aEvent.iType == MDiskNotifyHandlerCallback::EDiskRemoved ) |
333 { |
334 { |
334 if( !( aEvent.iInfo.iDriveAtt & KDriveAttInternal ) ) |
335 if( !( aEvent.iInfo.iDriveAtt & KDriveAttInternal ) ) |
335 { |
336 { |
336 TBool diskRemoved( aEvent.iInfo.iType == EMediaNotPresent ); |
337 TBool diskRemoved( aEvent.iInfo.iType == EMediaNotPresent ); |
337 |
338 |
528 void CXnBackgroundManager::SaveWallpaperL() |
529 void CXnBackgroundManager::SaveWallpaperL() |
529 { |
530 { |
530 // Save wallpaper to HSPS |
531 // Save wallpaper to HSPS |
531 if( iType == EPageSpecific ) |
532 if( iType == EPageSpecific ) |
532 { |
533 { |
533 TBuf8<KMaxFileName> wallpaper8; |
|
534 CXnViewData& viewData( iViewManager.ActiveViewData() ); |
534 CXnViewData& viewData( iViewManager.ActiveViewData() ); |
535 wallpaper8.Copy( viewData.WallpaperImagePath() ); |
535 |
536 SetSettingPropertyL( viewData.PluginId(), KWallpaper, |
536 HBufC8* pUtf8String = CnvUtfConverter::ConvertFromUnicodeToUtf8L( viewData.WallpaperImagePath() ); |
537 KPath, wallpaper8 ); |
537 CleanupStack::PushL( pUtf8String ); |
|
538 |
|
539 SetSettingPropertyL( viewData.PluginId(), |
|
540 KWallpaper, |
|
541 KPath, |
|
542 *pUtf8String ); |
|
543 |
|
544 CleanupStack::PopAndDestroy( pUtf8String ); |
|
545 pUtf8String = NULL; |
538 } |
546 } |
539 else |
547 else |
540 { |
548 { |
541 CRepository* repository = CRepository::NewLC( TUid::Uid( KCRUidActiveIdleLV ) ); |
549 CRepository* repository = CRepository::NewLC( TUid::Uid( KCRUidActiveIdleLV ) ); |
542 if ( repository ) |
550 if ( repository ) |
1154 } |
1162 } |
1155 |
1163 |
1156 TRect spRect; |
1164 TRect spRect; |
1157 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, spRect ); |
1165 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, spRect ); |
1158 |
1166 |
1159 iSpBitmap = CreateSkinBitmapL( KAknsIIDQsnBgScreenIdle, spRect ); |
1167 MAknsSkinInstance* skinInstance( AknsUtils::SkinInstance() ); |
|
1168 |
|
1169 // Get Homescreen status area mask color (EAknsCIQsnOtherColorsCG23) |
|
1170 TRgb color; |
|
1171 User::LeaveIfError( AknsUtils::GetCachedColor( skinInstance, color, |
|
1172 KAknsIIDQsnOtherColors, EAknsCIQsnOtherColorsCG23 ) ); |
|
1173 |
|
1174 iSpBitmap = CreateBitmapFromColorL( spRect.Size(), color ); |
1160 |
1175 |
1161 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
1176 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
1162 { |
1177 { |
1163 iSpMask = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(), |
1178 iSpMask = AknsUtils::CreateBitmapL( skinInstance, |
1164 KAknsIIDQgnGrafBgLscTopMaskIcon ); |
1179 KAknsIIDQgnGrafBgLscTopMaskIcon ); |
1165 } |
1180 } |
1166 else |
1181 else |
1167 { |
1182 { |
1168 iSpMask = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(), |
1183 iSpMask = AknsUtils::CreateBitmapL( skinInstance, |
1169 KAknsIIDQgnGrafBgPrtTopMaskIcon ); |
1184 KAknsIIDQgnGrafBgPrtTopMaskIcon ); |
1170 } |
1185 } |
1171 |
1186 |
1172 if ( iSpMask ) |
1187 if ( iSpMask ) |
1173 { |
1188 { |