symbian 来电铃声及情景模式设置
2010-08-11 12:19:00 来源:WEB开发网下面是自己编写symbian情景模式设置的一点心得,以代码提供.可运行在3rd上.
#include "RingManager.h"
CRingManager::CRingManager()
{
}
CRingManager::~CRingManager()
{
}
//=============================================================================
//设置闹钟
TBool CRingManager::SetClockRing(const TDesC& aPath)
{
TInt ret = KErrNone;
RFs aFs;
aFs.Connect();
if (!(BaflUtils::FileExists(aFs, aPath)))
{
ret = KErrNotFound;
}
aFs.Close();
if (ret == KErrNone)
{
const TUid KCRUidClockApp =
{
0x101F874D
};
const TUint32 KClockAppSoundFile = 0x00000000;
CRepository* iRepository = CRepository::NewL(KCRUidClockApp);
CleanupStack::PushL(iRepository);
ret = iRepository->Set(KClockAppSoundFile, aPath);
CleanupStack::PopAndDestroy();
}
if (ret == KErrNone)
{
return TRUE;
}
else
{
return FALSE;
}
}
//=============================================================================
//获取闹钟铃声
TFileName CRingManager::GetClockRing()
{
TFileName toneFile;
const TUid KCRUidClockApp =
{
0x101F874D
};
const TUint32 KClockAppSoundFile = 0x00000000;
CRepository* iRepository = CRepository::NewL(KCRUidClockApp);
CleanupStack::PushL(iRepository);
iRepository->Get(KClockAppSoundFile,toneFile);
CleanupStack::PopAndDestroy();
return toneFile;
}
//=============================================================================
更多精彩
赞助商链接