diff options
Diffstat (limited to 'src/network/qftp.cpp')
| -rw-r--r-- | src/network/qftp.cpp | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/src/network/qftp.cpp b/src/network/qftp.cpp index 7a23afbf6..5ac73a596 100644 --- a/src/network/qftp.cpp +++ b/src/network/qftp.cpp @@ -136,7 +136,7 @@ private slots: private: void clearData() { - is_ba = FALSE; + is_ba = false; data.dev = 0; } @@ -147,7 +147,7 @@ private: int bytesTotal; bool callWriteData; - // If is_ba is TRUE, ba is used; ba is never 0. + // If is_ba is true, ba is used; ba is never 0. // Otherwise dev is used; dev can be 0 or not. union { TQByteArray *ba; @@ -244,7 +244,7 @@ public: TQFtp::Command command; TQStringList rawCmds; - // If is_ba is TRUE, ba is used; ba is never 0. + // If is_ba is true, ba is used; ba is never 0. // Otherwise dev is used; dev can be 0 or not. union { TQByteArray *ba; @@ -258,21 +258,21 @@ public: int TQFtpCommand::idCounter = 0; TQFtpCommand::TQFtpCommand( TQFtp::Command cmd, TQStringList raw ) - : command(cmd), rawCmds(raw), is_ba(FALSE) + : command(cmd), rawCmds(raw), is_ba(false) { id = ++idCounter; data.dev = 0; } TQFtpCommand::TQFtpCommand( TQFtp::Command cmd, TQStringList raw, const TQByteArray &ba ) - : command(cmd), rawCmds(raw), is_ba(TRUE) + : command(cmd), rawCmds(raw), is_ba(true) { id = ++idCounter; data.ba = new TQByteArray( ba ); } TQFtpCommand::TQFtpCommand( TQFtp::Command cmd, TQStringList raw, TQIODevice *dev ) - : command(cmd), rawCmds(raw), is_ba(FALSE) + : command(cmd), rawCmds(raw), is_ba(false) { id = ++idCounter; data.dev = dev; @@ -293,7 +293,7 @@ TQFtpDTP::TQFtpDTP( TQFtpPI *p, TQObject *parent, const char *name ) : TQObject( parent, name ), socket( 0, "TQFtpDTP_socket" ), pi( p ), - callWriteData( FALSE ) + callWriteData( false ) { clearData(); @@ -311,13 +311,13 @@ TQFtpDTP::TQFtpDTP( TQFtpPI *p, TQObject *parent, const char *name ) : void TQFtpDTP::setData( TQByteArray *ba ) { - is_ba = TRUE; + is_ba = true; data.ba = ba; } void TQFtpDTP::setDevice( TQIODevice *dev ) { - is_ba = FALSE; + is_ba = false; data.dev = dev; } @@ -334,7 +334,7 @@ void TQFtpDTP::writeData() socket.close(); clearData(); } else if ( data.dev ) { - callWriteData = FALSE; + callWriteData = false; const int blockSize = 16*1024; char buf[blockSize]; while ( !data.dev->atEnd() && socket.bytesToWrite()==0 ) { @@ -352,7 +352,7 @@ void TQFtpDTP::writeData() socket.close(); clearData(); } else { - callWriteData = TRUE; + callWriteData = true; } } } @@ -377,7 +377,7 @@ void TQFtpDTP::abortConnection() #if defined(TQFTPDTP_DEBUG) tqDebug( "TQFtpDTP::abortConnection" ); #endif - callWriteData = FALSE; + callWriteData = false; clearData(); socket.clearPendingData(); @@ -389,7 +389,7 @@ bool TQFtpDTP::parseDir( const TQString &buffer, const TQString &userName, TQUrl TQStringList lst = TQStringList::split( " ", buffer ); if ( lst.count() < 9 ) - return FALSE; + return false; TQString tmp; @@ -397,19 +397,19 @@ bool TQFtpDTP::parseDir( const TQString &buffer, const TQString &userName, TQUrl tmp = lst[ 0 ]; if ( tmp[ 0 ] == TQChar( 'd' ) ) { - info->setDir( TRUE ); - info->setFile( FALSE ); - info->setSymLink( FALSE ); + info->setDir( true ); + info->setFile( false ); + info->setSymLink( false ); } else if ( tmp[ 0 ] == TQChar( '-' ) ) { - info->setDir( FALSE ); - info->setFile( TRUE ); - info->setSymLink( FALSE ); + info->setDir( false ); + info->setFile( true ); + info->setSymLink( false ); } else if ( tmp[ 0 ] == TQChar( 'l' ) ) { - info->setDir( TRUE ); // #### todo - info->setFile( FALSE ); - info->setSymLink( TRUE ); + info->setDir( true ); // #### todo + info->setFile( false ); + info->setSymLink( true ); } else { - return FALSE; + return false; } static int user = 0; @@ -510,7 +510,7 @@ bool TQFtpDTP::parseDir( const TQString &buffer, const TQString &userName, TQUrl n = n.stripWhiteSpace(); info->setName( n ); } - return TRUE; + return true; } void TQFtpDTP::socketConnected() @@ -629,13 +629,13 @@ void TQFtpDTP::socketBytesWritten( int bytes ) *********************************************************************/ TQFtpPI::TQFtpPI( TQObject *parent ) : TQObject( parent ), - rawCommand(FALSE), + rawCommand(false), dtp( this ), commandSocket( 0, "TQFtpPI_socket" ), state( Begin ), abortState( None ), currentCmd( TQString::null ), - waitForDtpToConnect( FALSE ), - waitForDtpToClose( FALSE ) + waitForDtpToConnect( false ), + waitForDtpToClose( false ) { connect( &commandSocket, TQ_SIGNAL(hostFound()), TQ_SLOT(hostFound()) ); @@ -665,22 +665,22 @@ void TQFtpPI::connectToHost( const TQString &host, TQ_UINT16 port ) are all done the finished() signal is emitted. When an error occurs, the error() signal is emitted. - If there are pending commands in the queue this functions returns FALSE and - the \a cmds are not added to the queue; otherwise it returns TRUE. + If there are pending commands in the queue this functions returns false and + the \a cmds are not added to the queue; otherwise it returns true. */ bool TQFtpPI::sendCommands( const TQStringList &cmds ) { if ( !pendingCommands.isEmpty() ) - return FALSE; + return false; if ( commandSocket.state()!=TQSocket::Connected || state!=Idle ) { emit error( TQFtp::NotConnected, TQFtp::tr( "Not connected" ) ); - return TRUE; // there are no pending commands + return true; // there are no pending commands } pendingCommands = cmds; startNextCmd(); - return TRUE; + return true; } void TQFtpPI::clearPendingCommands() @@ -801,7 +801,7 @@ void TQFtpPI::readyRead() /* Process a reply from the FTP server. - Returns TRUE if the reply was processed or FALSE if the reply has to be + Returns true if the reply was processed or false if the reply has to be processed at a later point. */ bool TQFtpPI::processReply() @@ -818,8 +818,8 @@ bool TQFtpPI::processReply() // connection is really closed to avoid short reads of the DTP if ( 100*replyCode[0]+10*replyCode[1]+replyCode[2] == 226 ) { if ( dtp.socketState() != TQSocket::Idle ) { - waitForDtpToClose = TRUE; - return FALSE; + waitForDtpToClose = true; + return false; } } @@ -829,7 +829,7 @@ bool TQFtpPI::processReply() break; case WaitForAbortToFinish: abortState = None; - return TRUE; + return true; default: break; } @@ -842,14 +842,14 @@ bool TQFtpPI::processReply() switch ( state ) { case Begin: if ( replyCode[0] == 1 ) { - return TRUE; + return true; } else if ( replyCode[0] == 2 ) { state = Idle; emit finished( TQFtp::tr( "Connected to host %1" ).arg( commandSocket.peerName() ) ); break; } // ### error handling - return TRUE; + return true; case Waiting: if ( replyCode[0]<0 || replyCode[0]>5 ) state = Failure; @@ -858,7 +858,7 @@ bool TQFtpPI::processReply() break; default: // ### spontaneous message - return TRUE; + return true; } #if defined(TQFTPPI_DEBUG) // tqDebug( "TQFtpPI state: %d [processReply() intermediate]", state ); @@ -868,7 +868,7 @@ bool TQFtpPI::processReply() int replyCodeInt = 100*replyCode[0] + 10*replyCode[1] + replyCode[2]; emit rawFtpReply( replyCodeInt, replyText ); if ( rawCommand ) { - rawCommand = FALSE; + rawCommand = false; } else if ( replyCodeInt == 227 ) { // 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2) // rfc959 does not define this response precisely, and gives @@ -885,7 +885,7 @@ bool TQFtpPI::processReply() TQStringList lst = addrPortPattern.capturedTexts(); TQString host = lst[1] + "." + lst[2] + "." + lst[3] + "." + lst[4]; TQ_UINT16 port = ( lst[5].toUInt() << 8 ) + lst[6].toUInt(); - waitForDtpToConnect = TRUE; + waitForDtpToConnect = true; dtp.connectToHost( host, port ); } } else if ( replyCodeInt == 230 ) { @@ -932,7 +932,7 @@ bool TQFtpPI::processReply() #if defined(TQFTPPI_DEBUG) // tqDebug( "TQFtpPI state: %d [processReply() end]", state ); #endif - return TRUE; + return true; } #ifndef TQT_NO_TEXTCODEC @@ -940,14 +940,14 @@ TQM_EXPORT_FTP TQTextCodec *tqt_ftp_filename_codec = 0; #endif /* - Starts next pending command. Returns FALSE if there are no pending commands, - otherwise it returns TRUE. + Starts next pending command. Returns false if there are no pending commands, + otherwise it returns true. */ bool TQFtpPI::startNextCmd() { if ( waitForDtpToConnect ) // don't process any new commands until we are connected - return TRUE; + return true; #if defined(TQFTPPI_DEBUG) if ( state != Idle ) @@ -956,7 +956,7 @@ bool TQFtpPI::startNextCmd() if ( pendingCommands.isEmpty() ) { currentCmd = TQString::null; emit finished( replyText ); - return FALSE; + return false; } currentCmd = pendingCommands.first(); pendingCommands.pop_front(); @@ -974,7 +974,7 @@ bool TQFtpPI::startNextCmd() { commandSocket.writeBlock( currentCmd.latin1(), currentCmd.length() ); } - return TRUE; + return true; } void TQFtpPI::dtpConnectState( int s ) @@ -988,11 +988,11 @@ void TQFtpPI::dtpConnectState( int s ) else return; } - waitForDtpToClose = FALSE; + waitForDtpToClose = false; readyRead(); return; case TQFtpDTP::CsConnected: - waitForDtpToConnect = FALSE; + waitForDtpToConnect = false; startNextCmd(); return; case TQFtpDTP::CsHostNotFound: @@ -1015,11 +1015,11 @@ class TQFtpPrivate { public: TQFtpPrivate() : - close_waitForStateChange(FALSE), + close_waitForStateChange(false), state( TQFtp::Unconnected ), error( TQFtp::NoError ), - npWaitForLoginDone( FALSE ) - { pending.setAutoDelete( TRUE ); } + npWaitForLoginDone( false ) + { pending.setAutoDelete( true ); } TQFtpPI pi; TQPtrList<TQFtpCommand> pending; @@ -1041,7 +1041,7 @@ static TQFtpPrivate* d( const TQFtp* foo ) { if ( !d_ptr ) { d_ptr = new TQPtrDict<TQFtpPrivate>; - d_ptr->setAutoDelete( TRUE ); + d_ptr->setAutoDelete( true ); tqAddPostRoutine( cleanup_d_ptr ); } TQFtpPrivate* ret = d_ptr->find( (void*)foo ); @@ -1160,14 +1160,14 @@ static void delete_d( const TQFtp* foo ) stateChanged( HostLookup ) stateChanged( Connecting ) stateChanged( Connected ) - finished( 1, FALSE ) + finished( 1, false ) start( 2 ) stateChanged( LoggedIn ) - finished( 2, FALSE ) + finished( 2, false ) start( 3 ) - finished( 3, FALSE ) + finished( 3, false ) start( 4 ) dataTransferProgress( 0, 3798 ) @@ -1175,14 +1175,14 @@ static void delete_d( const TQFtp* foo ) readyRead() dataTransferProgress( 3798, 3798 ) readyRead() - finished( 4, FALSE ) + finished( 4, false ) start( 5 ) stateChanged( Closing ) stateChanged( Unconnected ) - finished( 5, FALSE ) + finished( 5, false ) - done( FALSE ) + done( false ) \endcode The dataTransferProgress() signal in the above example is useful @@ -1201,12 +1201,12 @@ static void delete_d( const TQFtp* foo ) stateChanged( HostLookup ) stateChanged( Connecting ) stateChanged( Connected ) - finished( 1, FALSE ) + finished( 1, false ) start( 2 ) - finished( 2, TRUE ) + finished( 2, true ) - done( TRUE ) + done( true ) \endcode You can then get details about the error with the error() and @@ -1363,8 +1363,8 @@ void TQFtp::init() \fn void TQFtp::commandFinished( int id, bool error ) This signal is emitted when processing the command identified by - \a id has finished. \a error is TRUE if an error occurred during - the processing; otherwise \a error is FALSE. + \a id has finished. \a error is true if an error occurred during + the processing; otherwise \a error is false. \sa commandStarted() done() error() errorString() */ @@ -1374,8 +1374,8 @@ void TQFtp::init() This signal is emitted when the last pending command has finished; (it is emitted after the last command's commandFinished() signal). - \a error is TRUE if an error occurred during the processing; - otherwise \a error is FALSE. + \a error is true if an error occurred during the processing; + otherwise \a error is false. \sa commandFinished() error() errorString() */ @@ -1799,11 +1799,11 @@ TQByteArray TQFtp::readAll() commandFinished() signal has not been emitted), this function sends an \c ABORT command to the server. When the server replies that the command is aborted, the commandFinished() signal with the - \c error argument set to \c TRUE is emitted for the command. Due + \c error argument set to \c true is emitted for the command. Due to timing issues, it is possible that the command had already finished before the abort request reached the server, in which case, the commandFinished() signal is emitted with the \c error - argument set to \c FALSE. + argument set to \c false. For all other commands that are affected by the abort(), no signals are emitted. @@ -1815,7 +1815,7 @@ TQByteArray TQFtp::readAll() \warning Some FTP servers, for example the BSD FTP daemon (version 0.3), wrongly return a positive reply even when an abort has occurred. For these servers the commandFinished() signal has its - error flag set to \c FALSE, even though the command did not + error flag set to \c false, even though the command did not complete successfully. \sa clearPendingCommands() @@ -1882,8 +1882,8 @@ TQIODevice* TQFtp::currentDevice() const } /*! - Returns TRUE if there are any commands scheduled that have not yet - been executed; otherwise returns FALSE. + Returns true if there are any commands scheduled that have not yet + been executed; otherwise returns false. The command that is being executed is \e not considered as a scheduled command. @@ -1929,7 +1929,7 @@ TQFtp::State TQFtp::state() const /*! Returns the last error that occurred. This is useful to find out what when wrong when receiving a commandFinished() or a done() - signal with the \c error argument set to \c TRUE. + signal with the \c error argument set to \c true. If you start a new command, the error status is reset to \c NoError. */ @@ -1943,7 +1943,7 @@ TQFtp::Error TQFtp::error() const Returns a human-readable description of the last error that occurred. This is useful for presenting a error message to the user when receiving a commandFinished() or a done() signal with - the \c error argument set to \c TRUE. + the \c error argument set to \c true. The error string is often (but not always) the reply from the server, so it is not always possible to translate the string. If @@ -2024,15 +2024,15 @@ void TQFtp::piFinished( const TQString& ) // don't get the commandFinished() signal before the stateChanged() // signal. if ( d->state != TQFtp::Unconnected ) { - d->close_waitForStateChange = TRUE; + d->close_waitForStateChange = true; return; } } - emit commandFinished( c->id, FALSE ); + emit commandFinished( c->id, false ); d->pending.removeFirst(); if ( d->pending.isEmpty() ) { - emit done( FALSE ); + emit done( false ); } else { startNextCommand(); } @@ -2087,11 +2087,11 @@ void TQFtp::piError( int errorCode, const TQString &text ) d->pi.clearPendingCommands(); clearPendingCommands(); - emit commandFinished( c->id, TRUE ); + emit commandFinished( c->id, true ); d->pending.removeFirst(); if ( d->pending.isEmpty() ) - emit done( TRUE ); + emit done( true ); else startNextCommand(); } @@ -2102,7 +2102,7 @@ void TQFtp::piConnectState( int state ) d->state = (State)state; emit stateChanged( d->state ); if ( d->close_waitForStateChange ) { - d->close_waitForStateChange = FALSE; + d->close_waitForStateChange = false; piFinished( tr( "Connection closed" ) ); } } @@ -2111,7 +2111,7 @@ void TQFtp::piFtpReply( int code, const TQString &text ) { if ( currentCommand() == RawCommand ) { TQFtpPrivate *d = ::d( this ); - d->pi.rawCommand = TRUE; + d->pi.rawCommand = true; emit rawCommandReply( code, text ); } } @@ -2208,7 +2208,7 @@ bool TQFtp::checkConnection( TQNetworkOperation *op ) connect( this, TQ_SIGNAL(readyRead()), this, TQ_SLOT(npReadyRead()) ); - d->npWaitForLoginDone = TRUE; + d->npWaitForLoginDone = true; switch ( op->operation() ) { case OpGet: case OpPut: @@ -2227,8 +2227,8 @@ bool TQFtp::checkConnection( TQNetworkOperation *op ) } if ( state() == LoggedIn ) - return TRUE; - return FALSE; + return true; + return false; } /*! \reimp @@ -2251,7 +2251,7 @@ void TQFtp::parseDir( const TQString &buffer, TQUrlInfo &info ) void TQFtp::npListInfo( const TQUrlInfo & i ) { if ( url() ) { - TQRegExp filt( url()->nameFilter(), FALSE, TRUE ); + TQRegExp filt( url()->nameFilter(), false, true ); if ( i.isDir() || filt.search( i.name() ) != -1 ) { emit newChild( i, operationInProgress() ); } @@ -2264,7 +2264,7 @@ void TQFtp::npDone( bool err ) { TQFtpPrivate *d = ::d( this ); - bool emitFinishedSignal = FALSE; + bool emitFinishedSignal = false; TQNetworkOperation *op = operationInProgress(); if ( op ) { if ( err ) { @@ -2294,7 +2294,7 @@ void TQFtp::npDone( bool err ) break; } } - emitFinishedSignal = TRUE; + emitFinishedSignal = true; } else if ( !d->npWaitForLoginDone ) { switch ( op->operation() ) { case OpRemove: @@ -2303,7 +2303,7 @@ void TQFtp::npDone( bool err ) case OpMkDir: { TQUrlInfo inf( op->arg( 0 ), 0, "", "", 0, TQDateTime(), - TQDateTime(), TRUE, FALSE, FALSE, TRUE, TRUE, TRUE ); + TQDateTime(), true, false, false, true, true, true ); emit newChild( inf, op ); emit createdDirectory( inf, op ); } @@ -2315,10 +2315,10 @@ void TQFtp::npDone( bool err ) break; } op->setState( StDone ); - emitFinishedSignal = TRUE; + emitFinishedSignal = true; } } - d->npWaitForLoginDone = FALSE; + d->npWaitForLoginDone = false; if ( state() == Unconnected ) { disconnect( this, TQ_SIGNAL(listInfo(const TQUrlInfo&)), |
