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

📄 filelistappui.cpp

📁 Symbian中如何显示其系统文件列表的一个范例
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CFileListAppUi from FileListAppUi.cpp
*  Part of  : FileList
*  Created  : 04.11.2006 by Forum Nokia
*  Implementation notes:
*     Initial content was generated by Nokia Series 60 AppWizard.
*  Version  : 2.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

// INCLUDE FILES
#include "FileListAppUi.h"
#include "FileListContainer.h" 
#include <FileList.rsg>
#include "filelist.hrh"
#include <avkon.hrh>
#include <eikmenup.h>

#define KEnableSkinFlag 0x1000
#define KLayoutAwareFlag 0x08

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


// ----------------------------------------------------------
// CFileListAppUi::ConstructL()
// KEnableSkinFlag and KLayoutAwareFlag (passed to the constructor of
// the base class) are manual definitions for EAknEnableSkin and 
// ELayoutAwareAppFlag flags. 
// EAknEnableSkin is needed from S60 2nd Edition onwards to support skins. 
// ELayoutAwareAppFlag is only needed in S60 2nd Edition, Feature Pack 3; 
// if the flag is not defined, the application is run in 176x208 compatibility 
// mode in that release. By using the manual definitions it is possible 
// for an application built on an older SDK to show correctly on the GUI 
// of S60 2nd Edition devices (including 2nd Edition, Feature Pack 3). 
// This approach could be considered if there are no other reasons 
// to create different builds for different releases of S60 1st and 2nd Edition.
// ----------------------------------------------------------
//
void CFileListAppUi::ConstructL()
    {
    #ifdef __SERIES60_3X__
    BaseConstructL(EAknEnableSkin);
    #else
    BaseConstructL(KEnableSkinFlag | KLayoutAwareFlag); // Manual definitions for EAknEnableSkin and ELayoutAwareAppFlag flags.
    #endif
	
    iAppContainer = new (ELeave) CFileListContainer;
    iAppContainer->SetMopParent(this);
    iAppContainer->ConstructL( ClientRect() );
    AddToStackL( iAppContainer );
    }

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

// ------------------------------------------------------------------------------
// CFileListAppUi::::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 CFileListAppUi::DynInitMenuPaneL(
    TInt aResourceId,CEikMenuPane* aMenuPane)
    {
    	if (aResourceId == R_FILELIST_MENU)
    	{
    		if(iAppContainer->iAppEngine->IsDirListEmpty())
    		{
    		aMenuPane->SetItemDimmed(EFileListCmdAppTest1, ETrue);	
    		}
    	}
    }

// ----------------------------------------------------
// CFileListAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// Handles keyevents. In this application keyevents are 
// caught in CFileListContainer::OfferKeyEventL()
// ----------------------------------------------------
//
TKeyResponse CFileListAppUi::HandleKeyEventL(
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    {
    return EKeyWasNotConsumed;
    }

// ----------------------------------------------------
// CFileListAppUi::HandleCommandL(TInt aCommand)
// Handles menu commands
// ----------------------------------------------------
//
void CFileListAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
        case EEikCmdExit:
            {
            Exit();
            break;
            }
        case EFileListCmdAppTest1:
            {
            iAppContainer->SetFileListL(EFileListDirNoChange, EFileListToggle);
            break;
            }
        case EFileListCmdAppTest2:
            {
            iAppContainer->SetFileListL(EFileListSounds, EFileListSizeDateNoChange);
            break;
            }
        case EFileListCmdAppTest3:
            {
            iAppContainer->SetFileListL(EFileListPictures, EFileListSizeDateNoChange);
            break;
            }
        case EFileListCmdAppTest4:
            {
            iAppContainer->SetFileListL(EFileListVideos, EFileListSizeDateNoChange);
            break;
            }

        default:
            break;      
        }
    }

// ---------------------------------------------------------
// CFileListAppUi::HandleStatusPaneSizeChange()
// Called by framework when resource is changed.
// ---------------------------------------------------------
//
void CFileListAppUi::HandleStatusPaneSizeChange()
	{
	CAknAppUi::HandleStatusPaneSizeChange(); //call to upper class
	iAppContainer->SetRect( ClientRect());
	}

// End of File  

⌨️ 快捷键说明

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