-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,13 +1,13 @@ | |||
1 | #include "sendmailprogress.h" | 1 | #include "sendmailprogress.h" |
2 | #include <qprogressbar.h> | 2 | #include <qprogressbar.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | progressMailSend::progressMailSend(QWidget*parent, const char * name) | 6 | progressMailSend::progressMailSend(QWidget*parent, const char * name) |
7 | :progressMailSendUI(parent,name,false),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) | 7 | :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) |
8 | { | 8 | { |
9 | } | 9 | } |
10 | 10 | ||
11 | progressMailSend::~progressMailSend() | 11 | progressMailSend::~progressMailSend() |
12 | { | 12 | { |
13 | } | 13 | } |
@@ -40,9 +40,9 @@ void progressMailSend::setSingle() | |||
40 | singleMailProgressBar->setTotalSteps(m_max_single); | 40 | singleMailProgressBar->setTotalSteps(m_max_single); |
41 | singleMailProgressBar->setProgress(m_current_single); | 41 | singleMailProgressBar->setProgress(m_current_single); |
42 | } | 42 | } |
43 | 43 | ||
44 | void progressMailSend::setMails() | 44 | void progressMailSend::setMails() |
45 | { | 45 | { |
46 | QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_single+1).arg(m_max_single); | 46 | QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail); |
47 | allMailLabel->setText(text); | 47 | allMailLabel->setText(text); |
48 | } | 48 | } |
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 | |||
@@ -8,14 +8,14 @@ | |||
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>316</width> | 14 | <width>221</width> |
15 | <height>266</height> | 15 | <height>127</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Sending mail</string> | 20 | <string>Sending mail</string> |
21 | </property> | 21 | </property> |
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 | |||
@@ -522,13 +522,13 @@ void SMTPwrapper::readFromFile(const QString&file, char **data, size_t *size ) | |||
522 | } | 522 | } |
523 | 523 | ||
524 | void SMTPwrapper::progress( size_t current, size_t maximum ) | 524 | void SMTPwrapper::progress( size_t current, size_t maximum ) |
525 | { | 525 | { |
526 | if (SMTPwrapper::sendProgress) { | 526 | if (SMTPwrapper::sendProgress) { |
527 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); | 527 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); |
528 | qDebug("%u of %u",current,maximum); | 528 | qApp->processEvents(); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) | 532 | void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) |
533 | { | 533 | { |
534 | if (!mail) return; | 534 | if (!mail) return; |
@@ -649,15 +649,15 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) | |||
649 | 649 | ||
650 | mimeMail = createMimeMail(mail ); | 650 | mimeMail = createMimeMail(mail ); |
651 | if ( mimeMail == NULL ) { | 651 | if ( mimeMail == NULL ) { |
652 | qDebug( "sendMail: error creating mime mail" ); | 652 | qDebug( "sendMail: error creating mime mail" ); |
653 | } else { | 653 | } else { |
654 | sendProgress = new progressMailSend(); | 654 | sendProgress = new progressMailSend(); |
655 | sendProgress->showMaximized(); | 655 | // sendProgress->showMaximized(); |
656 | sendProgress->show(); | 656 | sendProgress->show(); |
657 | qApp->processEvents(10); | 657 | sendProgress->setMaxMails(1); |
658 | smtpSend( mimeMail,later,smtp); | 658 | smtpSend( mimeMail,later,smtp); |
659 | mailmime_free( mimeMail ); | 659 | mailmime_free( mimeMail ); |
660 | qDebug("Clean up done"); | 660 | qDebug("Clean up done"); |
661 | sendProgress->hide(); | 661 | sendProgress->hide(); |
662 | delete sendProgress; | 662 | delete sendProgress; |
663 | sendProgress = 0; | 663 | sendProgress = 0; |
@@ -710,19 +710,28 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
710 | wrap->listMessages(mbox,mailsToSend); | 710 | wrap->listMessages(mbox,mailsToSend); |
711 | if (mailsToSend.count()==0) { | 711 | if (mailsToSend.count()==0) { |
712 | delete wrap; | 712 | delete wrap; |
713 | return; | 713 | return; |
714 | } | 714 | } |
715 | mailsToSend.setAutoDelete(false); | 715 | mailsToSend.setAutoDelete(false); |
716 | sendProgress = new progressMailSend(); | ||
717 | // sendProgress->showMaximized(); | ||
718 | sendProgress->show(); | ||
719 | sendProgress->setMaxMails(mailsToSend.count()); | ||
720 | |||
716 | while (mailsToSend.count()>0) { | 721 | while (mailsToSend.count()>0) { |
717 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { | 722 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { |
718 | QMessageBox::critical(0,tr("Error sending mail"), | 723 | QMessageBox::critical(0,tr("Error sending mail"), |
719 | tr("Error sending queued mail - breaking")); | 724 | tr("Error sending queued mail - breaking")); |
720 | break; | 725 | break; |
721 | } | 726 | } |
722 | mailsToRemove.append(mailsToSend.at(0)); | 727 | mailsToRemove.append(mailsToSend.at(0)); |
723 | mailsToSend.removeFirst(); | 728 | mailsToSend.removeFirst(); |
729 | sendProgress->setCurrentMails(mailsToRemove.count()); | ||
724 | } | 730 | } |
731 | sendProgress->hide(); | ||
732 | delete sendProgress; | ||
733 | sendProgress = 0; | ||
725 | wrap->deleteMails(mbox,mailsToRemove); | 734 | wrap->deleteMails(mbox,mailsToRemove); |
726 | mailsToSend.setAutoDelete(true); | 735 | mailsToSend.setAutoDelete(true); |
727 | delete wrap; | 736 | delete wrap; |
728 | } | 737 | } |
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,13 +1,13 @@ | |||
1 | #include "sendmailprogress.h" | 1 | #include "sendmailprogress.h" |
2 | #include <qprogressbar.h> | 2 | #include <qprogressbar.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | progressMailSend::progressMailSend(QWidget*parent, const char * name) | 6 | progressMailSend::progressMailSend(QWidget*parent, const char * name) |
7 | :progressMailSendUI(parent,name,false),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) | 7 | :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) |
8 | { | 8 | { |
9 | } | 9 | } |
10 | 10 | ||
11 | progressMailSend::~progressMailSend() | 11 | progressMailSend::~progressMailSend() |
12 | { | 12 | { |
13 | } | 13 | } |
@@ -40,9 +40,9 @@ void progressMailSend::setSingle() | |||
40 | singleMailProgressBar->setTotalSteps(m_max_single); | 40 | singleMailProgressBar->setTotalSteps(m_max_single); |
41 | singleMailProgressBar->setProgress(m_current_single); | 41 | singleMailProgressBar->setProgress(m_current_single); |
42 | } | 42 | } |
43 | 43 | ||
44 | void progressMailSend::setMails() | 44 | void progressMailSend::setMails() |
45 | { | 45 | { |
46 | QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_single+1).arg(m_max_single); | 46 | QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail); |
47 | allMailLabel->setText(text); | 47 | allMailLabel->setText(text); |
48 | } | 48 | } |
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 | |||
@@ -8,14 +8,14 @@ | |||
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>316</width> | 14 | <width>221</width> |
15 | <height>266</height> | 15 | <height>127</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Sending mail</string> | 20 | <string>Sending mail</string> |
21 | </property> | 21 | </property> |
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 | |||
@@ -522,13 +522,13 @@ void SMTPwrapper::readFromFile(const QString&file, char **data, size_t *size ) | |||
522 | } | 522 | } |
523 | 523 | ||
524 | void SMTPwrapper::progress( size_t current, size_t maximum ) | 524 | void SMTPwrapper::progress( size_t current, size_t maximum ) |
525 | { | 525 | { |
526 | if (SMTPwrapper::sendProgress) { | 526 | if (SMTPwrapper::sendProgress) { |
527 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); | 527 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); |
528 | qDebug("%u of %u",current,maximum); | 528 | qApp->processEvents(); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) | 532 | void SMTPwrapper::storeMail(char*mail, size_t length, const QString&box) |
533 | { | 533 | { |
534 | if (!mail) return; | 534 | if (!mail) return; |
@@ -649,15 +649,15 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) | |||
649 | 649 | ||
650 | mimeMail = createMimeMail(mail ); | 650 | mimeMail = createMimeMail(mail ); |
651 | if ( mimeMail == NULL ) { | 651 | if ( mimeMail == NULL ) { |
652 | qDebug( "sendMail: error creating mime mail" ); | 652 | qDebug( "sendMail: error creating mime mail" ); |
653 | } else { | 653 | } else { |
654 | sendProgress = new progressMailSend(); | 654 | sendProgress = new progressMailSend(); |
655 | sendProgress->showMaximized(); | 655 | // sendProgress->showMaximized(); |
656 | sendProgress->show(); | 656 | sendProgress->show(); |
657 | qApp->processEvents(10); | 657 | sendProgress->setMaxMails(1); |
658 | smtpSend( mimeMail,later,smtp); | 658 | smtpSend( mimeMail,later,smtp); |
659 | mailmime_free( mimeMail ); | 659 | mailmime_free( mimeMail ); |
660 | qDebug("Clean up done"); | 660 | qDebug("Clean up done"); |
661 | sendProgress->hide(); | 661 | sendProgress->hide(); |
662 | delete sendProgress; | 662 | delete sendProgress; |
663 | sendProgress = 0; | 663 | sendProgress = 0; |
@@ -710,19 +710,28 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
710 | wrap->listMessages(mbox,mailsToSend); | 710 | wrap->listMessages(mbox,mailsToSend); |
711 | if (mailsToSend.count()==0) { | 711 | if (mailsToSend.count()==0) { |
712 | delete wrap; | 712 | delete wrap; |
713 | return; | 713 | return; |
714 | } | 714 | } |
715 | mailsToSend.setAutoDelete(false); | 715 | mailsToSend.setAutoDelete(false); |
716 | sendProgress = new progressMailSend(); | ||
717 | // sendProgress->showMaximized(); | ||
718 | sendProgress->show(); | ||
719 | sendProgress->setMaxMails(mailsToSend.count()); | ||
720 | |||
716 | while (mailsToSend.count()>0) { | 721 | while (mailsToSend.count()>0) { |
717 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { | 722 | if (sendQueuedMail(wrap,smtp,mailsToSend.at(0))==0) { |
718 | QMessageBox::critical(0,tr("Error sending mail"), | 723 | QMessageBox::critical(0,tr("Error sending mail"), |
719 | tr("Error sending queued mail - breaking")); | 724 | tr("Error sending queued mail - breaking")); |
720 | break; | 725 | break; |
721 | } | 726 | } |
722 | mailsToRemove.append(mailsToSend.at(0)); | 727 | mailsToRemove.append(mailsToSend.at(0)); |
723 | mailsToSend.removeFirst(); | 728 | mailsToSend.removeFirst(); |
729 | sendProgress->setCurrentMails(mailsToRemove.count()); | ||
724 | } | 730 | } |
731 | sendProgress->hide(); | ||
732 | delete sendProgress; | ||
733 | sendProgress = 0; | ||
725 | wrap->deleteMails(mbox,mailsToRemove); | 734 | wrap->deleteMails(mbox,mailsToRemove); |
726 | mailsToSend.setAutoDelete(true); | 735 | mailsToSend.setAutoDelete(true); |
727 | delete wrap; | 736 | delete wrap; |
728 | } | 737 | } |