📄 filesystemoperator-h.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/edba/dist/qtopia/main-Sunday/qtopia/src/qtopiadesktop/common/filesystemoperator.h:1 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>filesystemoperator.h Include File</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td width="200" align="left" valign="top"><a href="index.html"><img height="27" width="472" src="dochead.png" border="0"></a><br><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qtopia</font> <a href="index.html">Home</a> - <a href="qtopiaclasses.html">Classes</a> - <a href="qtopiaannotated.html">Annotated</a> - <a href="qtopiafunctions.html">Functions</a> - <a href="qtindex.html">Qt Embedded</a></td><td align="right" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="137"> <tr> <td><a href="http://www.trolltech.com/company/about/trolls.html"><img height="100" width="100" src="face.png" border="0"></a></td> <td><img height="100" width="100" src="qtlogo.png" align="top" border="0"></td> </tr> </table></td></tr></table><h1 align=center>filesystemoperator.h</h1><p>This is the verbatim text of the filesystemoperator.h include file. It is provided only for illustration; the copyright remains with Trolltech.<hr><pre>/************************************************************************ Copyright (C) 2000-2002 Trolltech AS. All rights reserved.**** This file is part of the Qtopia Environment.**** Licensees holding valid Qtopia Developer license may use this** file in accordance with the Qtopia Developer License Agreement** provided with the Software.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR** PURPOSE.**** email sales@trolltech.com for information about Qtopia License** Agreements.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.************************************************************************/#ifndef QTOPIA_FILE_SYSTEM_OPERATOR_H#define QTOPIA_FILE_SYSTEM_OPERATOR_H#include <qurloperator.h>#include <qnetworkprotocol.h>#include <qguardedptr.h>#include <qtimer.h>#include <qptrlist.h>#include <qtopia/qpeglobal.h>#include "qpcwinexports.h"#include "doclnk.h"class FtpCommand;class QPC_EXPORT TransferReceipt : public QObject{ friend class FtpCommand; friend class FileSystemOperator; friend class QPtrList<TransferReceipt>; Q_OBJECTpublic: enum OperationType { Retrieve=0, Send, List, Remove, RSync }; OperationType operationType() const { return fOpType; } enum FileType { Setting=0, AppData, Documents, Other }; FileType fileType() const { return fFileType; } const QString &filename() const { return fFname; } const QString &name() const { return fName; } const QString &arg() const { return fArg; } bool succeeded() const; QNetworkProtocol::Error error() const { return fError; } bool op1Finished() const; bool op2Finished() const; int getTotalBytesTransferred();signals: /** Signals when the ftp operation has actually been called */ void operationCreated(TransferReceipt *thisPtr); void listing(const QValueList<QUrlInfo> &listing, TransferReceipt *thisPtr); void progress(int bytesDone, int bytesTotal, QNetworkOperation *op, TransferReceipt *thisPtr); void finished(TransferReceipt *thisPtr); void pdaMessage( const QString &call, const QByteArray &data );protected: bool match( QNetworkOperation *op ) const; bool finished() const; void finished( QNetworkOperation *op ); /** emit start signal */ void setOperation(QNetworkOperation *op); void setOperations(QNetworkOperation *op1, QNetworkOperation *op2); void notifyListing(const QValueList<QUrlInfo> &listing); void notifyProgress(int bytesDone, int bytesTotal, QNetworkOperation *op); void setError( QNetworkProtocol::Error e ); // This was added just as a workaround for transferring zero-byte files. void setOp2State(QNetworkProtocol::State newState) { fOp2State = newState; }private: void processed(); TransferReceipt(OperationType optype, FileType ftype, const QString &file, const QString &argParam); virtual ~TransferReceipt() { } OperationType fOpType; FileType fFileType; QString fFname; QString fName; QString fArg; QNetworkOperation *fOp1; QNetworkOperation *fOp2; QNetworkProtocol::State fOp1State; QNetworkProtocol::State fOp2State; QNetworkProtocol::Error fError; int mTotalBytesTransferred;};#define QPC_DEFINED_TRANSFERRECEIPT#include <private/ftpcommands_p.h>class Account;class CheckRemotePath;class RemoteDir;class QdDocLnk;class PalmtopConnection;class FileSystemOperatorPrivate;class QPC_EXPORT FileSystemOperator : public QUrlOperator{ friend class SendCommand; friend class RetrieveCommand; friend class ListCommand; friend class RemoveCommand; friend class RdiffRetrieve; friend class RdiffSend; friend class FtpCommand; Q_OBJECTpublic: FileSystemOperator( PalmtopConnection *con ); virtual ~FileSystemOperator(); static const QString &localCenterPath(); static QString localBackupPath() { return localCenterPath() + "Backup/"; } QString localDocsRoot() const; QString localDocsPath(const QString &mimetype) const; QString remoteSettingsPath() const { return fRemoteBasePath + "Settings/";} QString remoteDocsPath(const QString &mimeType) const; QString remoteAppPath(const QString &app) const; QString remoteDocsRoot() const; QString remoteAppRoot() const; QString remoteDocURI( const QString &remoteFileName ) const; enum ExtType { LocalBaseFile, LocalChangesFile, RemoteBaseFile, RemoteChangesFile}; /** LocalBaseFile = ~/.palmtopcenter/<app>/filename * LocalChangesFile = ~/.palmtopcenter/<pda id>/Applications/<app>/filename.local_changes * RemoteBaseFile = (dir same as above)/filename.remote_base * RemoteChangesFile = (dir same as above)/filename.remote_changes */ QString localAppFile( const QString &app, const QString &filename, ExtType type ) const; /** Same extentions as above */ QString localSettingsFile( const QString &filename, ExtType type = LocalChangesFile ) const; QString localAppPath(const QString &app, ExtType type=LocalChangesFile ) const; QString localSettingsPath( ExtType type=LocalChangesFile ) const; static bool ensureLocalPath(const QString &localPath); static QString stripPath(const QString &filePath); static QString fileBase(const QString &filePath); static QString dirPath(const QString &filePath); static QString tempPath(); static bool copyLocalFile(const QString &source, const QStringList &destFiles); QGuardedPtr<TransferReceipt> sendSetting(const QString &filename); QGuardedPtr<TransferReceipt> sendSetting(const QString &localFile, const QString &filename); QGuardedPtr<TransferReceipt> retrieveSetting(const QString &filename, uint size=100, bool remoteChangesFile=TRUE); QGuardedPtr<TransferReceipt> removeSetting(const QString &filename); QGuardedPtr<TransferReceipt> listSettings(); // when calling this method, make sure the Remote Changes file is the // same as the remote file so rdiff will work correctly; uses // the RemoteBaseFile if exists, or the LocalChangesFile if not QGuardedPtr<TransferReceipt> sendAppData(const QString &app, const QString &filename); QGuardedPtr<TransferReceipt> sendAppData(const QString &app, const QString &localFilePath, const QString &remoteFilename); QGuardedPtr<TransferReceipt> retrieveAppData(const QString &app, const QString &filename, uint size=100, bool remoteChangesFile=TRUE); QGuardedPtr<TransferReceipt> listAppData(const QString &app); QGuardedPtr<TransferReceipt> removeAppData(const QString &app, const QString &filename); /** Sends the lnk file and the file itself; return both receipts */ TransferReceipt *sendDocument(const QdDocLnk &lnk, bool link); QPtrList<TransferReceipt> removeDocument(QdDocLnk &lnk); /** /a size is needed for progress bar information only * If /a destDir is null, then it downloads to the mirrored directory */ TransferReceipt *retrieveDocument( const QString &docRoot, const QString &filename, const QString &mimetype, uint size=1024, QString destDir=QString::null); /** /a mimetype can be the full mime type (i.e. text/plain) or just * the mime group (i.e. text) */ QGuardedPtr<TransferReceipt> listDocuments(const QString &docRoot, const QString &mimetype); TransferReceipt *removeDocument(const QString &docRoot, const QString &filename, const QString &mimetype); QGuardedPtr<TransferReceipt> listDocumentRoot(); QGuardedPtr<TransferReceipt> list(const QString &path); QGuardedPtr<TransferReceipt> sendOther( const QString &localFile, const QString &remoteFile ); QGuardedPtr<TransferReceipt> retrieveOther( const QString &remoteFile, const QString &localFile, uint size=1024 ); QGuardedPtr<TransferReceipt> removeOther( const QString& path, const QString& fileName ); /** Clears all processing and waiting commands */ virtual void stop(); bool isExecuting() const { return (processingQueue.count() > 0); } // Would like to change the qcop call so you can specify the files // to clean up so this method is not necessary but can be done // whenever an rsync command is done void rdiffCleanup();signals: void pdaVersionReceived(int major, int minor, const QString&); void handshakeDone( bool locked ); void start(int totalNumBytes); void newTotalBytes(int newTotal); void progressUpdate( int numBytesDone, int totalNumBytes, TransferReceipt *receipt ); void progress(int bytesDone); void done(int totalNumBytes); void executing(TransferReceipt *r); void errorExecuting(TransferReceipt *r); void successExecuting(TransferReceipt *r); void pdaMessage( const QString &call, const QByteArray &params );public slots: void setConnectionEnabled(bool v); void setConnected() { setConnectionEnabled(true); } void setDisconnected() { setConnectionEnabled(false); }private slots: void opFinished(QNetworkOperation *op); void setFtpConnectionState(int state, const QString &desc); void listing(const QValueList<QUrlInfo> &children, QNetworkOperation *op); void progress(int bytesDone, int bytesTotal, QNetworkOperation *op); void processNext(); void pdaHomeDir( const QString &call, const QByteArray &data ); void pdaVersion( const QString &call, const QByteArray &data );private: enum Priority{ Fifo=0, Enqueue, ProcessNext }; void schedule(FtpCommand *cmd, Priority p=Fifo); void startProcess(); void process(FtpCommand *cmd); void processed(FtpCommand *cmd); void setProgress(uint bytesDone, uint totalBytes, FtpCommand *cmd); void initConnection(); QString appPath(const QString &app) const; QString settingsPath() const { return QString("Settings/"); } static const QString &remoteTempPath() { return fRemoteTempPath; } QString docsPath(const QString &docRoot, const QString &mimeType) const; QGuardedPtr<TransferReceipt> send(const QString &localFile, const QString &remoteFile, TransferReceipt::FileType type, const QString &arg, Priority priority = Fifo); QGuardedPtr<TransferReceipt> retrieve(const QString &remoteFile, const QString &localFile, TransferReceipt::FileType type, const QString &arg, uint size=1024); QGuardedPtr<TransferReceipt> remove(QString path, const QString &file, TransferReceipt::FileType type, const QString &arg); QGuardedPtr<TransferReceipt> list(QString path, TransferReceipt::FileType type, const QString &arg, QString filter="*", Priority priority = Fifo); QGuardedPtr<TransferReceipt> list(const QString &absFilePath, TransferReceipt::FileType type); bool isConnectionEnabled() const { return fConnectionEnabled; } const QString &ftpLogin() const { return fFtpLogin; } const QString &localPdaPath() const { return fLocalPdaPath; } const QString &remoteBasePath() const { return fRemoteBasePath; } void setNormalTimeout(); static QString extStr( ExtType t ); static ExtType extType( bool remoteChangesFile ); // convienve method for the above method static QString extStr( bool remoteChangesFile ){ return extStr( extType(remoteChangesFile) ); } static const QString RDIFF_SIG_EXT; static const QString RDIFF_DIFF_EXT; PalmtopConnection *qcopCon() { return mQcopConn; } QString fFtpLogin; static QString fLocalCenterPath; QString fLocalPdaPath; QString fRemoteBasePath; static QString fTempPath; static QString fRemoteTempPath; bool fConnectionEnabled; QPtrList< FtpCommand > waitQueue; QPtrList< FtpCommand > processingQueue; uint totalTransferBytes; uint bytesDone; PalmtopConnection *mQcopConn; bool mInOpFinished; bool mSetLongTimeout; FileSystemOperatorPrivate *d;};#endif</pre><!-- eof --><p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright © 2001-2004 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align="right"><div align="right">Qtopia version 2.0.0</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -