⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callview.cpp

📁 series60 应用程序开发的源代码 series60 应用程序开发的源代码
💻 CPP
字号:
/**
* 
* @brief Definition of CCallView
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDES

//  Class include
#include "CallView.h"

// System includes
#include <aknviewappui.h>        // CAknViewAppUi
#include <CallSummary.rsg>        // R_INCOMING_VIEW
#include <eikmenup.h>            // CEikMenuPane

// User includes
#include "CallContainer.h"        // CIncomingContainer
#include "CallInfo.h"            // KMaxTelephoneNumber
#include "CallSummary.hrh"        // TCallSummaryViewNumber
#include "PhoneBookEngine.h"    // CPhoneBookEngine

// ================= MEMBER FUNCTIONS =======================

/** 
* Destructor.  
*/

CCallView::~CCallView()
{
    delete iContainer;
}

/**
* Symbian OS 2 phase constructor.
* Constructs the CCallView using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
* 
* @param aDirectionId what type of calls to filter from log i.e incoming
* @param aUid The Uid for this view
* @param  aPhoneBookEngine reference to the phonebook engine
* @return The newly constructed CCallView
*/
CCallView* CCallView::NewL(TInt aDirectionId, TUid aUid, CPhoneBookEngine& aPhoneBookEngine)
{
    CCallView* self = CCallView::NewLC(aDirectionId, aUid, aPhoneBookEngine);
    CleanupStack::Pop(self);
    return self;
}

/**
* Symbian OS 2 phase constructor.
* Constructs the CCallView using the constructor and ConstructL 
* method, leaving the constructed object on the CleanupStack before returning it.
* 
* @param aDirectionId what type of calls to filter from log i.e incoming
* @param aUid The Uid for this view
* @param  aPhoneBookEngine reference to the phonebook engine
* @return The newly constructed CCallView
*/
CCallView* CCallView::NewLC(TInt aDirectionId, TUid aUid, CPhoneBookEngine& aPhoneBookEngine)
{
    CCallView* self = new (ELeave) CCallView(aPhoneBookEngine);
    CleanupStack::PushL(self);
    self->ConstructL(aDirectionId, aUid);
    return self;
}

/**
* C++ constructor
* @param  aPhoneBookEngine reference to the phonebook engine
*/
CCallView::CCallView(CPhoneBookEngine& aPhoneBookEngine)
    :iPhoneBookEngine(aPhoneBookEngine)
{
}

/**
* Symbian OS 2nd phase constructor.  
* Uses the superclass constructor to construct the view using the 
* R_INCOMING_VIEW resource. It also constructs the callarray used in this view
* @param aDirectionId what type of calls to filter from log i.e incoming
* @param aUid The Uid for this view
*/ 
void CCallView::ConstructL(TInt aDirectionId, TUid aUid)
{
    BaseConstructL(R_CALL_VIEW);
    iDirectionId = aDirectionId;
    iId = aUid;
}

/**
* Called by the framework
* @return The Uid for this view
*/
TUid CCallView::Id() const
{
    return iId;
}

/**
* Called by the framework when the view is activated. Updates the call 
* array, Constructs the container if necessary, setting this view as its 
* MOP parent, and  adding it to the control stack.
*/
void CCallView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, 
                            TUid /*aCustomMessageId*/, 
                            const TDesC8& /*aCustomMessage*/)
{
    if (!iContainer)
    {
        iContainer = CCallContainer::NewL(ClientRect(), iDirectionId, iPhoneBookEngine);
        iContainer->SetMopParent(this);
        AppUi()->AddToStackL(*this, iContainer);
    }    
}

/**
* Called by the framework when the view is deactivated.  
* Removes the container from the control stack and deletes it.
*/
void CCallView::DoDeactivate()
{
    if (iContainer)
    {
        AppUi()->RemoveFromStack(iContainer);
        delete iContainer;
        iContainer = NULL;
    }
}

/**
* From CEikAppUi, takes care of command handling for this view.
*
* @param aCommand command to be handled
*/
void CCallView::HandleCommandL(TInt aCommand)
{
    if (iContainer->ShowContactMenu())    // If the contact menu is showing...
    {
        TBuf<KMaxTelephoneNumber> telephoneNumber;
        if (iContainer->GetSelectionNumber(telephoneNumber))    // ...And we have a selection number...
        {
            if (iPhoneBookEngine.HandlePhoneBookCommandL(aCommand, telephoneNumber))
            {
                // The command has been handled. Force the list to refresh.
                iContainer->CallArrayCreatedL();
                return;
            }
        }
    }

    // pass the command to appUi
    AppUi()->HandleCommandL(aCommand);
}

/**
* Updates Phonebook data save menu items. Called by the framework
* DynInitMenuPaneL. 
*
* @param aResourceId   resource id of the menu pane 
* @param aMenuPane     menu pane 
*/
void CCallView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
    if (iContainer->ShowContactMenu())
    {
        iPhoneBookEngine.DynInitMenuPaneL(aResourceId, aMenuPane);
    }
    else if (aResourceId == R_CALLVIEW_MENU_PANE)
    {
        aMenuPane->SetItemDimmed(ECallSummaryAddContactDB, ETrue);
    }
}


// End of File

⌨️ 快捷键说明

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