WEB开发网
开发学院手机开发Symbian 开发 symbian 来电铃声及情景模式设置 阅读

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 = KErrNotFou

//设置来电铃声

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;

}

//=============================================================================

上一页  1 2 3 4 5  下一页

Tags:symbian 来电 铃声

编辑录入:coldstar [复制链接] [打 印]
赞助商链接