|
|
|
@ -256,7 +256,7 @@ void DccTransferRecv::start() // public slot
|
|
|
|
|
kdDebug() << "DccTransferRecv::start() [END]" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DccTransferRecv::prepareLocalKio( bool overwrite, bool resume, KIO::fileoffset_t startPosition /* = 0 */ )
|
|
|
|
|
void DccTransferRecv::prepareLocalKio( bool overwrite, bool resume, TDEIO::fileoffset_t startPosition /* = 0 */ )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "DccTransferRecv::prepareLocalKio()" << endl
|
|
|
|
|
<< "DccTransferRecv::prepareLocalKio(): URL: " << m_fileURL << endl
|
|
|
|
@ -276,21 +276,21 @@ void DccTransferRecv::prepareLocalKio( bool overwrite, bool resume, KIO::fileoff
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KIO::TransferJob* transferJob = KIO::put( m_fileURL, -1, overwrite, m_resumed, false );
|
|
|
|
|
TDEIO::TransferJob* transferJob = TDEIO::put( m_fileURL, -1, overwrite, m_resumed, false );
|
|
|
|
|
|
|
|
|
|
if ( !transferJob )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "DccTransferRecv::prepareLocalKio(): KIO::put() returned NULL. what happened?" << endl;
|
|
|
|
|
kdDebug() << "DccTransferRecv::prepareLocalKio(): TDEIO::put() returned NULL. what happened?" << endl;
|
|
|
|
|
failed( i18n( "Could not create a KIO instance" ) );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connect( transferJob, TQT_SIGNAL( canResume( KIO::Job*, KIO::filesize_t ) ), this, TQT_SLOT( slotLocalCanResume( KIO::Job*, KIO::filesize_t ) ) );
|
|
|
|
|
connect( transferJob, TQT_SIGNAL( result( KIO::Job* ) ), this, TQT_SLOT( slotLocalGotResult( KIO::Job* ) ) );
|
|
|
|
|
connect( transferJob, TQT_SIGNAL( dataReq( KIO::Job*, TQByteArray& ) ), this, TQT_SLOT( slotLocalReady( KIO::Job* ) ) );
|
|
|
|
|
connect( transferJob, TQT_SIGNAL( canResume( TDEIO::Job*, TDEIO::filesize_t ) ), this, TQT_SLOT( slotLocalCanResume( TDEIO::Job*, TDEIO::filesize_t ) ) );
|
|
|
|
|
connect( transferJob, TQT_SIGNAL( result( TDEIO::Job* ) ), this, TQT_SLOT( slotLocalGotResult( TDEIO::Job* ) ) );
|
|
|
|
|
connect( transferJob, TQT_SIGNAL( dataReq( TDEIO::Job*, TQByteArray& ) ), this, TQT_SLOT( slotLocalReady( TDEIO::Job* ) ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DccTransferRecv::askAndPrepareLocalKio( const TQString& message, int enabledActions, DccResumeDialog::ReceiveAction defaultAction, KIO::fileoffset_t startPosition )
|
|
|
|
|
void DccTransferRecv::askAndPrepareLocalKio( const TQString& message, int enabledActions, DccResumeDialog::ReceiveAction defaultAction, TDEIO::fileoffset_t startPosition )
|
|
|
|
|
{
|
|
|
|
|
switch ( DccResumeDialog::ask( this, message, enabledActions, defaultAction ) )
|
|
|
|
|
{
|
|
|
|
@ -329,21 +329,21 @@ bool DccTransferRecv::createDirs( const KURL& dirURL ) const
|
|
|
|
|
|
|
|
|
|
TQStringList::ConstIterator it;
|
|
|
|
|
for ( it=dirList.begin() ; it!=dirList.end() ; ++it )
|
|
|
|
|
if ( !KIO::NetAccess::exists( *it, true, NULL ) )
|
|
|
|
|
if ( !KIO::NetAccess::mkdir( *it, NULL, -1 ) )
|
|
|
|
|
if ( !TDEIO::NetAccess::exists( *it, true, NULL ) )
|
|
|
|
|
if ( !TDEIO::NetAccess::mkdir( *it, NULL, -1 ) )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DccTransferRecv::slotLocalCanResume( KIO::Job* job, KIO::filesize_t size )
|
|
|
|
|
void DccTransferRecv::slotLocalCanResume( TDEIO::Job* job, TDEIO::filesize_t size )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "DccTransferRecv::slotLocalCanResume() [BEGIN]" << endl
|
|
|
|
|
<< "DccTransferRecv::slotLocalCanResume(): size: " << TQString::number( size ) << endl;
|
|
|
|
|
|
|
|
|
|
if ( size != 0 )
|
|
|
|
|
{
|
|
|
|
|
KIO::TransferJob* transferJob = static_cast<KIO::TransferJob*>( job );
|
|
|
|
|
TDEIO::TransferJob* transferJob = static_cast<TDEIO::TransferJob*>( job );
|
|
|
|
|
|
|
|
|
|
disconnect( transferJob, 0, 0, 0 );
|
|
|
|
|
transferJob->kill();
|
|
|
|
@ -376,11 +376,11 @@ void DccTransferRecv::slotLocalCanResume( KIO::Job* job, KIO::filesize_t size )
|
|
|
|
|
kdDebug() << "DccTransferRecv::slotLocalCanResume() [END]" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DccTransferRecv::slotLocalGotResult( KIO::Job* job )
|
|
|
|
|
void DccTransferRecv::slotLocalGotResult( TDEIO::Job* job )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "DccTransferRecv::slotLocalGotResult() [BEGIN]" << endl;
|
|
|
|
|
|
|
|
|
|
KIO::TransferJob* transferJob = static_cast<KIO::TransferJob*>( job );
|
|
|
|
|
TDEIO::TransferJob* transferJob = static_cast<TDEIO::TransferJob*>( job );
|
|
|
|
|
disconnect( transferJob, 0, 0, 0 );
|
|
|
|
|
|
|
|
|
|
switch ( transferJob->error() )
|
|
|
|
@ -389,7 +389,7 @@ void DccTransferRecv::slotLocalGotResult( KIO::Job* job )
|
|
|
|
|
kdDebug() << "DccTransferRecv::slotLocalGotResult(): job->error() returned 0." << endl
|
|
|
|
|
<< "DccTransferRecv::slotLocalGotResult(): Why was I called in spite of no error?" << endl;
|
|
|
|
|
break;
|
|
|
|
|
case KIO::ERR_FILE_ALREADY_EXIST:
|
|
|
|
|
case TDEIO::ERR_FILE_ALREADY_EXIST:
|
|
|
|
|
askAndPrepareLocalKio( i18n( "<b>The file already exists.</b><br>"
|
|
|
|
|
"%1<br>" )
|
|
|
|
|
.arg( m_fileURL.prettyURL() ),
|
|
|
|
@ -409,11 +409,11 @@ void DccTransferRecv::slotLocalGotResult( KIO::Job* job )
|
|
|
|
|
kdDebug() << "DccTransferRecv::slotLocalGotResult() [END]" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DccTransferRecv::slotLocalReady( KIO::Job* job )
|
|
|
|
|
void DccTransferRecv::slotLocalReady( TDEIO::Job* job )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "DccTransferRecv::slotLocalReady()" << endl;
|
|
|
|
|
|
|
|
|
|
KIO::TransferJob* transferJob = static_cast<KIO::TransferJob*>( job );
|
|
|
|
|
TDEIO::TransferJob* transferJob = static_cast<TDEIO::TransferJob*>( job );
|
|
|
|
|
|
|
|
|
|
disconnect( transferJob, 0, 0, 0 ); // WriteCacheHandler will control the job after this
|
|
|
|
|
|
|
|
|
@ -590,8 +590,8 @@ void DccTransferRecv::startReceiving()
|
|
|
|
|
// slot
|
|
|
|
|
void DccTransferRecv::connectionFailed( int errorCode )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "DccTransferRecv::connectionFailed(): code = " << errorCode << ", string = " << m_recvSocket->KSocketBase::errorString() << endl;
|
|
|
|
|
failed( i18n( "Connection failure: %1" ).arg( m_recvSocket->KSocketBase::errorString() ) );
|
|
|
|
|
kdDebug() << "DccTransferRecv::connectionFailed(): code = " << errorCode << ", string = " << m_recvSocket->TDESocketBase::errorString() << endl;
|
|
|
|
|
failed( i18n( "Connection failure: %1" ).arg( m_recvSocket->TDESocketBase::errorString() ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DccTransferRecv::readData() // slot
|
|
|
|
@ -611,11 +611,11 @@ void DccTransferRecv::readData() // slot
|
|
|
|
|
void DccTransferRecv::sendAck() // slot
|
|
|
|
|
{
|
|
|
|
|
//kdDebug() << "sendAck()" << endl;
|
|
|
|
|
KIO::fileoffset_t pos = intel( m_transferringPosition );
|
|
|
|
|
TDEIO::fileoffset_t pos = intel( m_transferringPosition );
|
|
|
|
|
|
|
|
|
|
m_recvSocket->enableWrite( false );
|
|
|
|
|
m_recvSocket->writeBlock( (char*)&pos, 4 );
|
|
|
|
|
if ( m_transferringPosition == (KIO::fileoffset_t)m_fileSize )
|
|
|
|
|
if ( m_transferringPosition == (TDEIO::fileoffset_t)m_fileSize )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "DccTransferRecv::sendAck(): Sent final ACK." << endl;
|
|
|
|
|
m_recvSocket->enableRead( false );
|
|
|
|
@ -623,7 +623,7 @@ void DccTransferRecv::sendAck() // slot
|
|
|
|
|
finishTransferLogger();
|
|
|
|
|
m_writeCacheHandler->close(); // WriteCacheHandler will send the signal done()
|
|
|
|
|
}
|
|
|
|
|
else if ( m_transferringPosition > (KIO::fileoffset_t)m_fileSize )
|
|
|
|
|
else if ( m_transferringPosition > (TDEIO::fileoffset_t)m_fileSize )
|
|
|
|
|
{
|
|
|
|
|
kdDebug() << "DccTransferRecv::sendAck(): the remote host sent larger data than expected: " << TQString::number( m_transferringPosition ) << endl;
|
|
|
|
|
failed( i18n( "Transferring error" ) );
|
|
|
|
@ -676,15 +676,15 @@ void DccTransferRecv::slotSocketClosed()
|
|
|
|
|
|
|
|
|
|
// WriteCacheHandler
|
|
|
|
|
|
|
|
|
|
DccTransferRecvWriteCacheHandler::DccTransferRecvWriteCacheHandler( KIO::TransferJob* transferJob )
|
|
|
|
|
DccTransferRecvWriteCacheHandler::DccTransferRecvWriteCacheHandler( TDEIO::TransferJob* transferJob )
|
|
|
|
|
: m_transferJob( transferJob )
|
|
|
|
|
{
|
|
|
|
|
m_writeReady = true;
|
|
|
|
|
m_cacheStream = 0;
|
|
|
|
|
|
|
|
|
|
connect( this, TQT_SIGNAL( dataFinished() ), m_transferJob, TQT_SLOT( slotFinished() ) );
|
|
|
|
|
connect( m_transferJob, TQT_SIGNAL( dataReq( KIO::Job*, TQByteArray& ) ), this, TQT_SLOT( slotKIODataReq( KIO::Job*, TQByteArray& ) ) );
|
|
|
|
|
connect( m_transferJob, TQT_SIGNAL( result( KIO::Job* ) ), this, TQT_SLOT( slotKIOResult( KIO::Job* ) ) );
|
|
|
|
|
connect( m_transferJob, TQT_SIGNAL( dataReq( TDEIO::Job*, TQByteArray& ) ), this, TQT_SLOT( slotKIODataReq( TDEIO::Job*, TQByteArray& ) ) );
|
|
|
|
|
connect( m_transferJob, TQT_SIGNAL( result( TDEIO::Job* ) ), this, TQT_SLOT( slotKIOResult( TDEIO::Job* ) ) );
|
|
|
|
|
|
|
|
|
|
m_transferJob->setAsyncDataEnabled( m_writeAsyncMode = true );
|
|
|
|
|
}
|
|
|
|
@ -755,7 +755,7 @@ void DccTransferRecvWriteCacheHandler::closeNow() // public
|
|
|
|
|
m_cacheStream = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DccTransferRecvWriteCacheHandler::slotKIODataReq( KIO::Job*, TQByteArray& data )
|
|
|
|
|
void DccTransferRecvWriteCacheHandler::slotKIODataReq( TDEIO::Job*, TQByteArray& data )
|
|
|
|
|
{
|
|
|
|
|
// We are in writeAsyncMode if there is more data to be read in from dcc
|
|
|
|
|
if ( m_writeAsyncMode )
|
|
|
|
@ -781,7 +781,7 @@ void DccTransferRecvWriteCacheHandler::slotKIODataReq( KIO::Job*, TQByteArray& d
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DccTransferRecvWriteCacheHandler::slotKIOResult( KIO::Job* job )
|
|
|
|
|
void DccTransferRecvWriteCacheHandler::slotKIOResult( TDEIO::Job* job )
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT( m_transferJob );
|
|
|
|
|
|
|
|
|
|