ansphonecalllog.cpp

来自「s60 接打电话代码,很有学习价值的,可以移植到不同平台」· C++ 代码 · 共 71 行

CPP
71
字号
/**
*
* @brief Definition of CAnsPhoneCallLog
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

#include "AnsPhoneCallLog.h"

#include <eikenv.h>

CAnsPhoneCallLog::CAnsPhoneCallLog(MAnsPhoneCallLogObserver& aObserver)
:CActive(EPriorityNormal),
 iObserver(aObserver)
	{
	}

CAnsPhoneCallLog::~CAnsPhoneCallLog()
	{
	Cancel();
	delete iRecentView;
	delete iSession;
	}

CAnsPhoneCallLog* CAnsPhoneCallLog::NewL(MAnsPhoneCallLogObserver& aObserver)
	{
	CAnsPhoneCallLog* self = new (ELeave) CAnsPhoneCallLog(aObserver);
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::Pop(self);
	return self;
	}

void CAnsPhoneCallLog::ConstructL()
	{
	CActiveScheduler::Add(this);

	iSession = CLogClient::NewL(CEikonEnv::Static()->FsSession());
	iRecentView = CLogViewRecent::NewL(*iSession);
	}

///////////////////////////////////////////////////////////////////////////////////////////////////////
// CActive
//
///////////////////////////////////////////////////////////////////////////////////////////////////////

void CAnsPhoneCallLog::RunL()
	{
	const CLogEvent& event = iRecentView->Event();
	iObserver.HandlePhoneNumberL(event.Number());
	}

void CAnsPhoneCallLog::DoCancel()
	{
	iRecentView->Cancel();
	}


void CAnsPhoneCallLog::GetNumberL()
// queues a request to get the most recent event
	{
	if(iRecentView->IsActive())
		iRecentView->Cancel();

	if (iRecentView->SetRecentListL(KLogNullRecentList, iStatus))
    	SetActive();
	}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?