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

📄 deletefilesappui.cpp

📁 自己写的一个删除文件的源代码
💻 CPP
字号:
/*
============================================================================
 Name        : DeleteFilesAppUi.cpp
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Main application UI class (controller)
============================================================================
*/

// INCLUDE FILES
#include <avkon.hrh>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <DeleteFiles.rsg>
#include "DeleteFiles.hrh"
#include <f32file.h>
#include <s32file.h>

#include <eikmenup.h>

#include "DeleteFiles.pan"
#include "DeleteFilesAppUi.h"
#include "DeleteFilesAppView.h"
#include "DeleteFiles.hrh"

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


// -----------------------------------------------------------------------------
// CDeleteFilesAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CDeleteFilesAppUi::ConstructL()
    {
    // Initialise app UI with standard value.
    BaseConstructL();

	iGetAndDelete = CGetAndDelete::NewL( ClientRect() );
    // Create view object
    iAppView = CDeleteFilesAppView::NewL( ClientRect() );
    }
// -----------------------------------------------------------------------------
// CDeleteFilesAppUi::CDeleteFilesAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CDeleteFilesAppUi::CDeleteFilesAppUi()
    {
    // No implementation required
    }

// -----------------------------------------------------------------------------
// CDeleteFilesAppUi::~CDeleteFilesAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CDeleteFilesAppUi::~CDeleteFilesAppUi()
    {
    if ( iAppView )
        {
        delete iAppView;
        iAppView = NULL;
        }
	if ( iGetAndDelete )
		{
        delete iGetAndDelete;
        iGetAndDelete = NULL;
        }

    }

// -----------------------------------------------------------------------------
// CDeleteFilesAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CDeleteFilesAppUi::HandleCommandL( TInt aCommand )
    {
	TBuf<16> text;

    switch( aCommand )
        {
        case EEikCmdExit:
        case EAknSoftkeyExit:
            Exit();
            break;
        case EDeleteFilesCommand1:
            {
            // Load a string from the resource file and display it
            HBufC* textResource = StringLoader::LoadLC( R_HEWB_COMMAND1_TEXT );
            
            // Show the information Note with
            // textResource loaded with StringLoader.
            CAknInformationNote* informationNote = new ( ELeave ) CAknInformationNote;
            informationNote->ExecuteLD( *textResource );

            // Pop HBuf from CleanUpStack and Destroy it.
            CleanupStack::PopAndDestroy( textResource );
            }
            break;
		case EDeleteFilesCommand3:
            {
			iGetAndDelete->ShowDataQueryL(
                  R_DELETE_DATA_QUERY, 
				  0,
                  128, 
                  text );
			if ( text.Length()>0 ){
				iGetAndDelete->DeleteExtendFile( text );
			}
			}
			break;
		case EDeleteFilesCommand4:
            {
			iGetAndDelete->ShowDataQueryL(
                  R_DELETE_FILEDATA_QUERY, 
				  0,
                  128,
                  text );
			if ( text.Length()>0 ){
				iGetAndDelete->DeleteFile( text );
			}
			}
			break;
        default:
            Panic( EDeleteFilesUi );
            break;
		}
		text.Zero();
    }
// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
void CDeleteFilesAppUi::HandleStatusPaneSizeChange()
{
	iAppView->SetRect( ClientRect() );
} 

// End of File

⌨️ 快捷键说明

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