📄 ftpexamplecontainer.h
字号:
/*
* ============================================================================
* Name : CFtpExampleContainer from FtpExampleContainer.h
* Part of : FtpExample
* Created : 03/11/2005 by Forum Nokia
* Version : 1.0
* Copyright: Nokia Corporation
* ============================================================================
*/
#ifndef FTPEXAMPLECONTAINER_H
#define FTPEXAMPLECONTAINER_H
// INCLUDE FILES
#include <coecntrl.h> // CCoeControl
#include <ftpsess.h> // MFtpSessionNotifier
#include "FtpExampleDocument.h"
// FORWARD DECLARATIONS
class CEikRichTextEditor;
class CFtpExampleAppUi;
// CONSTANTS
const TInt KDirBuffer = 50;
// CLASS DECLARATION
/**
* A container class that responds to FTP notifications and
* shows them to user.
*/
class CFtpExampleContainer : public CCoeControl,
public MFtpSessionNotifier
{
public: // Constructors and destructor
/**
* Two-phased constructor.
*/
static CFtpExampleContainer* NewL(const TRect& aRect, CFtpExampleAppUi& aAppUi);
/**
* Destructor.
*/
virtual ~CFtpExampleContainer();
public: // New functions
/**
* Creates a connections to an FTP server or if a connection already exists, it is
* disconnected.
*/
void ConnectL();
/**
* Implements the pwd command in FTP. Gets the client's current directory on the
* remote file system.
*/
void PwdL();
/**
* Implements the dir command in FTP. Lists the files in a directory on the remote
* file system.
*/
void DirL();
/**
* Implements the cd command in FTP. Sets the current directory on the remote file system.
*/
void CdL();
/**
* Implements the mkdir command in FTP. Creates a directory on the remote file system.
*/
void MkdirL();
/**
* Implements the rmdir command in FTP. Deletes a directory on the remote file system.
*/
void RmdirL();
/**
* Implements the rename command in FTP. Renames a file on the remote file system.
*/
void RenameL();
/**
* Implements the delete command in FTP. Deletes a file on the remote file system.
*/
void DeleteL();
/**
* Implements the get command in FTP. Transfers a file from the FTP server.
* @param aBinary If true, the representation type of the transferred file is binary, otherwise ascii.
*/
void GetL(const TBool& aBinary);
/**
* Implements the put command in FTP. Transfers a file to the FTP server.
* @param aBinary If true, the representation type of the transferred file is binary, otherwise ascii.
*/
void PutL(const TBool& aBinary);
/**
* Returns the connection state.
* @return ETrue if connection is active, EFalse if not.
*/
TBool Connected() const;
private:
/**
* Symbian OS Default constructor.
*/
CFtpExampleContainer(CFtpExampleAppUi& aAppUi);
void ConstructL(const TRect& aRect);
private: // New functions
/**
* Writes the given text to the richtext editor.
* @param aMessage The message that is written to the editor.
* @param aCarriageReturn If true, a carriage return is added before and after the message.
*/
void SetTextL(const TDesC& aMessage, const TBool& aCarriageReturn = EFalse);
/**
* Writes the given text to the richtext editor.
* @param aMessage The message that is written to the editor.
*/
void SetTextL(const TDesC8& aMessage);
/**
* Adds a carriage return to the richtext editor.
*/
void AddCarriageReturnL();
/**
* Sets the current connection state to given value.
* @param aConnected Defines whether the connection is active or not.
*/
void SetConnected(const TBool& aConnected);
/**
* Queries a text from user.
* @param aPrompt Prompt to be displayed to user.
* @param aQueryResult The user input text.
* @return True if user selected OK, false is user selected Cancel.
*/
TBool DoQueryL(const TDesC& aPrompt, TDes& aQueryResult);
enum TActionStatus
{
ENoAction = 0,
EConnecting,
EDir
};
private: // Functions from base classes
/**
* From CoeControl,SizeChanged.
*/
void SizeChanged();
/**
* From CoeControl,CountComponentControls.
*/
TInt CountComponentControls() const;
/**
* From CCoeControl,ComponentControl.
*/
CCoeControl* ComponentControl(TInt aIndex) const;
/**
* From CCoeControl,Draw.
*/
void Draw(const TRect& aRect) const;
/**
* From CCoeControl,OfferKeyEventL.
*/
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType );
/**
* From MFtpSessionNotifier. Normal operation completion.
*/
void Complete();
/**
* From MFtpSessionNotifier. Operation partially completed, with more data to follow.
*/
void MoreData();
/**
* From MFtpSessionNotifier. Reports the amount of data already transferred in bytes.
* @param aProgress Amount of data already transferred.
*/
void TransferProgress(TUint aProgress);
/**
* From MFtpSessionNotifier. User cancelled an on-going operation.
*/
void Cancel();
/**
* From MFtpSessionNotifier. Peer reset the connection.
*/
void ConnReset();
/**
* From MFtpSessionNotifier. Error in establishing the connection with the FTP server.
* @param aTConnectionError Operation completion code.
*/
void ConnectionError(TOpComp aTConnectionError);
/**
* From MFtpSessionNotifier. Restart operation not supported.
*/
void OperationNotSupported();
/**
* From MFtpSessionNotifier. Error with the local file system.
* @param aTLocalFileSystemError Operation completion code.
*/
void LocalFileSystemError(TOpComp aTLocalFileSystemError);
/**
* From MFtpSessionNotifier. Error with the remote file system.
* @param aTRemoteFileSystemError Operation completion code.
*/
void RemoteFileSystemError(TOpComp aTRemoteFileSystemError);
/**
* From MFtpSessionNotifier. Unspecified error.
*/
void EUnknownError();
/**
* From MFtpSessionNotifier. Message sent by the FTP server.
* @param aMessage The message sent by the server.
*/
void ServerMessage(const TDesC8& aMessage);
private: // Data members
CEikRichTextEditor* iEditor;
CFtpExampleAppUi& iAppUi;
TActionStatus iAction;
TBool iConnection;
TBuf8<KDirBuffer> iDirBuffer;
};
#endif
// End of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -