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

📄 filelistappui.cpp

📁 一个简单的资源管理器
💻 CPP
字号:
/*
 * Copyright (c) 2009 Nokia Corporation.
 */

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


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


// ----------------------------------------------------------
// CFileListAppUi::ConstructL()
// ----------------------------------------------------------
//
void CFileListAppUi::ConstructL()
    {
    #ifdef __SERIES60_30__
        BaseConstructL(EAknEnableSkin);
    #else
        BaseConstructL(EAknEnableSkin|EAknEnableMSK);
    #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 EAknSoftkeyExit:
        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;
            }
        case EAknSoftkeySelect:
            {
            iAppContainer->LaunchCurrentL();
            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 + -