symbian 来电铃声及情景模式设置
2010-08-11 12:19:00 来源:WEB开发网//设置来电铃声
TBool CRingManager::SetCallRing(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 | 0x04; //来电铃声
ret=repository->Set(k, aPath);
repository->Set(0x7E000008,1); //铃声声量
delete repository;
repository = NULL;
//重起情景模式。
MProfileEngine* profileEngine = CreateProfileEngineL();
CleanupReleasePushL(*profileEngine);
profileEngine->SetActiveProfileL(profileEngine->ActiveProfileId());
CleanupStack::PopAndDestroy(1);
}
if(ret == KErrNone)
{
return TRUE;
}
else
{
return FALSE;
}
}
//=============================================================================
//获取来电钤声
TFileName CRingManager::GetCallRing()
{
TFileName toneFile;
const TUid KUidSound =
{
0x101f8798
};
CRepository* repository = CRepository::NewL(KUidSound);
TInt mode = -1;
repository->Get(0x7e000001, mode);
TInt k = mode << 24 | 0x04; //来电铃声
repository->Get(k,toneFile);
delete repository;
repository = NULL;
return toneFile;
}
//=============================================================================
赞助商链接