author | alwin <alwin> | 2003-12-24 01:29:43 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-24 01:29:43 (UTC) |
commit | 242f7a04e3e4963a5606ac603d54a4f115de4a04 (patch) (side-by-side diff) | |
tree | dd8578fbc812791dd7e5026a28710a8313cf5cf8 /noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |
parent | 7c720aabcad9b325dbf9910493e3c9fa1d63805e (diff) | |
download | opie-242f7a04e3e4963a5606ac603d54a4f115de4a04.zip opie-242f7a04e3e4963a5606ac603d54a4f115de4a04.tar.gz opie-242f7a04e3e4963a5606ac603d54a4f115de4a04.tar.bz2 |
tried to implement a progress dialog when sending mails. It doesn't work
(dialog will show but makes no updates, when using qApp->progressEvents(x)
dialog hides)
I don't know why - and I giving up for the moment.
Diffstat (limited to 'noncore/net/mail/libmailwrapper/smtpwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index b81a87f..53c0af5 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -12,12 +12,15 @@ #include "smtpwrapper.h" #include "mailwrapper.h" #include "mboxwrapper.h" #include "logindialog.h" #include "mailtypes.h" #include "defines.h" +#include "sendmailprogress.h" + +progressMailSend*SMTPwrapper::sendProgress = 0; SMTPwrapper::SMTPwrapper( Settings *s ) : QObject() { settings = s; } @@ -517,13 +520,16 @@ void SMTPwrapper::readFromFile(const QString&file, char **data, size_t *size ) memcpy(*data,msg.ascii(),msg.length()); *size=msg.length(); } void SMTPwrapper::progress( size_t current, size_t maximum ) { -// qDebug( "Current: %i of %i", current, maximum ); + if (SMTPwrapper::sendProgress) { + SMTPwrapper::sendProgress->setSingleMail(current, maximum ); + qDebug("%u of %u",current,maximum); + } } void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) { if (!mail) return; QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); @@ -642,15 +648,22 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) SMTPaccount *smtp = getAccount(mail.getName()); mimeMail = createMimeMail(mail ); if ( mimeMail == NULL ) { qDebug( "sendMail: error creating mime mail" ); } else { + sendProgress = new progressMailSend(); + sendProgress->showMaximized(); + sendProgress->show(); + qApp->processEvents(10); smtpSend( mimeMail,later,smtp); mailmime_free( mimeMail ); qDebug("Clean up done"); + sendProgress->hide(); + delete sendProgress; + sendProgress = 0; } } int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) { char*data = 0; @@ -670,12 +683,13 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) return 0; } rcpts = createRcptList( fields ); ffrom = getField(fields, MAILIMF_FIELD_FROM ); from = getFrom(ffrom); + qDebug("Size: %i vs. %i",length,strlen(data)); if (rcpts && from) { return smtpSend(from,rcpts,data,strlen(data),smtp ); } return 0; } |