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

📄 toptenview.cpp

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

// INCLUDES

//  Class include
#include "TopTenView.h"

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

// User includes
#include "CallInfo.h"            // TCallInfo
#include "CallSummary.hrh"        // TCallSummaryViewNumber
#include "PhoneBookEngine.h"    // CPhoneBookEngine
#include "TopTenContainer.h"    // CTopTenContainer

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

/** 
* Destructor.
*/
CTopTenView::~CTopTenView()
{
}

/**
* Symbian OS 2 phase constructor.
* Constructs the CTopTenView 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 CTopTenView
*/
CTopTenView* CTopTenView::NewL(TInt aDirectionId, TUid aUid, CPhoneBookEngine& aPhoneBookEngine)
{
    CTopTenView* self = CTopTenView::NewLC(aDirectionId,aUid, aPhoneBookEngine);
    CleanupStack::Pop(self);
    return self;
}

/**
* Symbian OS 2 phase constructor.
* Constructs the CTopTenView 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 CTopTenView
*/
CTopTenView* CTopTenView::NewLC(TInt aDirectionId, TUid aUid, CPhoneBookEngine& aPhoneBookEngine)
{
    CTopTenView* self = new (ELeave) CTopTenView(aPhoneBookEngine);
    CleanupStack::PushL(self);
    self->ConstructL(aDirectionId, aUid);
    return self;
}

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


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

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

/**
* From CEikAppUi, takes care of command handling for this view.
*
* @param aCommand command to be handled
*/
void CTopTenView::HandleCommandL(TInt aCommand)
{
    switch (aCommand)
    {
        case ECallSummaryMakeSpeedDial:
        {
            TBool updateList = EFalse;

            // Get the selected item.
            TContactItemId contactId;
            if (iContainer->GetListBoxSelectionContact(contactId))    // If we have a selection...
            {
                if (contactId == -1)    // ...Without a valid contact ID...
                {
                    // No contact for this entry.
                    TCallInfo callInfo;
                    if (iContainer->GetListBoxSelectionCallInfo(callInfo))    // If we can get the call info...
                    {
                        // Create a new contact.
                        contactId = iPhoneBookEngine.AddContactEntryL(callInfo);

                        // Update the call info array.
                        iContainer->SetListBoxSelectionCallInfo(callInfo);
                            
                        updateList = ETrue;
                    }
                }
                // Get telephone number
                TBuf<KMaxTelephoneNumber> telNumber;
                iContainer->GetSelectionNumber(telNumber);
                iPhoneBookEngine.AssignSpeedDialDialogL(contactId, telNumber);
                
                if (updateList)
                {
                    // Force the list to update as the call info has changed.
                    iContainer->CallArrayCreatedL();
                }
            }
            break;
        }
        default:
        {
            AppUi()->HandleCommandL(aCommand);
        }
    }
}

/**
* Updates Phonebook add to speed dial menu items. Called by the framework
* DynInitMenuPaneL. 
*
* @param aResourceId   resource id of the menu pane 
* @param aMenuPane     menu pane 
*/
void CTopTenView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
    if (aResourceId == R_TOPTEN_MENU_PANE)
    {
        if (!iContainer->ShowSpeedDialMenuL())
        {
            aMenuPane->SetItemDimmed(ECallSummaryMakeSpeedDial, ETrue);
        }
    }
}

// End of File

⌨️ 快捷键说明

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