author | harlekin <harlekin> | 2003-12-24 10:52:13 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-24 10:52:13 (UTC) |
commit | d128e2686193fb52bad638317e6f29a1b75a1db4 (patch) (side-by-side diff) | |
tree | c53199fd367577dd0a7ac43e9fad293e92de2607 | |
parent | ff20f6d33cffd84222029df9f118a9e5db5ec3e5 (diff) | |
download | opie-d128e2686193fb52bad638317e6f29a1b75a1db4.zip opie-d128e2686193fb52bad638317e6f29a1b75a1db4.tar.gz opie-d128e2686193fb52bad638317e6f29a1b75a1db4.tar.bz2 |
only show the mail queue flushed dialogbox when successfull -)
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 3 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.h | 2 |
5 files changed, 26 insertions, 11 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 770e2b8..a7e4837 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -694,24 +694,27 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) return 0; } /* this is a special fun */ -void SMTPwrapper::flushOutbox(SMTPaccount*smtp) +bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { - if (!smtp) return; + bool returnValue = true; + + if (!smtp) return false; + QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); MBOXwrapper*wrap = new MBOXwrapper(localfolders); if (!wrap) { qDebug("memory error"); - return; + return false; } QList<RecMail> mailsToSend; QList<RecMail> mailsToRemove; QString mbox("Outgoing"); wrap->listMessages(mbox,mailsToSend); if (mailsToSend.count()==0) { delete wrap; - return; + return false; } mailsToSend.setAutoDelete(false); sendProgress = new progressMailSend(); // sendProgress->showMaximized(); @@ -721,8 +724,10 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) 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")); + + returnValue = false; break; } mailsToRemove.append(mailsToSend.at(0)); mailsToSend.removeFirst(); @@ -733,5 +738,7 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); mailsToSend.setAutoDelete(true); delete wrap; + return returnValue; + } diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index baa353b..66180b7 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h @@ -27,9 +27,9 @@ class SMTPwrapper : public QObject public: SMTPwrapper( Settings *s ); virtual ~SMTPwrapper(){} void sendMail(const Mail& mail,bool later=false ); - void flushOutbox(SMTPaccount*smtp); + bool flushOutbox(SMTPaccount*smtp); static progressMailSend*sendProgress; protected: mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 833cac2..0dede90 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -67,12 +67,13 @@ void OpieMail::slotSendQueued() } // } if (smtp) { SMTPwrapper * wrap = new SMTPwrapper(settings); - wrap->flushOutbox(smtp); + if ( wrap->flushOutbox(smtp) ) { QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); } } +} void OpieMail::slotSearchMails() { qDebug( "Search Mails" ); diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp index 770e2b8..a7e4837 100644 --- a/noncore/net/mail/smtpwrapper.cpp +++ b/noncore/net/mail/smtpwrapper.cpp @@ -694,24 +694,27 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) return 0; } /* this is a special fun */ -void SMTPwrapper::flushOutbox(SMTPaccount*smtp) +bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { - if (!smtp) return; + bool returnValue = true; + + if (!smtp) return false; + QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); MBOXwrapper*wrap = new MBOXwrapper(localfolders); if (!wrap) { qDebug("memory error"); - return; + return false; } QList<RecMail> mailsToSend; QList<RecMail> mailsToRemove; QString mbox("Outgoing"); wrap->listMessages(mbox,mailsToSend); if (mailsToSend.count()==0) { delete wrap; - return; + return false; } mailsToSend.setAutoDelete(false); sendProgress = new progressMailSend(); // sendProgress->showMaximized(); @@ -721,8 +724,10 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) 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")); + + returnValue = false; break; } mailsToRemove.append(mailsToSend.at(0)); mailsToSend.removeFirst(); @@ -733,5 +738,7 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); mailsToSend.setAutoDelete(true); delete wrap; + return returnValue; + } diff --git a/noncore/net/mail/smtpwrapper.h b/noncore/net/mail/smtpwrapper.h index baa353b..66180b7 100644 --- a/noncore/net/mail/smtpwrapper.h +++ b/noncore/net/mail/smtpwrapper.h @@ -27,9 +27,9 @@ class SMTPwrapper : public QObject public: SMTPwrapper( Settings *s ); virtual ~SMTPwrapper(){} void sendMail(const Mail& mail,bool later=false ); - void flushOutbox(SMTPaccount*smtp); + bool flushOutbox(SMTPaccount*smtp); static progressMailSend*sendProgress; protected: mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); |