summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/smtpwrapper.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index dee1477..eb07ef1 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -7,27 +7,30 @@
7 7
8//#include <opie2/odebug.h> 8//#include <opie2/odebug.h>
9//#include <qt.h> 9//#include <qt.h>
10#include <qapplication.h> 10#include <qapplication.h>
11#include <qmessagebox.h> 11#include <qmessagebox.h>
12#include <stdlib.h> 12#include <stdlib.h>
13#include <qpe/config.h> 13#ifndef DESKTOP_VERSION
14//#include <qpe/config.h>
14#include <qpe/qcopenvelope_qws.h> 15#include <qpe/qcopenvelope_qws.h>
15 16#endif
16#include <libetpan/libetpan.h> 17#include <libetpan/libetpan.h>
17#include <klocale.h> 18#include <klocale.h>
19#include <kglobal.h>
20#include <kconfig.h>
18 21
19 22
20using namespace Opie::Core; 23using namespace Opie::Core;
21progressMailSend*SMTPwrapper::sendProgress = 0; 24progressMailSend*SMTPwrapper::sendProgress = 0;
22 25
23SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) 26SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
24 : Generatemail() 27 : Generatemail()
25{ 28{
26 m_SmtpAccount = aSmtp; 29 m_SmtpAccount = aSmtp;
27 Config cfg( "mail" ); 30 KConfig cfg( locateLocal("config", "kopiemail" ) );
28 cfg.setGroup( "Status" ); 31 cfg.setGroup( "Status" );
29 m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); 32 m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
30 emit queuedMails( m_queuedMail ); 33 emit queuedMails( m_queuedMail );
31 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); 34 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
32 m_smtp = 0; 35 m_smtp = 0;
33} 36}
@@ -35,14 +38,16 @@ SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
35SMTPwrapper::~SMTPwrapper() 38SMTPwrapper::~SMTPwrapper()
36{ 39{
37 disc_server(); 40 disc_server();
38} 41}
39 42
40void SMTPwrapper::emitQCop( int queued ) { 43void SMTPwrapper::emitQCop( int queued ) {
44#ifndef DESKTOP_VERSION
41 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
42 env << queued; 46 env << queued;
47#endif
43} 48}
44 49
45QString SMTPwrapper::mailsmtpError( int errnum ) { 50QString SMTPwrapper::mailsmtpError( int errnum ) {
46 switch ( errnum ) { 51 switch ( errnum ) {
47 case MAILSMTP_NO_ERROR: 52 case MAILSMTP_NO_ERROR:
48 return i18n( "No error" ); 53 return i18n( "No error" );
@@ -124,13 +129,13 @@ bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
124 } 129 }
125 msg = 0; 130 msg = 0;
126 if (later) { 131 if (later) {
127 storeMail(data,size,"Outgoing"); 132 storeMail(data,size,"Outgoing");
128 if (data) 133 if (data)
129 free( data ); 134 free( data );
130 Config cfg( "mail" ); 135 KConfig cfg( locateLocal("config", "kopiemail" ) );
131 cfg.setGroup( "Status" ); 136 cfg.setGroup( "Status" );
132 cfg.writeEntry( "outgoing", ++m_queuedMail ); 137 cfg.writeEntry( "outgoing", ++m_queuedMail );
133 emit queuedMails( m_queuedMail ); 138 emit queuedMails( m_queuedMail );
134 return true; 139 return true;
135 } 140 }
136 from = getFrom( mail ); 141 from = getFrom( mail );
@@ -444,13 +449,13 @@ bool SMTPwrapper::flushOutbox() {
444 sendProgress->setCurrentMails(mailsToRemove.count()); 449 sendProgress->setCurrentMails(mailsToRemove.count());
445 } 450 }
446 if (reset_user_value) { 451 if (reset_user_value) {
447 m_SmtpAccount->setUser(oldUser); 452 m_SmtpAccount->setUser(oldUser);
448 m_SmtpAccount->setPassword(oldPw); 453 m_SmtpAccount->setPassword(oldPw);
449 } 454 }
450 Config cfg( "mail" ); 455 KConfig cfg( locateLocal("config", "kopiemail" ) );
451 cfg.setGroup( "Status" ); 456 cfg.setGroup( "Status" );
452 m_queuedMail = 0; 457 m_queuedMail = 0;
453 cfg.writeEntry( "outgoing", m_queuedMail ); 458 cfg.writeEntry( "outgoing", m_queuedMail );
454 emit queuedMails( m_queuedMail ); 459 emit queuedMails( m_queuedMail );
455 sendProgress->hide(); 460 sendProgress->hide();
456 delete sendProgress; 461 delete sendProgress;