summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountview.cpp18
-rw-r--r--kmicromail/accountview.h1
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp26
-rw-r--r--kmicromail/opiemail.cpp2
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
@@ -89,24 +89,42 @@ void AccountView::populate( QList<Account> list )
89 89
90void AccountView::refresh(QListViewItem *item) 90void AccountView::refresh(QListViewItem *item)
91{ 91{
92 if ( item ) 92 if ( item )
93 { 93 {
94 m_currentItem = item; 94 m_currentItem = item;
95 QValueList<RecMailP> headerlist; 95 QValueList<RecMailP> headerlist;
96 AccountViewItem *view = static_cast<AccountViewItem *>(item); 96 AccountViewItem *view = static_cast<AccountViewItem *>(item);
97 view->refresh(headerlist); 97 view->refresh(headerlist);
98 emit refreshMailview(headerlist); 98 emit refreshMailview(headerlist);
99 } 99 }
100} 100}
101void AccountView::refreshOutgoing()
102{
103 m_currentItem = currentItem();
104 if ( !m_currentItem ) return;
105 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
106 QString bName = view->getFolder()->getDisplayName();
107 if (bName.startsWith("/")&&bName.length()>1)
108 {
109 bName.replace(0,1,"");
110 }
111 int pos = bName.findRev("/");
112 if (pos > 0)
113 {
114 bName.replace(0,pos+1,"");
115 }
116 if ( bName.lower() == "outgoing" )
117 refreshCurrent();
118}
101 119
102void AccountView::refreshCurrent() 120void AccountView::refreshCurrent()
103{ 121{
104 m_currentItem = currentItem(); 122 m_currentItem = currentItem();
105 if ( !m_currentItem ) return; 123 if ( !m_currentItem ) return;
106 QValueList<RecMailP> headerlist; 124 QValueList<RecMailP> headerlist;
107 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 125 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
108 view->refresh(headerlist); 126 view->refresh(headerlist);
109 emit refreshMailview(headerlist); 127 emit refreshMailview(headerlist);
110} 128}
111 129
112void AccountView::refreshAll() 130void AccountView::refreshAll()
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h
index 79ed2e7..e403cb8 100644
--- a/kmicromail/accountview.h
+++ b/kmicromail/accountview.h
@@ -21,24 +21,25 @@ public:
21 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 21 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
22 virtual ~AccountView(); 22 virtual ~AccountView();
23 virtual void populate( QList<Account> list ); 23 virtual void populate( QList<Account> list );
24 virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); 24 virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail);
25 virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); 25 virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
26 virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); 26 virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
27 virtual bool currentisDraft(); 27 virtual bool currentisDraft();
28 QValueList<MHviewItem*> allAccounts() { return mhAccounts;} 28 QValueList<MHviewItem*> allAccounts() { return mhAccounts;}
29public slots: 29public slots:
30 virtual void refreshAll(); 30 virtual void refreshAll();
31 virtual void refresh(QListViewItem *item); 31 virtual void refresh(QListViewItem *item);
32 virtual void refreshCurrent(); 32 virtual void refreshCurrent();
33 virtual void refreshOutgoing();
33 virtual void slotHold(int, QListViewItem *,const QPoint&,int); 34 virtual void slotHold(int, QListViewItem *,const QPoint&,int);
34 virtual void slotContextMenu(int id); 35 virtual void slotContextMenu(int id);
35 void setupFolderselect(Selectstore*sels); 36 void setupFolderselect(Selectstore*sels);
36 37
37signals: 38signals:
38 void refreshMailview(const QValueList<RecMailP>& ); 39 void refreshMailview(const QValueList<RecMailP>& );
39 40
40protected: 41protected:
41 QListViewItem* m_currentItem; 42 QListViewItem* m_currentItem;
42 QValueList<IMAPviewItem*> imapAccounts; 43 QValueList<IMAPviewItem*> imapAccounts;
43 QValueList<MHviewItem*> mhAccounts; 44 QValueList<MHviewItem*> mhAccounts;
44}; 45};
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
@@ -150,25 +150,25 @@ bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
150 if (rcpts) 150 if (rcpts)
151 smtp_address_list_free( rcpts ); 151 smtp_address_list_free( rcpts );
152 return result; 152 return result;
153} 153}
154 154
155void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) 155void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
156{ 156{
157 if (data) { 157 if (data) {
158 storeMail(data,size,"Sendfailed"); 158 storeMail(data,size,"Sendfailed");
159 } 159 }
160 if (failuremessage) { 160 if (failuremessage) {
161 QMessageBox::critical(0,i18n("Error sending mail"), 161 QMessageBox::critical(0,i18n("Error sending mail"),
162 i18n("<center>%1</center>").arg(failuremessage)); 162 failuremessage);
163 } 163 }
164} 164}
165 165
166int SMTPwrapper::start_smtp_tls() 166int SMTPwrapper::start_smtp_tls()
167{ 167{
168 if (!m_smtp) { 168 if (!m_smtp) {
169 return MAILSMTP_ERROR_IN_PROCESSING; 169 return MAILSMTP_ERROR_IN_PROCESSING;
170 } 170 }
171 int err = mailesmtp_starttls(m_smtp); 171 int err = mailesmtp_starttls(m_smtp);
172 if (err != MAILSMTP_NO_ERROR) return err; 172 if (err != MAILSMTP_NO_ERROR) return err;
173 mailstream_low * low; 173 mailstream_low * low;
174 mailstream_low * new_low; 174 mailstream_low * new_low;
@@ -210,83 +210,86 @@ void SMTPwrapper::connect_server()
210 port = m_SmtpAccount->getPort().toUInt(); 210 port = m_SmtpAccount->getPort().toUInt();
211 211
212 m_smtp = mailsmtp_new( 20, &progress ); 212 m_smtp = mailsmtp_new( 20, &progress );
213 if ( m_smtp == NULL ) { 213 if ( m_smtp == NULL ) {
214 /* no failure message cause this happens when problems with memory - than we 214 /* no failure message cause this happens when problems with memory - than we
215 we can not display any messagebox */ 215 we can not display any messagebox */
216 return; 216 return;
217 } 217 }
218 218
219 int err = MAILSMTP_NO_ERROR; 219 int err = MAILSMTP_NO_ERROR;
220 ; // odebug << "Servername " << server << " at port " << port << "" << oendl; 220 ; // odebug << "Servername " << server << " at port " << port << "" << oendl;
221 if ( ssl ) { 221 if ( ssl ) {
222 ; // odebug << "SSL session" << oendl; 222 qDebug("smtp: ssl_connect ");
223 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port ); 223 err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port );
224 } else { 224 } else {
225 ; // odebug << "No SSL session" << oendl; 225 ; // odebug << "No SSL session" << oendl;
226 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port ); 226 err = mailsmtp_socket_connect( m_smtp, server.latin1(), port );
227 } 227 }
228 if ( err != MAILSMTP_NO_ERROR ) { 228 if ( err != MAILSMTP_NO_ERROR ) {
229 ; // odebug << "Error init connection" << oendl; 229 qDebug("Error init SMTP connection" );
230 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err)); 230 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err));
231 result = 0; 231 result = 0;
232 } 232 }
233 233
234 qDebug("SMTP connection inited ");
234 /* switch to tls after init 'cause there it will send the ehlo */ 235 /* switch to tls after init 'cause there it will send the ehlo */
235 if (result) { 236 if (result) {
236 err = mailsmtp_init( m_smtp ); 237 err = mailsmtp_init( m_smtp );
237 if (err != MAILSMTP_NO_ERROR) { 238 if (err != MAILSMTP_NO_ERROR) {
238 result = 0; 239 result = 0;
239 failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err)); 240 qDebug("Error init SMTP connection ");
241 failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err));
240 } 242 }
241 } 243 }
242
243 if (try_tls) { 244 if (try_tls) {
245 qDebug("Smpt: Try tls ");
244 err = start_smtp_tls(); 246 err = start_smtp_tls();
245 if (err != MAILSMTP_NO_ERROR) { 247 if (err != MAILSMTP_NO_ERROR) {
246 try_tls = false; 248 try_tls = false;
249 qDebug("no tls ");
247 } else { 250 } else {
248 err = mailesmtp_ehlo(m_smtp); 251 err = mailesmtp_ehlo(m_smtp);
249 } 252 }
250 } 253 }
251 254 //qDebug("mailesmtp_ehlo %d ",err );
252 if (!try_tls && force_tls) { 255 if (!try_tls && force_tls) {
253 result = 0; 256 result = 0;
254 failuretext = i18n("Error init SMTP tls: %1").arg(mailsmtpError(err)); 257 failuretext = i18n("Error init SMTP tls:%1").arg(mailsmtpError(err));
255 } 258 }
256 259
257 if (result==1 && m_SmtpAccount->getLogin() ) { 260 if (result==1 && m_SmtpAccount->getLogin() ) {
258 ; // odebug << "smtp with auth" << oendl; 261 ; // odebug << "smtp with auth" << oendl;
259 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { 262 if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
260 // get'em 263 // get'em
261 LoginDialog login( m_SmtpAccount->getUser(), 264 LoginDialog login( m_SmtpAccount->getUser(),
262 m_SmtpAccount->getPassword(), NULL, 0, true ); 265 m_SmtpAccount->getPassword(), NULL, 0, true );
263 login.show(); 266 login.show();
264 if ( QDialog::Accepted == login.exec() ) { 267 if ( QDialog::Accepted == login.exec() ) {
265 // ok 268 // ok
266 user = login.getUser(); 269 user = login.getUser();
267 pass = login.getPassword(); 270 pass = login.getPassword();
268 } else { 271 } else {
269 result = 0; 272 result = 0;
270 failuretext=i18n("Login aborted - storing mail to localfolder"); 273 failuretext=i18n("Login aborted - \nstoring mail to localfolder");
271 } 274 }
272 } else { 275 } else {
273 user = m_SmtpAccount->getUser(); 276 user = m_SmtpAccount->getUser();
274 pass = m_SmtpAccount->getPassword(); 277 pass = m_SmtpAccount->getPassword();
275 } 278 }
276 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl; 279 ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl;
277 if (result) { 280 if (result) {
278 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() ); 281 err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() );
279 if ( err == MAILSMTP_NO_ERROR ) { 282 if ( err == MAILSMTP_NO_ERROR ) {
280 ; // odebug << "auth ok" << oendl; 283 qDebug("Smtp authentification ok ");
281 } else { 284 } else {
282 failuretext = i18n("Authentification failed"); 285 failuretext = i18n("Authentification failed");
283 result = 0; 286 result = 0;
284 } 287 }
285 } 288 }
286 } 289 }
287} 290}
288 291
289void SMTPwrapper::disc_server() 292void SMTPwrapper::disc_server()
290{ 293{
291 if (m_smtp) { 294 if (m_smtp) {
292 mailsmtp_quit( m_smtp ); 295 mailsmtp_quit( m_smtp );
@@ -297,25 +300,26 @@ void SMTPwrapper::disc_server()
297 300
298int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) 301int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
299{ 302{
300 int err,result; 303 int err,result;
301 QString failuretext = ""; 304 QString failuretext = "";
302 305
303 connect_server(); 306 connect_server();
304 307
305 result = 1; 308 result = 1;
306 if (m_smtp) { 309 if (m_smtp) {
307 err = mailsmtp_send( m_smtp, from, rcpts, data, size ); 310 err = mailsmtp_send( m_smtp, from, rcpts, data, size );
308 if ( err != MAILSMTP_NO_ERROR ) { 311 if ( err != MAILSMTP_NO_ERROR ) {
309 failuretext=i18n("Error sending mail: %1").arg(mailsmtpError(err)); 312 qDebug("Error sending mail");
313 failuretext=i18n("Error sending mail:\n%1").arg(mailsmtpError(err));
310 result = 0; 314 result = 0;
311 } 315 }
312 } else { 316 } else {
313 result = 0; 317 result = 0;
314 } 318 }
315 319
316 if (!result) { 320 if (!result) {
317 storeFailedMail(data,size,failuretext); 321 storeFailedMail(data,size,failuretext);
318 } else { 322 } else {
319 ; // odebug << "Mail sent." << oendl; 323 ; // odebug << "Mail sent." << oendl;
320 storeMail(data,size,"Sent"); 324 storeMail(data,size,"Sent");
321 } 325 }
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index e159b73..f68467c 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -227,25 +227,25 @@ void OpieMail::slotSendQueued()
227 } 227 }
228 if (smtp) 228 if (smtp)
229 { 229 {
230 230
231 Global::statusMessage("Sending mails...!"); 231 Global::statusMessage("Sending mails...!");
232 SMTPwrapper * wrap = new SMTPwrapper(smtp); 232 SMTPwrapper * wrap = new SMTPwrapper(smtp);
233 if ( wrap->flushOutbox() ) 233 if ( wrap->flushOutbox() )
234 { 234 {
235 Global::statusMessage("Mails sent!"); 235 Global::statusMessage("Mails sent!");
236 } 236 }
237 delete wrap; 237 delete wrap;
238 } 238 }
239 // pending refresh list view, if outgoing is displayed 239 folderView->refreshOutgoing();
240} 240}
241 241
242void OpieMail::slotSearchMails() 242void OpieMail::slotSearchMails()
243{ 243{
244 qDebug("OpieMail::slotSearchMails():not implemented "); 244 qDebug("OpieMail::slotSearchMails():not implemented ");
245} 245}
246 246
247void OpieMail::slotEditSettings() 247void OpieMail::slotEditSettings()
248{ 248{
249 249
250 KOPrefsDialog settingsDialog( this, "koprefs", true ); 250 KOPrefsDialog settingsDialog( this, "koprefs", true );
251#ifndef DESKTOP_VERSION 251#ifndef DESKTOP_VERSION