symbian 来电铃声及情景模式设置
2010-08-11 12:19:00 来源:WEB开发网//设置信息提示声 信息铃声设置不需要重启情景模式
TBool CRingManager::SetMsgRing(const TDesC& aPath)
{
TInt ret = KErrNone;
RFs aFs;
aFs.Connect();
if (!(BaflUtils::FileExists(aFs, aPath)))
{
ret = KErrNotFound;
}
aFs.Close();
if (ret == KErrNone)
{
const TUid KUidSound =
{
0x101f8798
};
CRepository* repository = CRepository::NewL(KUidSound);
TInt mode = -1;
repository->Get(0x7e000001, mode);
TInt k = mode << 24 | 0x06; //信息提示声
ret=repository->Set(k, aPath);
delete repository;
repository = NULL;
}
if (ret == KErrNone)
{
return TRUE;
}
else
{
return FALSE;
}
}
//=============================================================================
//获取信息提示声
TFileName CRingManager::GetMsgRing()
{
TFileName toneFile;
const TUid KUidSound =
{
0x101f8798
};
CRepository* repository = CRepository::NewL(KUidSound);
TInt mode = -1;
repository->Get(0x7e000001, mode);
TInt k = mode << 24 | 0x06; //信息提示声
repository->Get(k,toneFile);
delete repository;
repository = NULL;
return toneFile;
}
//=============================================================================
//设置振动开关
TBool CRingManager::SetLibrateRing(TBool bOpen)
{
//设置当前情景模式与铃声
const TUid KUidSound =
{
0x101f8798
};
CRepository* repository = CRepository::NewL(KUidSound);
赞助商链接