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

📄 phonebkexview.cpp

📁 基于Symbian OS
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CPhoneBkExView from PhoneBkExView.h
*  Part of  : PhoneBkEx
*  Created  : 13/06/2003 by 
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: Forum Nokia
* ============================================================================
*/


// INCLUDE FILES
#include  "PhoneBkExView.h"
#include  <aknviewappui.h>
#include  <aknquerydialog.h> 
#include <stringloader.h> // StringLoader
#include  <PhoneBkEx.rsg>
#include  "PhoneBkExContainer.h" 
#include  "PhoneBkExEngine.h"
#include  "PhoneBkEx.hrh"

const TInt KContactGroupNameLength = 15;
const TInt KJobString = 15;
// ================= MEMBER FUNCTIONS =======================

CPhoneBkExView::CPhoneBkExView(CPhoneBkExEngine& aEngine):iEngine(aEngine)
	{

	}


// ---------------------------------------------------------
// CPhoneBkExView::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CPhoneBkExView::ConstructL()
    {
    BaseConstructL( R_PHONEBKEX_VIEW1 );
    }

// ---------------------------------------------------------
// CPhoneBkExView::~CPhoneBkExView()
// ?implementation_description
// ---------------------------------------------------------
//
CPhoneBkExView::~CPhoneBkExView()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }

    delete iContainer;
    }

// ---------------------------------------------------------
// TUid CPhoneBkExView::Id()
// ?implementation_description
// ---------------------------------------------------------
//
TUid CPhoneBkExView::Id() const
    {
    return KViewId;
    }

// ---------------------------------------------------------
// CPhoneBkExView::HandleCommandL(TInt aCommand)
// ?implementation_description
// ---------------------------------------------------------
//
void CPhoneBkExView::HandleCommandL(TInt aCommand)
    {   
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
            {
            AppUi()->HandleCommandL(EEikCmdExit);
            break;
            }
		case EPhoneBkExCmdCreateContact:
			{
			iEngine.CreateNewContactL();
			break;
			}
        case EPhoneBkExCmdAppAddGroup:
			{
		    TBuf<KContactGroupNameLength> textData;

			CAknTextQueryDialog* dlg = new(ELeave)CAknTextQueryDialog(
            textData, CAknQueryDialog::ENoTone );
			TBool answer(dlg->ExecuteLD(R_CONTACTGROUP_DLG));

			if (answer)
				iEngine.CreateContactGroupAndAddContactsL(textData);

			break;
			}
		case EPhoneBkExCmdFindAsync:
			{
		    TBuf<KJobString> jobStr;

			CAknTextQueryDialog* dlg = new(ELeave)CAknTextQueryDialog(
            jobStr, CAknQueryDialog::ENoTone );
			TBool answer(dlg->ExecuteLD(R_FINDJOB_DLG));

			if (answer)
     			iEngine.FindContactsWithJobTypeAsyncL(jobStr);
			break;
			}

        case EPhoneBkExCmdImportVCard:
            {
            iEngine.ImportVCardL();
			break;
            }
		case EPhoneBkExCmdModifyJob:
			{
		    TBuf<KJobString> oldJob;
			// job to change
			CAknTextQueryDialog* dlg = new(ELeave)CAknTextQueryDialog(
            oldJob, CAknQueryDialog::ENoTone );
			HBufC* dlgText = StringLoader::LoadLC(R_OLDJOB_TEXT);

			dlg->SetPromptL(*dlgText);
			TBool answer(dlg->ExecuteLD(R_FINDJOB_DLG));
			CleanupStack::PopAndDestroy(dlgText);
			// new job title
			if (answer)
				{
				TBuf<KJobString> newJob;
				CAknTextQueryDialog* newDlg = new (ELeave) CAknTextQueryDialog(
					newJob, CAknQueryDialog::ENoTone);
				HBufC* dlgText = StringLoader::LoadLC(R_NEWJOB_TEXT);
				newDlg->SetPromptL(*dlgText);
				CleanupStack::PopAndDestroy(dlgText);

				answer = (newDlg->ExecuteLD(R_FINDJOB_DLG));
				if (answer)
					iEngine.ModifyJobDescriptionsL(oldJob, newJob);
				}
			break;

			}
		case EPhoneBkExCmdViewPhoneNumbers:
			{
			iEngine.DisplayPhoneNumbersL(this);
			break;
			}

        default:
            {
            AppUi()->HandleCommandL( aCommand );
            break;
            }
        }
    }

// ---------------------------------------------------------
// CPhoneBkExView::HandleClientRectChange()
// ---------------------------------------------------------
//
void CPhoneBkExView::HandleClientRectChange()
    {
    if ( iContainer )
        {
        iContainer->SetRect( ClientRect() );
        }
    }

// ---------------------------------------------------------
// CPhoneBkExView::DoActivateL(...)
// ?implementation_description
// ---------------------------------------------------------
//
void CPhoneBkExView::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
    {
    if (!iContainer)
        {
        iContainer = new (ELeave) CPhoneBkExContainer;
        iContainer->SetMopParent(this);
        iContainer->ConstructL( ClientRect() );
        AppUi()->AddToStackL( *this, iContainer );
        } 
   }

// ---------------------------------------------------------
// CPhoneBkExView::HandleCommandL(TInt aCommand)
// ?implementation_description
// ---------------------------------------------------------
//
void CPhoneBkExView::DoDeactivate()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }
    
    delete iContainer;
    iContainer = NULL;
    }

// End of File

⌨️ 快捷键说明

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