-rw-r--r-- | kmicromail/accountview.cpp | 18 | ||||
-rw-r--r-- | kmicromail/accountview.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 26 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 2 |
4 files changed, 35 insertions, 12 deletions
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index c9c4a0f..3ad3e9b 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp @@ -85,32 +85,50 @@ void AccountView::populate( QList<Account> list ) (void) new NNTPviewItem( nntp, this ); } } } void AccountView::refresh(QListViewItem *item) { if ( item ) { m_currentItem = item; QValueList<RecMailP> headerlist; AccountViewItem *view = static_cast<AccountViewItem *>(item); view->refresh(headerlist); emit refreshMailview(headerlist); } } +void AccountView::refreshOutgoing() +{ + m_currentItem = currentItem(); + if ( !m_currentItem ) return; + AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); + QString bName = view->getFolder()->getDisplayName(); + if (bName.startsWith("/")&&bName.length()>1) + { + bName.replace(0,1,""); + } + int pos = bName.findRev("/"); + if (pos > 0) + { + bName.replace(0,pos+1,""); + } + if ( bName.lower() == "outgoing" ) + refreshCurrent(); +} void AccountView::refreshCurrent() { m_currentItem = currentItem(); if ( !m_currentItem ) return; QValueList<RecMailP> headerlist; AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); view->refresh(headerlist); emit refreshMailview(headerlist); } void AccountView::refreshAll() { } RecBodyP AccountView::fetchBody(const RecMailP&aMail) diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h index 79ed2e7..e403cb8 100644 --- a/kmicromail/accountview.h +++ b/kmicromail/accountview.h @@ -17,30 +17,31 @@ class AccountView : public QListView { Q_OBJECT public: AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); virtual ~AccountView(); virtual void populate( QList<Account> list ); virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); virtual bool currentisDraft(); QValueList<MHviewItem*> allAccounts() { return mhAccounts;} public slots: virtual void refreshAll(); virtual void refresh(QListViewItem *item); virtual void refreshCurrent(); + virtual void refreshOutgoing(); virtual void slotHold(int, QListViewItem *,const QPoint&,int); virtual void slotContextMenu(int id); void setupFolderselect(Selectstore*sels); signals: void refreshMailview(const QValueList<RecMailP>& ); protected: QListViewItem* m_currentItem; QValueList<IMAPviewItem*> imapAccounts; QValueList<MHviewItem*> mhAccounts; }; #endif diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index f54fe2b..24f4786 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp @@ -146,33 +146,33 @@ bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { } if (from) { free(from); } if (rcpts) smtp_address_list_free( rcpts ); return result; } void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) { if (data) { storeMail(data,size,"Sendfailed"); } if (failuremessage) { QMessageBox::critical(0,i18n("Error sending mail"), - i18n("<center>%1</center>").arg(failuremessage)); + failuremessage); } } int SMTPwrapper::start_smtp_tls() { if (!m_smtp) { return MAILSMTP_ERROR_IN_PROCESSING; } int err = mailesmtp_starttls(m_smtp); if (err != MAILSMTP_NO_ERROR) return err; mailstream_low * low; mailstream_low * new_low; low = mailstream_get_low(m_smtp->stream); if (!low) { return MAILSMTP_ERROR_IN_PROCESSING; } @@ -206,120 +206,124 @@ void SMTPwrapper::connect_server() } else if (m_SmtpAccount->ConnectionType() == 1) { force_tls = true; } int result = 1; port = m_SmtpAccount->getPort().toUInt(); m_smtp = mailsmtp_new( 20, &progress ); if ( m_smtp == NULL ) { /* no failure message cause this happens when problems with memory - than we we can not display any messagebox */ return; } int err = MAILSMTP_NO_ERROR; ; // odebug << "Servername " << server << " at port " << port << "" << oendl; if ( ssl ) { - ; // odebug << "SSL session" << oendl; + qDebug("smtp: ssl_connect "); err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port ); } else { ; // odebug << "No SSL session" << oendl; err = mailsmtp_socket_connect( m_smtp, server.latin1(), port ); } if ( err != MAILSMTP_NO_ERROR ) { - ; // odebug << "Error init connection" << oendl; - failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err)); + qDebug("Error init SMTP connection" ); + failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); result = 0; } + qDebug("SMTP connection inited "); /* switch to tls after init 'cause there it will send the ehlo */ if (result) { err = mailsmtp_init( m_smtp ); if (err != MAILSMTP_NO_ERROR) { result = 0; - failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err)); + qDebug("Error init SMTP connection "); + failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); } } - if (try_tls) { + qDebug("Smpt: Try tls "); err = start_smtp_tls(); if (err != MAILSMTP_NO_ERROR) { try_tls = false; + qDebug("no tls "); } else { err = mailesmtp_ehlo(m_smtp); } } - + //qDebug("mailesmtp_ehlo %d ",err ); if (!try_tls && force_tls) { result = 0; - failuretext = i18n("Error init SMTP tls: %1").arg(mailsmtpError(err)); + failuretext = i18n("Error init SMTP tls:%1").arg(mailsmtpError(err)); } if (result==1 && m_SmtpAccount->getLogin() ) { ; // odebug << "smtp with auth" << oendl; if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { // get'em LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { // ok user = login.getUser(); pass = login.getPassword(); } else { result = 0; - failuretext=i18n("Login aborted - storing mail to localfolder"); + failuretext=i18n("Login aborted - \nstoring mail to localfolder"); } } else { user = m_SmtpAccount->getUser(); pass = m_SmtpAccount->getPassword(); } ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl; if (result) { err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() ); if ( err == MAILSMTP_NO_ERROR ) { - ; // odebug << "auth ok" << oendl; + qDebug("Smtp authentification ok "); } else { failuretext = i18n("Authentification failed"); result = 0; } } } } void SMTPwrapper::disc_server() { if (m_smtp) { mailsmtp_quit( m_smtp ); mailsmtp_free( m_smtp ); m_smtp = 0; } } int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) { int err,result; QString failuretext = ""; connect_server(); result = 1; if (m_smtp) { err = mailsmtp_send( m_smtp, from, rcpts, data, size ); if ( err != MAILSMTP_NO_ERROR ) { - failuretext=i18n("Error sending mail: %1").arg(mailsmtpError(err)); + qDebug("Error sending mail"); + failuretext=i18n("Error sending mail:\n%1").arg(mailsmtpError(err)); result = 0; } } else { result = 0; } if (!result) { storeFailedMail(data,size,failuretext); } else { ; // odebug << "Mail sent." << oendl; storeMail(data,size,"Sent"); } return result; } bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index e159b73..f68467c 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -223,33 +223,33 @@ void OpieMail::slotSendQueued() if ( selsmtp.exec() == QDialog::Accepted ) { smtp = selsmtp.selected_smtp(); } } if (smtp) { Global::statusMessage("Sending mails...!"); SMTPwrapper * wrap = new SMTPwrapper(smtp); if ( wrap->flushOutbox() ) { Global::statusMessage("Mails sent!"); } delete wrap; } - // pending refresh list view, if outgoing is displayed + folderView->refreshOutgoing(); } void OpieMail::slotSearchMails() { qDebug("OpieMail::slotSearchMails():not implemented "); } void OpieMail::slotEditSettings() { KOPrefsDialog settingsDialog( this, "koprefs", true ); #ifndef DESKTOP_VERSION settingsDialog.showMaximized(); #endif settingsDialog.exec(); |