/**
*
* @brief Definition of CCallContainer
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDES
// Class include
#include "CallContainer.h"
// System includes
#include <AknWaitDialog.h> // CAknWaitDialog
#include <aknlists.h> // CAknDoubleNumberStyleListBox
#include <CallSummary.rsg> // R_EMPTY_LIST_TEXT
#include <CPbkContactItem.h> // CPbkContactItem
// User includes
#include "CallArray.h" // CCallArray
#include "CallLogEngine.h" // CCallLogEngine
#include "PhoneBookEngine.h" // CPhoneBookEngine
// CONSTANTS
// ================= MEMBER FUNCTIONS =======================
/**
* Symbian OS 2 phase constructor.
* Constructs the CCallContainer using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @param aDirectionId what type of calls to filter from log i.e incoming
* @param aPhoneBookEngine reference to the phonebook engine
* @return The newly constructed CCallContainer
*/
CCallContainer* CCallContainer::NewL(const TRect& aRect, TInt aDirectionId, CPhoneBookEngine& aPhoneBookEngine)
{
CCallContainer* self = CCallContainer::NewLC(aRect, aDirectionId, aPhoneBookEngine);
CleanupStack::Pop(self);
return self;
}
/**
* Symbian OS 2 phase constructor.
* Constructs the CCallContainer using the constructor and ConstructL
* method, leaving the constructed object on the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @param aDirectionId what type of calls to filter from log i.e incoming
* @param aPhoneBookEngine reference to the phonebook engine
* @return The newly constructed CCallContainer
*/
CCallContainer* CCallContainer::NewLC(const TRect& aRect, TInt aDirectionId, CPhoneBookEngine& aPhoneBookEngine)
{
CCallContainer* self = new (ELeave) CCallContainer(aPhoneBookEngine);
CleanupStack::PushL(self);
self->ConstructL(aRect, aDirectionId);
return self;
}
/**
* C++ constructor
* @param aPhoneBookEngine reference to the phonebook engine
*/
CCallContainer::CCallContainer(CPhoneBookEngine& aPhoneBookEngine)
:iPhoneBookEngine(aPhoneBookEngine)
{
}
/**
* Symbian OS 2nd phase constructor. Creates a Window for the controls, which it contains.
* Constructs a label and adds it to the window, which it then activates.
* @param aRect The rectangle for this window
* @param aDirectionId what type of calls to filter from log i.e incoming
*/
void CCallContainer::ConstructL(const TRect& aRect, TInt aDirectionId)
{
CreateWindowL();
SetRect(aRect);
// Create the List Box
iListBox = new (ELeave) CAknDoubleStyleListBox();
iListBox->ConstructL(this, EAknListBoxSelectionList);
iListBox->SetContainerWindowL(*this);
iListBox->CreateScrollBarFrameL(ETrue);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
iListBox->SetRect(Rect());
// Show the empty list box text rather than the default "no data"
HBufC* emptyListText = iEikonEnv->AllocReadResourceLC(R_EMPTY_LIST_TEXT);
iListBox->View()->SetListEmptyTextL(*emptyListText);
CleanupStack::PopAndDestroy (emptyListText);
// Show busy dialog if required.
ShowBusyDialogL();
// Create log Engine
iCallArray = CCallArray::NewL(iPhoneBookEngine);
iCallLogEngine = CCallLogEngine::NewL(*this, *iCallArray, aDirectionId);
ActivateL();
}
/**
*
* Called by framework when the view size is changed.
* Resizes iListBox accordingly.
*
*/
void CCallContainer::SizeChanged()
{
if (iListBox)
{
iListBox->SetRect(Rect());
}
}
/**
* Called by the framework in compound controls
* @return The number of controls in this CCallContainer
*/
TInt CCallContainer::CountComponentControls() const
{
return 1;
}
/**
* Called by the framework in compound controls
* @param The index of the control to return
* @return The control for aIndex
*/
CCoeControl* CCallContainer::ComponentControl(TInt aIndex) const
{
if (aIndex != 0)
{
return NULL;
}
else
{
return iListBox;
}
}
/**
* Destructor.
*/
CCallContainer::~CCallContainer()
{
delete iListBox;
delete iCallArray;
delete iCallLogEngine;
CancelBusyDialog(); // deletes iBusyNote if it exists.
}
/**
* Called by the framework to draw this control. Clears the area in
* aRect.
* @param aRect in which to draw
*/
void CCallContainer::Draw(const TRect& aRect) const
{
CWindowGc& gc = SystemGc();
gc.Clear(aRect);
}
/**
* from MCallLogEngineObserver
* Called from CCallLogEngine, when call array
* has been populated with events from the log engine
*/
void CCallContainer::CallArrayCreatedL()
{
iCallArray->AnalysisCallLogArrayL(CCallArray::ESummation);
iCallArray->CreateListBoxDescriptorsL(CCallArray::ESummation);
SetListBoxArray();
// Cancel busy message
CancelBusyDialog();
}
/**
* from MCallLogEngineObserver
* Called from CCallLogEngine, when
* there are no events in the log engine to
* populate the call array
*/
void CCallContainer::CallArrayEmptyL()
{
// Cancel busy message
CancelBusyDialog();
}
/**
* from MCallLogEngineObserver
* Called from CCallLogEngine, if there has
* been an error making an asynchronous request
*/
void CCallContainer::CallLogErrorL()
{
// Cancel busy message
CancelBusyDialog();
}
/**
* This functions sets the data displayed in the list box
* to the array created by CCallLogEngine
*/
void CCallContainer::SetListBoxArray()
{
CTextListBoxModel* model = iListBox->Model();
// sets the model data
model->SetItemTextArray(iCallArray);
model->SetOwnershipType(ELbmDoesNotOwnItemArray);
iListBox->Reset();
DrawNow();
}
/**
* from CoeControl
* Called by framework to handle key-presses. Directs key up arrow and down arrow
* key presses to the list box.
* @param aKeyEvent the key event
* @param aType the type of key event: EEventKey, EEventKeyUp or EEventKeyDown
* @return indicates whether or not the key event was used by this control
*/
TKeyResponse CCallContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent, TEventCode aType)
{
TChar charCode(aKeyEvent.iCode);
switch (charCode) // The code of key event is...
{
// Switches tab
case EKeyLeftArrow: // Left key.
case EKeyRightArrow: // Right Key.
break;
default:
{
if (iListBox)
{
return iListBox->OfferKeyEventL(aKeyEvent, aType);
}
}
}
return EKeyWasNotConsumed;
}
/**
* Tests whether there is a currently selected listbox entry and if
* it doesn't have an associated contact in the contact database
* @return should we show the contact menu?
*/
TBool CCallContainer::ShowContactMenu() const
{
TInt index = iListBox->CurrentItemIndex();
if (index == -1)
{
return EFalse; // There is no selected entry.
}
// If the selected entry has a contact return EFalse.
return !(*iCallArray)[index].HasContact();
}
/**
* Tests whether the currently selected listbox entry
* has an associated speed dial entry.
* @return should we show the speed dial menu?
*/
TBool CCallContainer::ShowSpeedDialMenuL() const
{
// Get contact id of currently selected contact
TContactItemId contactId;
if (!GetListBoxSelectionContact(contactId))
{
return EFalse; // No selection; don't show menu.
}
if (contactId == -1)
{
return ETrue; // Selected item does not have an associated contact; show menu.
}
// Get a copy of the contact item using the contact id.
CPbkContactItem* contact = iPhoneBookEngine.ReadContactLC(contactId);
TInt numElements = (*contact).CardFields().Count();
for (TInt i = 0; i < numElements; i++)
{
if ((*contact).CardFields()[i].ItemField().IsSpeedDial())
{
CleanupStack::PopAndDestroy(contact);
return EFalse; // Speed dial already assigned
CallSummary
需积分: 6 53 浏览量
2009-03-02
16:10:04
上传
评论
收藏 62KB RAR 举报
likaifei1982
- 粉丝: 0
- 资源: 2
最新资源
- vscode-1.64.1.tar源码文件
- vscode-1.64.0.tar源码文件
- vscode-1.52.0.tar源码文件
- Music-Player +PlayerActivity+ rockplayer+ SeeJoPlayer 播放器JAVA源码
- vscode-1.46.0.tar源码文件
- 最近很火植物大战僵尸杂交版2.08苹果+安卓+PC+防闪退工具V2+修改工具+高清工具+通关存档整合包更新
- 超级好用的截图工具PixPin,可录制Gif图
- Screenshot_2024-05-21-17-06-42-64_2332cb9b27b851b548ba47a91682926c.jpg
- 毕业设计参考 - 基于树莓派、OpenCV及Python的人脸识别
- node-v18.20.2-linux-arm64
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈