Commit 481420b5 authored by Volker Krause's avatar Volker Krause
Browse files

add progress reporting

svn path=/trunk/KDE/kdepim/mailtransport/; revision=619489
parent 99ff3840
......@@ -43,10 +43,8 @@ TransportJob
SendmailJob
-----------
- implement doKill()
- indicate progress
SMTPJob
-------
- get rid of kmail specific stuff in start()
- implement doKill()
- indicate progress
......@@ -45,6 +45,7 @@ void SendmailJob::start()
setErrorText( i18n("Failed to execute mailer program %1", transport()->host()) );
emitResult();
}
setTotalSize( data().length() );
wroteStdin();
}
......@@ -59,6 +60,7 @@ void SendmailJob::sendmailExited()
void SendmailJob::wroteStdin()
{
setProcessedSize( buffer()->pos() );
if ( buffer()->atEnd() ) {
mProcess->closeStdin();
} else {
......
......@@ -161,6 +161,8 @@ void SmtpJob::start()
addSubjob( job );
KIO::Scheduler::assignJobToSlave( mSlave, job );
setTotalSize( data().length() );
}
void SmtpJob::slotResult(KJob * job)
......@@ -179,8 +181,7 @@ void SmtpJob::dataRequest(KIO::Job * job, QByteArray & data)
data.clear();
else
data = buffer()->read( 32*1024 );
// TODO: from kmsender.cpp
// mSender->emitProgressInfo( mMessageOffset );
setProcessedSize( buffer()->pos() );
}
void SmtpJob::slaveError(KIO::Slave * slave, int errorCode, const QString & errorMsg)
......
......@@ -31,6 +31,10 @@ namespace KPIM {
/**
Mail transport job for SMTP.
Internally, all jobs for a specific transport are queued to use the same
KIO::Slave. This avoids multiple simultaneous connections to the server,
which is not always allowed. Also, re-using an already existing connection
avoids the login overhead and can improve performance.
*/
class MAILTRANSPORT_EXPORT SmtpJob : public TransportJob
{
......
......@@ -48,6 +48,8 @@ TransportMgr::TransportMgr()
mBccEdit = new KLineEdit( this );
mBccEdit->setClickMessage( "Bcc" );
mMailEdit = new QTextEdit( this );
mMailEdit->setAcceptRichText( false );
mMailEdit->setLineWrapMode( QTextEdit::NoWrap );
b = new QPushButton( "&Send", this );
connect( b, SIGNAL(clicked(bool)), SLOT(sendBtnClicked()) );
}
......@@ -69,6 +71,7 @@ void TransportMgr::sendBtnClicked()
job->setBcc( mBccEdit->text().isEmpty() ? QStringList() : mBccEdit->text().split(',') );
job->setData( mMailEdit->document()->toPlainText().toLatin1() );
connect( job, SIGNAL(result(KJob*)), SLOT(jobResult(KJob*)) );
connect( job, SIGNAL(percent(KJob*,unsigned long)), SLOT(jobPercent(KJob*,unsigned long)) );
job->start();
}
......@@ -86,5 +89,11 @@ void TransportMgr::jobResult( KJob* job )
kDebug() << k_funcinfo << job->error() << job->errorText() << endl;
}
void TransportMgr::jobPercent(KJob * job, unsigned long percent)
{
Q_UNUSED( job );
kDebug() << k_funcinfo << percent << "%" << endl;
}
#include "transportmgr.moc"
......@@ -38,6 +38,7 @@ class TransportMgr : public KVBox
void editBtnClicked();
void sendBtnClicked();
void jobResult( KJob* job );
void jobPercent( KJob* job, unsigned long percent );
private:
KPIM::TransportComboBox* mComboBox;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment