-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 30 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 10 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 3 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.cpp | 30 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.h | 10 |
5 files changed, 75 insertions, 8 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 30c0707..7e03af9 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -7,6 +7,9 @@ | |||
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | 9 | ||
10 | #include <qpe/config.h> | ||
11 | #include <qpe/qcopenvelope_qws.h> | ||
12 | |||
10 | #include <libetpan/libetpan.h> | 13 | #include <libetpan/libetpan.h> |
11 | 14 | ||
12 | #include "smtpwrapper.h" | 15 | #include "smtpwrapper.h" |
@@ -23,6 +26,16 @@ SMTPwrapper::SMTPwrapper( Settings *s ) | |||
23 | : QObject() | 26 | : QObject() |
24 | { | 27 | { |
25 | settings = s; | 28 | settings = s; |
29 | Config cfg( "mail" ); | ||
30 | cfg.setGroup( "Status" ); | ||
31 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | ||
32 | emit queuedMails( m_queuedMail ); | ||
33 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); | ||
34 | } | ||
35 | |||
36 | void SMTPwrapper::emitQCop( int queued ) { | ||
37 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); | ||
38 | env << queued; | ||
26 | } | 39 | } |
27 | 40 | ||
28 | QString SMTPwrapper::mailsmtpError( int errnum ) | 41 | QString SMTPwrapper::mailsmtpError( int errnum ) |
@@ -248,7 +261,7 @@ mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimety | |||
248 | name = strdup( tmp.latin1() ); // just filename | 261 | name = strdup( tmp.latin1() ); // just filename |
249 | file = strdup( filename.latin1() ); // full name with path | 262 | file = strdup( filename.latin1() ); // full name with path |
250 | } | 263 | } |
251 | 264 | ||
252 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; | 265 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; |
253 | int mechanism = MAILMIME_MECHANISM_BASE64; | 266 | int mechanism = MAILMIME_MECHANISM_BASE64; |
254 | 267 | ||
@@ -350,7 +363,7 @@ mailmime *SMTPwrapper::createMimeMail(const Mail &mail ) | |||
350 | mailmime_set_imf_fields( message, fields ); | 363 | mailmime_set_imf_fields( message, fields ); |
351 | 364 | ||
352 | txtPart = buildTxtPart( mail.getMessage() ); | 365 | txtPart = buildTxtPart( mail.getMessage() ); |
353 | 366 | ||
354 | if ( txtPart == NULL ) goto err_free_message; | 367 | if ( txtPart == NULL ) goto err_free_message; |
355 | 368 | ||
356 | err = mailmime_smart_add_part( message, txtPart ); | 369 | err = mailmime_smart_add_part( message, txtPart ); |
@@ -489,7 +502,7 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
489 | return; | 502 | return; |
490 | } | 503 | } |
491 | from = data = 0; | 504 | from = data = 0; |
492 | 505 | ||
493 | mailmessage * msg = 0; | 506 | mailmessage * msg = 0; |
494 | msg = mime_message_init(mail); | 507 | msg = mime_message_init(mail); |
495 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 508 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
@@ -507,6 +520,10 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
507 | if (later) { | 520 | if (later) { |
508 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); | 521 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); |
509 | if (data) free( data ); | 522 | if (data) free( data ); |
523 | Config cfg( "mail" ); | ||
524 | cfg.setGroup( "Status" ); | ||
525 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | ||
526 | emit queuedMails( m_queuedMail ); | ||
510 | return; | 527 | return; |
511 | } | 528 | } |
512 | from = getFrom( mail ); | 529 | from = getFrom( mail ); |
@@ -653,7 +670,7 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
653 | } | 670 | } |
654 | if (data) { | 671 | if (data) { |
655 | free(data); | 672 | free(data); |
656 | } | 673 | } |
657 | if (from) { | 674 | if (from) { |
658 | free(from); | 675 | free(from); |
659 | } | 676 | } |
@@ -700,6 +717,11 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
700 | mailsToSend.removeFirst(); | 717 | mailsToSend.removeFirst(); |
701 | sendProgress->setCurrentMails(mailsToRemove.count()); | 718 | sendProgress->setCurrentMails(mailsToRemove.count()); |
702 | } | 719 | } |
720 | Config cfg( "mail" ); | ||
721 | cfg.setGroup( "Status" ); | ||
722 | m_queuedMail = 0; | ||
723 | cfg.writeEntry( "outgoing", m_queuedMail ); | ||
724 | emit queuedMails( m_queuedMail ); | ||
703 | sendProgress->hide(); | 725 | sendProgress->hide(); |
704 | delete sendProgress; | 726 | delete sendProgress; |
705 | sendProgress = 0; | 727 | sendProgress = 0; |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 0535983..05becf2 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h | |||
@@ -31,6 +31,10 @@ public: | |||
31 | bool flushOutbox(SMTPaccount*smtp); | 31 | bool flushOutbox(SMTPaccount*smtp); |
32 | 32 | ||
33 | static progressMailSend*sendProgress; | 33 | static progressMailSend*sendProgress; |
34 | |||
35 | signals: | ||
36 | void queuedMails( int ); | ||
37 | |||
34 | protected: | 38 | protected: |
35 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); | 39 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); |
36 | mailimf_fields *createImfFields(const Mail &mail ); | 40 | mailimf_fields *createImfFields(const Mail &mail ); |
@@ -56,6 +60,12 @@ protected: | |||
56 | Settings *settings; | 60 | Settings *settings; |
57 | 61 | ||
58 | int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); | 62 | int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); |
63 | |||
64 | int m_queuedMail; | ||
65 | |||
66 | protected slots: | ||
67 | void emitQCop( int queued ); | ||
68 | |||
59 | }; | 69 | }; |
60 | 70 | ||
61 | #endif | 71 | #endif |
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index e35f5b6..54453b7 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -25,6 +25,9 @@ OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | |||
25 | connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), | 25 | connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), |
26 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 26 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); |
27 | #endif | 27 | #endif |
28 | |||
29 | |||
30 | |||
28 | } | 31 | } |
29 | 32 | ||
30 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 33 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp index 30c0707..7e03af9 100644 --- a/noncore/net/mail/smtpwrapper.cpp +++ b/noncore/net/mail/smtpwrapper.cpp | |||
@@ -7,6 +7,9 @@ | |||
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | 9 | ||
10 | #include <qpe/config.h> | ||
11 | #include <qpe/qcopenvelope_qws.h> | ||
12 | |||
10 | #include <libetpan/libetpan.h> | 13 | #include <libetpan/libetpan.h> |
11 | 14 | ||
12 | #include "smtpwrapper.h" | 15 | #include "smtpwrapper.h" |
@@ -23,6 +26,16 @@ SMTPwrapper::SMTPwrapper( Settings *s ) | |||
23 | : QObject() | 26 | : QObject() |
24 | { | 27 | { |
25 | settings = s; | 28 | settings = s; |
29 | Config cfg( "mail" ); | ||
30 | cfg.setGroup( "Status" ); | ||
31 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | ||
32 | emit queuedMails( m_queuedMail ); | ||
33 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); | ||
34 | } | ||
35 | |||
36 | void SMTPwrapper::emitQCop( int queued ) { | ||
37 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); | ||
38 | env << queued; | ||
26 | } | 39 | } |
27 | 40 | ||
28 | QString SMTPwrapper::mailsmtpError( int errnum ) | 41 | QString SMTPwrapper::mailsmtpError( int errnum ) |
@@ -248,7 +261,7 @@ mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimety | |||
248 | name = strdup( tmp.latin1() ); // just filename | 261 | name = strdup( tmp.latin1() ); // just filename |
249 | file = strdup( filename.latin1() ); // full name with path | 262 | file = strdup( filename.latin1() ); // full name with path |
250 | } | 263 | } |
251 | 264 | ||
252 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; | 265 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; |
253 | int mechanism = MAILMIME_MECHANISM_BASE64; | 266 | int mechanism = MAILMIME_MECHANISM_BASE64; |
254 | 267 | ||
@@ -350,7 +363,7 @@ mailmime *SMTPwrapper::createMimeMail(const Mail &mail ) | |||
350 | mailmime_set_imf_fields( message, fields ); | 363 | mailmime_set_imf_fields( message, fields ); |
351 | 364 | ||
352 | txtPart = buildTxtPart( mail.getMessage() ); | 365 | txtPart = buildTxtPart( mail.getMessage() ); |
353 | 366 | ||
354 | if ( txtPart == NULL ) goto err_free_message; | 367 | if ( txtPart == NULL ) goto err_free_message; |
355 | 368 | ||
356 | err = mailmime_smart_add_part( message, txtPart ); | 369 | err = mailmime_smart_add_part( message, txtPart ); |
@@ -489,7 +502,7 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
489 | return; | 502 | return; |
490 | } | 503 | } |
491 | from = data = 0; | 504 | from = data = 0; |
492 | 505 | ||
493 | mailmessage * msg = 0; | 506 | mailmessage * msg = 0; |
494 | msg = mime_message_init(mail); | 507 | msg = mime_message_init(mail); |
495 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 508 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
@@ -507,6 +520,10 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) | |||
507 | if (later) { | 520 | if (later) { |
508 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); | 521 | storeMail((char*)tmp.data(),tmp.length(),"Outgoing"); |
509 | if (data) free( data ); | 522 | if (data) free( data ); |
523 | Config cfg( "mail" ); | ||
524 | cfg.setGroup( "Status" ); | ||
525 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | ||
526 | emit queuedMails( m_queuedMail ); | ||
510 | return; | 527 | return; |
511 | } | 528 | } |
512 | from = getFrom( mail ); | 529 | from = getFrom( mail ); |
@@ -653,7 +670,7 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) | |||
653 | } | 670 | } |
654 | if (data) { | 671 | if (data) { |
655 | free(data); | 672 | free(data); |
656 | } | 673 | } |
657 | if (from) { | 674 | if (from) { |
658 | free(from); | 675 | free(from); |
659 | } | 676 | } |
@@ -700,6 +717,11 @@ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) | |||
700 | mailsToSend.removeFirst(); | 717 | mailsToSend.removeFirst(); |
701 | sendProgress->setCurrentMails(mailsToRemove.count()); | 718 | sendProgress->setCurrentMails(mailsToRemove.count()); |
702 | } | 719 | } |
720 | Config cfg( "mail" ); | ||
721 | cfg.setGroup( "Status" ); | ||
722 | m_queuedMail = 0; | ||
723 | cfg.writeEntry( "outgoing", m_queuedMail ); | ||
724 | emit queuedMails( m_queuedMail ); | ||
703 | sendProgress->hide(); | 725 | sendProgress->hide(); |
704 | delete sendProgress; | 726 | delete sendProgress; |
705 | sendProgress = 0; | 727 | sendProgress = 0; |
diff --git a/noncore/net/mail/smtpwrapper.h b/noncore/net/mail/smtpwrapper.h index 0535983..05becf2 100644 --- a/noncore/net/mail/smtpwrapper.h +++ b/noncore/net/mail/smtpwrapper.h | |||
@@ -31,6 +31,10 @@ public: | |||
31 | bool flushOutbox(SMTPaccount*smtp); | 31 | bool flushOutbox(SMTPaccount*smtp); |
32 | 32 | ||
33 | static progressMailSend*sendProgress; | 33 | static progressMailSend*sendProgress; |
34 | |||
35 | signals: | ||
36 | void queuedMails( int ); | ||
37 | |||
34 | protected: | 38 | protected: |
35 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); | 39 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); |
36 | mailimf_fields *createImfFields(const Mail &mail ); | 40 | mailimf_fields *createImfFields(const Mail &mail ); |
@@ -56,6 +60,12 @@ protected: | |||
56 | Settings *settings; | 60 | Settings *settings; |
57 | 61 | ||
58 | int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); | 62 | int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); |
63 | |||
64 | int m_queuedMail; | ||
65 | |||
66 | protected slots: | ||
67 | void emitQCop( int queued ); | ||
68 | |||
59 | }; | 69 | }; |
60 | 70 | ||
61 | #endif | 71 | #endif |