×
Namespaces

Variants
Actions

个性化和皮肤设置API

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

代码示例
文章
hoolee 在 25 Jul 2008 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

CS001025


设备, 软件 版本: S60 3rd Edition, FP2


Contents

详细描述

个性化和皮肤设置API可以用来获得如下信息:

  • 当前皮肤(主题)的位置和它的UID
  • 可用的颜色配置
  • 当前颜色配置和它的UID
  • 待机时的背景位图索引和存放路径
  • 待机状态下的背景图UID
  • 屏保路径名称
  • 系统缺省屏保
  • 墙纸类型,全屏墙纸的状态


头文件

 #include <aknskinsinternalcrkeys.h>
#include <centralrepository.h> // for CRepository


链接库

LIBRARY   centralrepository.lib 
CRepository* iRepository = CRepository::NewL( KCRUidPersonalisation );


示例代码

获得当前皮肤的位置(整型值)

所有可能值如:0: Phone (drives C:\ and Z:\) 2: MMC (E:\)

iErrCode = iRepository->Get(KPslnActiveSkinLocation, iId);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
switch(iId)
{
case 0:
{
iBufInfo.Copy(_L("C or Z drive"));
}
break;
case 2:
{
iBufInfo.Copy(_L("E drive"));
}
break;
default:
{
iBufInfo.Copy(_L("Err"));
}
break;
}
CEikonEnv::InfoWinL(_L("Loc of active skin"), iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting active skinloc"),iBufErrCode);
}
 
iBufErrCode.Zero();
iBufInfo.Zero();

获得当前皮肤的UID

iErrCode = iRepository->Get(KPslnActiveSkinUid, iBufInfo);
iBufErrCode.AppendNum(iErrCode);
if( iErrCode == KErrNone )
{
iIntConv.Assign(iBufInfo);
iIntConv.Val(iUid.iUid);
iBufInfo.Copy(iUid.Name());
CEikonEnv::InfoWinL(_L("Uid of active skin"), iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting active skin uid"),iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();
iUid = TUid::Null();

获得颜色配置

所有可能值为:0: Nokia "Classic" blue 1: Nokia green 2: Nokia purple 3: red 4: pink 5: orange

iErrCode = iRepository->Get(KPslnColorPalette, iId);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
switch( iId )
{
case 0:
{
iBufInfo.Copy(_L("blue"));
}
break;
case 1:
{
iBufInfo.Copy(_L("green"));
}
break;
case 2:
{
iBufInfo.Copy(_L("purple"));
}
break;
case 3:
{
iBufInfo.Copy(_L("red"));
}
break;
case 4:
{
iBufInfo.Copy(_L("pink"));
}
break;
case 5:
{
iBufInfo.Copy(_L("orange"));
}
break;
default:
{
iBufInfo.Copy(_L("err"));
}
break;
}
CEikonEnv::InfoWinL(_L("Color scheme"), iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Colour "),iBufErrCode);
}
 
iBufErrCode.Zero();
iBufInfo.Zero();


获得待机状态下当前暗色背景图的位图索引

iErrCode = iRepository->Get(KPslnDimmedIdleBackgroundImageIndex, iId);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
iBufInfo.AppendNum(iId);
CEikonEnv::InfoWinL(_L("Bitmap index of the active dimmed background image in the idle state:"),
 
iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Bitmap Image Index:"), iBufErrCode);
}
 
iBufErrCode.Zero();
iBufInfo.Zero();

获得Favorites下当前背景图的位图索引

iErrCode = iRepository->Get(KPslnFavouritesBackgroundImageIndex, iId);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
iBufInfo.AppendNum(iId);
CEikonEnv::InfoWinL(_L("Favourites Background Image Index:"),iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Bitmap Image Index:"),iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();


获得待机状态下当前背景图的位图索引

iErrCode = iRepository->Get(KPslnIdleBackgroundImageIndex, iId);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
iBufInfo.AppendNum(iId);
CEikonEnv::InfoWinL(_L("Idle Background Image Index:"), iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Bitmap Image Index:"),iBufErrCode);
}
 
iBufErrCode.Zero();
iBufInfo.Zero();

获得待机状态下当前背景图的路径名:

iErrCode = iRepository->Get(KPslnIdleBackgroundImagePath, iBufInfo);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
CEikonEnv::InfoWinL(_L("Path of BgImg in Idle state:"), iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Path"), iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();

获得Favorites中当前背景图的路径名

iErrCode = iRepository->Get(KPslnFavouritesBackgroundImagePath, iBufInfo);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
CEikonEnv::InfoWinL(_L("Path of BgImg in Favourites:"), iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Path"), iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();

获得当前icon set UID

iErrCode = iRepository->Get(KPslnIconSetUid, iBufInfo);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
iIntConv.Assign(iBufInfo);
iIntConv.Val(iUid.iUid);
iBufInfo.Copy(iUid.Name());
CEikonEnv::InfoWinL(_L("Uid Active icon set:"), iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting active icon uid"),iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();
iUid = TUid::Null();

获得当前屏保UID

iErrCode = iRepository->Get(KPslnScreenSaverUid, iId);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
iUid = TUid::Uid(iId);
CEikonEnv::InfoWinL(_L("Active screen savers Uid:"),iUid.Name());
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Active screen savers Uid."),
iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();
iUid = TUid::Null();

获得系统缺省屏保(只读)

iErrCode = iRepository->Get(KPslnSystemDefaultScreenSaver, iBufInfo);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
iIntConv.Assign(iBufInfo);
iIntConv.Val(iUid.iUid);
iBufInfo.Copy(iUid.Name());
CEikonEnv::InfoWinL(_L("Default screen saver:"),iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Default screen saver"),iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();
iUid = TUid::Null();

获得待机状态下当前背景图UID

iErrCode = iRepository->Get(KPslnIdleBackgroundImageUid, iBufInfo);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
iIntConv.Assign(iBufInfo);
iIntConv.Val(iUid.iUid);
iBufInfo.Copy(iUid.Name());
CEikonEnv::InfoWinL(_L("Idle Background Image Uid"),iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting IdleBackgroundImage Uid."),
iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();
iUid = TUid::Null();

获得Favorites当前背景图UID

iErrCode = iRepository->Get(KPslnFavouritesBackgroundImageUid, iBufInfo);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
iIntConv.Assign(iBufInfo);
iIntConv.Val(iUid.iUid);
iBufInfo.Copy(iUid.Name());
CEikonEnv::InfoWinL(_L("Favourites Background Image Uid:"),iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Favourites Background Image Uid"),
iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();
iUid = TUid::Null();

获得所能支持的颜色配置列表

iErrCode = iRepository->Get(KPslnAvailableColorPalettes, iBufInfo);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
CEikonEnv::InfoWinL(_L("AvailableColorPalettes numbered [0 so on]:"),iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting AvailableColorPalettes"), iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();

获得高亮动画开关状态

TInt value;
iErrCode = iRepository->Get(KPslnHighlightAnimationEnabled, value);
iBufErrCode.AppendNum(iErrCode);
if( iErrCode == KErrNone )
{
// To display message
_LIT(message0,"Disabled");
_LIT(message1,"Enabled");
CAknInformationNote* informationNote = new (ELeave)CAknInformationNote;
if( value == 0 )
{
informationNote->ExecuteLD(message0); //disabled
}
else if( value == 1 )
{
informationNote->ExecuteLD(message1); //enabled
}
}
else
{
CEikonEnv::Static()->AlertWin(_L("Err in getting HighlightAnimStatus"), iErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();

获得全屏墙纸状态

// supported from S60 3rd Edition, Feature Pack 2 onwards
TInt value;
iErrCode = iRepository->Get(KPslnFullScreenWallpaperEnabled, value);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
_LIT(message0,"Disabled");
_LIT(message1,"Enabled");
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
if( value == 0 )
{
informationNote->ExecuteLD(message0); //disabled
}
else if( value == 1 )
{
informationNote->ExecuteLD(message1); //enabled
}
}
else
{
CEikonEnv::Static()->AlertWin(_L("Err in getting FullScreenWallpaperStatus"), iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();

获得墙纸类型

// Supported from S60 3rd Edition, Feature Pack 2 onwards
iErrCode = iRepository->Get(KPslnWallpaperType, iId);
iBufErrCode.AppendNum(iErrCode);
if ( iErrCode == KErrNone )
{
switch( iId )
{
case 0:
{
iBufInfo.Copy(_L("None"));
}
break;
case 1:
{
iBufInfo.Copy(_L("Normal"));
}
break;
case 2:
{
iBufInfo.Copy(_L("SlideSet"));
}
break;
default:
{
iBufInfo.Copy(_L("err"));
}
break;
}
CEikonEnv::InfoWinL(_L("Wallpaper Type : "), iBufInfo);
}
else
{
CEikonEnv::InfoWinL(_L("Err in getting Wallpaper type:"), iBufErrCode);
}
iBufErrCode.Zero();
iBufInfo.Zero();

项目示例

下列程序可以在Nokia N78手机上测试

File:PrsnAndSkinSettingsFor3rdFP2.zip

This page was last modified on 15 December 2011, at 08:55.
97 page views in the last 30 days.
×