|
|
|
@ -18,7 +18,7 @@
|
|
|
|
|
|
|
|
|
|
#include "tdeio_count.h"
|
|
|
|
|
|
|
|
|
|
#include "kio.h"
|
|
|
|
|
#include "tdeio.h"
|
|
|
|
|
#include "tdeio_proto.h"
|
|
|
|
|
#include "tdeio_single_subject.h"
|
|
|
|
|
#include "mailsubject.h"
|
|
|
|
@ -34,7 +34,7 @@
|
|
|
|
|
|
|
|
|
|
#include <tqstring.h>
|
|
|
|
|
|
|
|
|
|
KIO_Count::KIO_Count( TQObject * parent, const char * name )
|
|
|
|
|
TDEIO_Count::TDEIO_Count( TQObject * parent, const char * name )
|
|
|
|
|
: TQObject ( parent, name ),
|
|
|
|
|
_kurl( 0 ),
|
|
|
|
|
_metadata( 0 ),
|
|
|
|
@ -47,21 +47,21 @@ KIO_Count::KIO_Count( TQObject * parent, const char * name )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KIO_Count::~KIO_Count()
|
|
|
|
|
TDEIO_Count::~TDEIO_Count()
|
|
|
|
|
{
|
|
|
|
|
// Delete copies of urls.
|
|
|
|
|
delete _kurl;
|
|
|
|
|
delete _metadata;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KIO_Count::count( KKioDrop *drop )
|
|
|
|
|
void TDEIO_Count::count( KKioDrop *drop )
|
|
|
|
|
{
|
|
|
|
|
if( _new_mailurls )
|
|
|
|
|
return; //A counting is pending, so no new one is started.
|
|
|
|
|
|
|
|
|
|
delete _kurl;
|
|
|
|
|
delete _metadata;
|
|
|
|
|
_kio = drop;
|
|
|
|
|
_tdeio = drop;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Saving current settings: all actions are asynchroon, so if someone
|
|
|
|
@ -69,9 +69,9 @@ void KIO_Count::count( KKioDrop *drop )
|
|
|
|
|
* finished with counten. To be able to track back te staring values;
|
|
|
|
|
* these are saved in the class.
|
|
|
|
|
*/
|
|
|
|
|
_kurl = new KURL( *_kio->_kurl );
|
|
|
|
|
_metadata = new TDEIO::MetaData( *_kio->_metadata );
|
|
|
|
|
_protocol = _kio->_protocol;
|
|
|
|
|
_kurl = new KURL( *_tdeio->_kurl );
|
|
|
|
|
_metadata = new TDEIO::MetaData( *_tdeio->_metadata );
|
|
|
|
|
_protocol = _tdeio->_protocol;
|
|
|
|
|
|
|
|
|
|
KURL kurl = *_kurl;
|
|
|
|
|
TDEIO::MetaData metadata = *_metadata;
|
|
|
|
@ -82,22 +82,22 @@ void KIO_Count::count( KKioDrop *drop )
|
|
|
|
|
_protocol->recheckConnectKURL( kurl, metadata );
|
|
|
|
|
|
|
|
|
|
if( kurl.port() == 0 )
|
|
|
|
|
kurl.setPort( _protocol->defaultPort( _kio->_ssl ) );
|
|
|
|
|
kurl.setPort( _protocol->defaultPort( _tdeio->_ssl ) );
|
|
|
|
|
|
|
|
|
|
if( ! ( _slave = TDEIO::Scheduler::getConnectedSlave( kurl, metadata ) ) ) //Forcing reload
|
|
|
|
|
{
|
|
|
|
|
kdWarning() << i18n( "Not able to open a kio slave for %1." ).arg( _protocol->configName() ) << endl;
|
|
|
|
|
_kio->emitShowPassivePopup( i18n( "Not able to open a kio slave for %1." ).arg( _protocol->configName() ) );
|
|
|
|
|
kdWarning() << i18n( "Not able to open a tdeio slave for %1." ).arg( _protocol->configName() ) << endl;
|
|
|
|
|
_tdeio->emitShowPassivePopup( i18n( "Not able to open a tdeio slave for %1." ).arg( _protocol->configName() ) );
|
|
|
|
|
_valid = false;
|
|
|
|
|
_kio->emitValidChanged();
|
|
|
|
|
_tdeio->emitValidChanged();
|
|
|
|
|
_slave = 0;
|
|
|
|
|
//delete _new_mailurls; _new_mailurls = 0; //No connection pending
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connect( _slave, TQT_SIGNAL( error( int, const TQString& ) ), _kio, TQT_SLOT( slotConnectionError( int, const TQString& ) ) );
|
|
|
|
|
connect( _slave, TQT_SIGNAL( warning( const TQString& ) ), _kio, TQT_SLOT( slotConnectionWarning( const TQString& ) ) );
|
|
|
|
|
connect( _slave, TQT_SIGNAL( infoMessage( const TQString& ) ), _kio, TQT_SLOT( slotConnectionInfoMessage( const TQString& ) ) );
|
|
|
|
|
connect( _slave, TQT_SIGNAL( error( int, const TQString& ) ), _tdeio, TQT_SLOT( slotConnectionError( int, const TQString& ) ) );
|
|
|
|
|
connect( _slave, TQT_SIGNAL( warning( const TQString& ) ), _tdeio, TQT_SLOT( slotConnectionWarning( const TQString& ) ) );
|
|
|
|
|
connect( _slave, TQT_SIGNAL( infoMessage( const TQString& ) ), _tdeio, TQT_SLOT( slotConnectionInfoMessage( const TQString& ) ) );
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* _protocol->recheckConnectKURL could have change kurl and metadata in order to have the right
|
|
|
|
@ -118,7 +118,7 @@ void KIO_Count::count( KKioDrop *drop )
|
|
|
|
|
_protocol->recheckKURL( kurl, metadata );
|
|
|
|
|
|
|
|
|
|
if( kurl.port() == 0 )
|
|
|
|
|
kurl.setPort( _protocol->defaultPort( _kio->_ssl ) );
|
|
|
|
|
kurl.setPort( _protocol->defaultPort( _tdeio->_ssl ) );
|
|
|
|
|
|
|
|
|
|
//Making job to fetch file-list
|
|
|
|
|
|
|
|
|
@ -135,7 +135,7 @@ void KIO_Count::count( KKioDrop *drop )
|
|
|
|
|
TDEIO::Scheduler::scheduleJob( _job );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KIO_Count::stopActiveCount()
|
|
|
|
|
void TDEIO_Count::stopActiveCount()
|
|
|
|
|
{
|
|
|
|
|
if( !_new_mailurls )
|
|
|
|
|
return;
|
|
|
|
@ -160,26 +160,26 @@ void KIO_Count::stopActiveCount()
|
|
|
|
|
delete _new_mailurls; _new_mailurls = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KIO_Count::showPassive( const TQString& id )
|
|
|
|
|
void TDEIO_Count::showPassive( const TQString& id )
|
|
|
|
|
{
|
|
|
|
|
KURL kurl = *_kio->_kurl;
|
|
|
|
|
TDEIO::MetaData metadata = *_kio->_metadata;
|
|
|
|
|
KURL kurl = *_tdeio->_kurl;
|
|
|
|
|
TDEIO::MetaData metadata = *_tdeio->_metadata;
|
|
|
|
|
kurl = id;
|
|
|
|
|
//TDEIO::Slave *slave = 0;
|
|
|
|
|
|
|
|
|
|
_kio->_protocol->readSubjectKURL( kurl, metadata );
|
|
|
|
|
_tdeio->_protocol->readSubjectKURL( kurl, metadata );
|
|
|
|
|
if( kurl.port() == 0 )
|
|
|
|
|
kurl.setPort( _kio->_protocol->defaultPort( _kio->_ssl ) );
|
|
|
|
|
kurl.setPort( _tdeio->_protocol->defaultPort( _tdeio->_ssl ) );
|
|
|
|
|
|
|
|
|
|
KIO_Single_Subject *subject = new KIO_Single_Subject( this, id.latin1(), kurl, metadata, _kio->_protocol, _slave, id, 0 );
|
|
|
|
|
TDEIO_Single_Subject *subject = new TDEIO_Single_Subject( this, id.latin1(), kurl, metadata, _tdeio->_protocol, _slave, id, 0 );
|
|
|
|
|
|
|
|
|
|
_subjects_pending++;
|
|
|
|
|
|
|
|
|
|
connect( subject, TQT_SIGNAL( readSubject( KornMailSubject* ) ), this, TQT_SLOT( addtoPassivePopup( KornMailSubject* ) ) );
|
|
|
|
|
connect( subject, TQT_SIGNAL( finished( KIO_Single_Subject* ) ), this, TQT_SLOT( deleteSingleSubject( KIO_Single_Subject* ) ) );
|
|
|
|
|
connect( subject, TQT_SIGNAL( finished( TDEIO_Single_Subject* ) ), this, TQT_SLOT( deleteSingleSubject( TDEIO_Single_Subject* ) ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KIO_Count::disconnectSlave()
|
|
|
|
|
void TDEIO_Count::disconnectSlave()
|
|
|
|
|
{
|
|
|
|
|
if( _subjects_pending > 0 )
|
|
|
|
|
return; //Still getting data
|
|
|
|
@ -197,7 +197,7 @@ void KIO_Count::disconnectSlave()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//This function is called when fetching is over
|
|
|
|
|
void KIO_Count::result( TDEIO::Job* job )
|
|
|
|
|
void TDEIO_Count::result( TDEIO::Job* job )
|
|
|
|
|
{
|
|
|
|
|
//job should be the latest job; elsewise: print an error.
|
|
|
|
|
if( job != _job )
|
|
|
|
@ -207,10 +207,10 @@ void KIO_Count::result( TDEIO::Job* job )
|
|
|
|
|
//This could be very useful by resolving bugs.
|
|
|
|
|
if( job->error() )
|
|
|
|
|
{
|
|
|
|
|
kdError() << i18n( "The next KIO-error occurred by counting: %1" ).arg( job->errorString() ) << endl;
|
|
|
|
|
_kio->emitShowPassivePopup( i18n( "The next KIO-error occurred by counting: %1" ).arg( job->errorString() ) );
|
|
|
|
|
kdError() << i18n( "The next TDEIO-error occurred by counting: %1" ).arg( job->errorString() ) << endl;
|
|
|
|
|
_tdeio->emitShowPassivePopup( i18n( "The next TDEIO-error occurred by counting: %1" ).arg( job->errorString() ) );
|
|
|
|
|
_valid = false;
|
|
|
|
|
_kio->emitValidChanged();
|
|
|
|
|
_tdeio->emitValidChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
disconnect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), this, TQT_SLOT( result( TDEIO::Job* ) ) );
|
|
|
|
@ -223,24 +223,24 @@ void KIO_Count::result( TDEIO::Job* job )
|
|
|
|
|
delete _kurl; _kurl = 0;
|
|
|
|
|
delete _metadata; _metadata = 0;
|
|
|
|
|
|
|
|
|
|
if( _kio->_mailurls->count() != _new_mailurls->count() )
|
|
|
|
|
if( _tdeio->_mailurls->count() != _new_mailurls->count() )
|
|
|
|
|
{
|
|
|
|
|
*_kio->_mailurls = *_new_mailurls;
|
|
|
|
|
_kio->emitChanged(_kio->_mailurls->count());
|
|
|
|
|
*_tdeio->_mailurls = *_new_mailurls;
|
|
|
|
|
_tdeio->emitChanged(_tdeio->_mailurls->count());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*_kio->_mailurls = *_new_mailurls;
|
|
|
|
|
*_tdeio->_mailurls = *_new_mailurls;
|
|
|
|
|
}
|
|
|
|
|
delete _new_mailurls; _new_mailurls = 0;
|
|
|
|
|
|
|
|
|
|
_valid = true;
|
|
|
|
|
_kio->emitValidChanged();
|
|
|
|
|
_kio->emitRechecked();
|
|
|
|
|
_tdeio->emitValidChanged();
|
|
|
|
|
_tdeio->emitRechecked();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//An file list is ready; now save it in _kio->_mailurls.
|
|
|
|
|
void KIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list )
|
|
|
|
|
//An file list is ready; now save it in _tdeio->_mailurls.
|
|
|
|
|
void TDEIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list )
|
|
|
|
|
{
|
|
|
|
|
TQStringList old_list;
|
|
|
|
|
TDEIO::UDSEntryListConstIterator it1 ;
|
|
|
|
@ -253,7 +253,7 @@ void KIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list )
|
|
|
|
|
if( job != _job )
|
|
|
|
|
kdError() << i18n( "Got unknown job; something must be wrong..." ) << endl;
|
|
|
|
|
|
|
|
|
|
for( TQValueListConstIterator<KKioDrop::FileInfo> it = _kio->_mailurls->begin(); it != _kio->_mailurls->end(); ++it )
|
|
|
|
|
for( TQValueListConstIterator<KKioDrop::FileInfo> it = _tdeio->_mailurls->begin(); it != _tdeio->_mailurls->end(); ++it )
|
|
|
|
|
old_list.append( (*it).name );
|
|
|
|
|
|
|
|
|
|
for ( it1 = list.begin() ; it1 != list.end() ; it1++ )
|
|
|
|
@ -292,13 +292,13 @@ void KIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list )
|
|
|
|
|
if( ! fileinfo.name.isNull() && isFile )
|
|
|
|
|
{
|
|
|
|
|
_new_mailurls->append( fileinfo );
|
|
|
|
|
if( ! old_list.contains( fileinfo.name ) && _kio->passivePopup() )
|
|
|
|
|
if( ! old_list.contains( fileinfo.name ) && _tdeio->passivePopup() )
|
|
|
|
|
showPassive( fileinfo.name );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KIO_Count::addtoPassivePopup( KornMailSubject* subject )
|
|
|
|
|
void TDEIO_Count::addtoPassivePopup( KornMailSubject* subject )
|
|
|
|
|
{
|
|
|
|
|
if( ! _popup_subjects )
|
|
|
|
|
{
|
|
|
|
@ -314,7 +314,7 @@ void KIO_Count::addtoPassivePopup( KornMailSubject* subject )
|
|
|
|
|
_total_new_messages++;
|
|
|
|
|
if( _subjects_pending == 0 )
|
|
|
|
|
{
|
|
|
|
|
_kio->emitShowPassivePopup( dynamic_cast< TQPtrList<KornMailSubject>* >( _popup_subjects ), _total_new_messages );
|
|
|
|
|
_tdeio->emitShowPassivePopup( dynamic_cast< TQPtrList<KornMailSubject>* >( _popup_subjects ), _total_new_messages );
|
|
|
|
|
delete _popup_subjects; _popup_subjects = 0;
|
|
|
|
|
_total_new_messages = 0;
|
|
|
|
|
|
|
|
|
@ -322,7 +322,7 @@ void KIO_Count::addtoPassivePopup( KornMailSubject* subject )
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KIO_Count::deleteSingleSubject( KIO_Single_Subject* single_subject )
|
|
|
|
|
void TDEIO_Count::deleteSingleSubject( TDEIO_Single_Subject* single_subject )
|
|
|
|
|
{
|
|
|
|
|
delete single_subject;
|
|
|
|
|
}
|
|
|
|
|