-rw-r--r-- | noncore/net/mail/accountview.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 1 |
5 files changed, 15 insertions, 6 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 2ce89db..77fa706 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -1,15 +1,15 @@ -#include <stdlib.h> #include "accountview.h" #include <libmailwrapper/mailtypes.h> +#include <libmailwrapper/abstractmail.h> #include "defines.h" #include "newmaildir.h" #include <qmessagebox.h> #include <qpopupmenu.h> /** * POP3 Account stuff */ POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) : AccountViewItem( parent ) { account = a; @@ -437,26 +437,25 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) QPopupMenu*m = view->getContextMenu(); if (!m) return; connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); m->setFocus(); m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); delete m; } void AccountView::populate( QList<Account> list ) { clear(); - QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); - (void) new MBOXviewItem(localfolders,this); + (void) new MBOXviewItem(AbstractMail::defaultLocalfolder(),this); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType().compare( "IMAP" ) == 0 ) { IMAPaccount *imap = static_cast<IMAPaccount *>(it); qDebug( "added IMAP " + imap->getAccountName() ); (void) new IMAPviewItem( imap, this ); } else if ( it->getType().compare( "POP3" ) == 0 ) { POP3account *pop3 = static_cast<POP3account *>(it); qDebug( "added POP3 " + pop3->getAccountName() ); (void) new POP3viewItem( pop3, this ); } diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index f303d72..80d0b52 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp @@ -83,12 +83,19 @@ QString AbstractMail::gen_attachment_id() if (!file.open(IO_ReadOnly ) ) return QString::null; QTextStream stream(&file); return "{" + stream.read().stripWhiteSpace() + "}"; } int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) { return 0; } + +QString AbstractMail::defaultLocalfolder() +{ + QString f = getenv( "HOME" ); + f += "/Applications/opiemail/localmail"; + return f; +} diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index dab9e10..ca9caed 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h @@ -36,18 +36,20 @@ public: /* mail box methods */ /* parameter is the box to create. * if the implementing subclass has prefixes, * them has to be appended automatic. */ virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); static AbstractMail* getWrapper(IMAPaccount *a); static AbstractMail* getWrapper(POP3account *a); /* mbox only! */ static AbstractMail* getWrapper(const QString&a); + static QString defaultLocalfolder(); + protected: static encodedString*decode_String(const encodedString*text,const QString&enc); static QString convert_String(const char*text); static QString gen_attachment_id(); }; #endif diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index b9c4ff2..e054365 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -11,25 +11,25 @@ #include <qpe/qcopenvelope_qws.h> #include <libetpan/libetpan.h> #include "smtpwrapper.h" #include "mailwrapper.h" #include "mboxwrapper.h" #include "logindialog.h" #include "mailtypes.h" //#include "defines.h" #include "sendmailprogress.h" -#define USER_AGENT "OpieMail v0.1" +const char* SMTPwrapper::USER_AGENT="OpieMail v0.3"; progressMailSend*SMTPwrapper::sendProgress = 0; SMTPwrapper::SMTPwrapper( Settings *s ) : QObject() { settings = s; Config cfg( "mail" ); cfg.setGroup( "Status" ); m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); emit queuedMails( m_queuedMail ); connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); @@ -479,25 +479,25 @@ char *SMTPwrapper::getFrom( mailmime *mail ) void SMTPwrapper::progress( size_t current, size_t maximum ) { if (SMTPwrapper::sendProgress) { SMTPwrapper::sendProgress->setSingleMail(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/"); + QString localfolders = AbstractMail::defaultLocalfolder(); MBOXwrapper*wrap = new MBOXwrapper(localfolders); wrap->storeMessage(mail,length,box); delete wrap; } void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) { clist *rcpts = 0; char *from, *data; size_t size; if ( smtp == NULL ) { @@ -680,25 +680,25 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) smtp_address_list_free( rcpts ); } return res; } /* this is a special fun */ bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { bool returnValue = true; if (!smtp) return false; - QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); + QString localfolders = AbstractMail::defaultLocalfolder(); MBOXwrapper*wrap = new MBOXwrapper(localfolders); if (!wrap) { qDebug("memory error"); return false; } QList<RecMail> mailsToSend; QList<RecMail> mailsToRemove; QString mbox("Outgoing"); wrap->listMessages(mbox,mailsToSend); if (mailsToSend.count()==0) { delete wrap; return false; diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 05becf2..4a4352f 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h @@ -53,19 +53,20 @@ protected: static void addRcpts( clist *list, mailimf_address_list *addr_list ); static char *getFrom( mailmime *mail ); static char *getFrom( mailimf_field *ffrom); static mailimf_field *getField( mailimf_fields *fields, int type ); int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ); void storeMail(mailmime*mail, const QString&box); Settings *settings; int sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which); int m_queuedMail; + static const char* USER_AGENT; protected slots: void emitQCop( int queued ); }; #endif |