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

📄 listappui.cpp

📁 《基于symbian手机开发与应用》一书的源代码
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CListAppUi from ListAppUi.cpp
*  Part of  : List
*  Created  : 2006-4-15 by LiuLiping
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include "ListAppUi.h"
#include "ListContainer.h" 
#include <List.rsg>
#include "list.hrh"

#include <avkon.hrh>
#include <aknlistquerydialog.h> //CAknListQueryDialog 
#include <aknnotedialog.h>		//CAknNoteDialog 
#include <aknnotewrappers.h>	//CAknInformationNote  
#include <stringloader.h>	//StringLoader



// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CListAppUi::ConstructL()
// 
// ----------------------------------------------------------
//
void CListAppUi::ConstructL()
    {
    BaseConstructL();

    iAppContainer = new (ELeave) CListContainer;
    iAppContainer->SetMopParent( this );
    iAppContainer->ConstructL( ClientRect() );
    AddToStackL( iAppContainer );
    }

// ----------------------------------------------------
// CListAppUi::~CListAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CListAppUi::~CListAppUi()
    {
    if (iAppContainer)
        {
        RemoveFromStack( iAppContainer );
        delete iAppContainer;
        }
   }

// ------------------------------------------------------------------------------
// CListAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
//  This function is called by the EIKON framework just before it displays
//  a menu pane. Its default implementation is empty, and by overriding it,
//  the application can set the state of menu items dynamically according
//  to the state of application data.
// ------------------------------------------------------------------------------
//
void CListAppUi::DynInitMenuPaneL(
    TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
    {
    }

// ----------------------------------------------------
// CListAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse CListAppUi::HandleKeyEventL(
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    {
    return EKeyWasNotConsumed;
    }

// ----------------------------------------------------
// CListAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CListAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
        case EEikCmdExit:
            {
            Exit();
            break;
            }
        case EListDialog:
            {
			TInt Index(0);												
	        CAknListQueryDialog* listquery=new(ELeave)CAknListQueryDialog(&Index);																		//(2)
	        listquery->PrepareLC(R_LIST_DIALOG);					
	        listquery->SetItemTextArray(iAppContainer->GetListDialogItemL());	
	        listquery->SetOwnershipType(ELbmDoesNotOwnItemArray);
			
	        if(listquery->RunLD())
			{
				if(Index == 0)
				{
					HBufC* InfText;
					InfText = StringLoader::LoadLC(R_INF_TEXT);
					CAknInformationNote* inf=new(ELeave)CAknInformationNote();
					inf->ExecuteLD(*InfText);
					CleanupStack::PopAndDestroy(InfText);
					break;
				}
				if(Index == 1)
				{
					HBufC* warningText;
					warningText = StringLoader::LoadLC(R_WARNING_TEXT);
					CAknWarningNote* war = new (ELeave)CAknWarningNote();
					war->ExecuteLD(*warningText);
					CleanupStack::PopAndDestroy(warningText);
					break;
				}
				if(Index == 2)
				{
					TBuf<20> FileName;
					CAknTextQueryDialog* QueryDialog=CAknTextQueryDialog::NewL(FileName); 
					CleanupStack::PushL(QueryDialog);
					HBufC* prompt=StringLoader::LoadLC(R_TEXT_DIALOG_PROMPT);
					QueryDialog->SetPromptL(*prompt);
					CleanupStack::PopAndDestroy(prompt);
					CleanupStack::Pop(QueryDialog);
					if(QueryDialog->ExecuteLD(R_TEXT_DIALOG))		//(3)
					{
					}

					break;
				}   
			}
		}
        // TODO: Add Your command handling code here

        default:
            break;      
        }
    }

// End of File  

⌨️ 快捷键说明

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