-rw-r--r-- | noncore/net/mail/libmailwrapper/sendmailprogress.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/sendmailprogressui.ui | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mail/sendmailprogress.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/sendmailprogressui.ui | 4 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.cpp | 15 |
6 files changed, 32 insertions, 14 deletions
diff --git a/noncore/net/mail/libmailwrapper/sendmailprogress.cpp b/noncore/net/mail/libmailwrapper/sendmailprogress.cpp index 13ddd37..ef22750 100644 --- a/noncore/net/mail/libmailwrapper/sendmailprogress.cpp +++ b/noncore/net/mail/libmailwrapper/sendmailprogress.cpp @@ -1,15 +1,15 @@ #include "sendmailprogress.h" #include <qprogressbar.h> #include <qlabel.h> #include <qstring.h> progressMailSend::progressMailSend(QWidget*parent, const char * name) - :progressMailSendUI(parent,name,false),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) + :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) { } progressMailSend::~progressMailSend() { } void progressMailSend::setMaxMails(unsigned int aMaxMails) @@ -38,11 +38,11 @@ void progressMailSend::setSingle() QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single); singleMailLabel->setText(text); singleMailProgressBar->setTotalSteps(m_max_single); singleMailProgressBar->setProgress(m_current_single); } void progressMailSend::setMails() { - QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_single+1).arg(m_max_single); + QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail); allMailLabel->setText(text); } diff --git a/noncore/net/mail/libmailwrapper/sendmailprogressui.ui b/noncore/net/mail/libmailwrapper/sendmailprogressui.ui index b90b088..287ab5e 100644 --- a/noncore/net/mail/libmailwrapper/sendmailprogressui.ui +++ b/noncore/net/mail/libmailwrapper/sendmailprogressui.ui @@ -6,18 +6,18 @@ <name>name</name> <cstring>progressMailSendUI</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>316</width> - <height>266</height> + <width>221</width> + <height>127</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Sending mail</string> </property> <property> <name>layoutMargin</name> diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 53c0af5..770e2b8 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -520,17 +520,17 @@ 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 ) { if (SMTPwrapper::sendProgress) { SMTPwrapper::sendProgress->setSingleMail(current, maximum ); - qDebug("%u of %u",current,maximum); + qApp->processEvents(); } } void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) { if (!mail) return; QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); MBOXwrapper*wrap = new MBOXwrapper(localfolders); @@ -647,19 +647,19 @@ 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->showMaximized(); sendProgress->show(); - qApp->processEvents(10); + sendProgress->setMaxMails(1); smtpSend( mimeMail,later,smtp); mailmime_free( mimeMail ); qDebug("Clean up done"); sendProgress->hide(); delete sendProgress; sendProgress = 0; } } @@ -708,21 +708,30 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) QList<RecMail> mailsToRemove; QString mbox("Outgoing"); wrap->listMessages(mbox,mailsToSend); if (mailsToSend.count()==0) { delete wrap; return; } mailsToSend.setAutoDelete(false); + sendProgress = new progressMailSend(); +// sendProgress->showMaximized(); + sendProgress->show(); + sendProgress->setMaxMails(mailsToSend.count()); + while (mailsToSend.count()>0) { if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { QMessageBox::critical(0,tr("Error sending mail"), tr("Error sending queued mail - breaking")); break; } mailsToRemove.append(mailsToSend.at(0)); mailsToSend.removeFirst(); + sendProgress->setCurrentMails(mailsToRemove.count()); } + sendProgress->hide(); + delete sendProgress; + sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); mailsToSend.setAutoDelete(true); delete wrap; } diff --git a/noncore/net/mail/sendmailprogress.cpp b/noncore/net/mail/sendmailprogress.cpp index 13ddd37..ef22750 100644 --- a/noncore/net/mail/sendmailprogress.cpp +++ b/noncore/net/mail/sendmailprogress.cpp @@ -1,15 +1,15 @@ #include "sendmailprogress.h" #include <qprogressbar.h> #include <qlabel.h> #include <qstring.h> progressMailSend::progressMailSend(QWidget*parent, const char * name) - :progressMailSendUI(parent,name,false),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) + :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) { } progressMailSend::~progressMailSend() { } void progressMailSend::setMaxMails(unsigned int aMaxMails) @@ -38,11 +38,11 @@ void progressMailSend::setSingle() QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single); singleMailLabel->setText(text); singleMailProgressBar->setTotalSteps(m_max_single); singleMailProgressBar->setProgress(m_current_single); } void progressMailSend::setMails() { - QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_single+1).arg(m_max_single); + QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail); allMailLabel->setText(text); } diff --git a/noncore/net/mail/sendmailprogressui.ui b/noncore/net/mail/sendmailprogressui.ui index b90b088..287ab5e 100644 --- a/noncore/net/mail/sendmailprogressui.ui +++ b/noncore/net/mail/sendmailprogressui.ui @@ -6,18 +6,18 @@ <name>name</name> <cstring>progressMailSendUI</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>316</width> - <height>266</height> + <width>221</width> + <height>127</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Sending mail</string> </property> <property> <name>layoutMargin</name> diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp index 53c0af5..770e2b8 100644 --- a/noncore/net/mail/smtpwrapper.cpp +++ b/noncore/net/mail/smtpwrapper.cpp @@ -520,17 +520,17 @@ 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 ) { if (SMTPwrapper::sendProgress) { SMTPwrapper::sendProgress->setSingleMail(current, maximum ); - qDebug("%u of %u",current,maximum); + qApp->processEvents(); } } void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) { if (!mail) return; QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); MBOXwrapper*wrap = new MBOXwrapper(localfolders); @@ -647,19 +647,19 @@ 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->showMaximized(); sendProgress->show(); - qApp->processEvents(10); + sendProgress->setMaxMails(1); smtpSend( mimeMail,later,smtp); mailmime_free( mimeMail ); qDebug("Clean up done"); sendProgress->hide(); delete sendProgress; sendProgress = 0; } } @@ -708,21 +708,30 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) QList<RecMail> mailsToRemove; QString mbox("Outgoing"); wrap->listMessages(mbox,mailsToSend); if (mailsToSend.count()==0) { delete wrap; return; } mailsToSend.setAutoDelete(false); + sendProgress = new progressMailSend(); +// sendProgress->showMaximized(); + sendProgress->show(); + sendProgress->setMaxMails(mailsToSend.count()); + while (mailsToSend.count()>0) { if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { QMessageBox::critical(0,tr("Error sending mail"), tr("Error sending queued mail - breaking")); break; } mailsToRemove.append(mailsToSend.at(0)); mailsToSend.removeFirst(); + sendProgress->setCurrentMails(mailsToRemove.count()); } + sendProgress->hide(); + delete sendProgress; + sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); mailsToSend.setAutoDelete(true); delete wrap; } |