summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountview.cpp5
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp12
-rw-r--r--kmicromail/opiemail.cpp5
3 files changed, 15 insertions, 7 deletions
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp
index 3ad3e9b..e9be224 100644
--- a/kmicromail/accountview.cpp
+++ b/kmicromail/accountview.cpp
@@ -100,34 +100,37 @@ void AccountView::refresh(QListViewItem *item)
100} 100}
101void AccountView::refreshOutgoing() 101void AccountView::refreshOutgoing()
102{ 102{
103 m_currentItem = currentItem(); 103 m_currentItem = currentItem();
104 if ( !m_currentItem ) return; 104 if ( !m_currentItem ) return;
105 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 105 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
106 QString bName = view->getFolder()->getDisplayName(); 106 QString bName = view->getFolder()->getDisplayName();
107 if (bName.startsWith("/")&&bName.length()>1) 107 if (bName.startsWith("/")&&bName.length()>1)
108 { 108 {
109 bName.replace(0,1,""); 109 bName.replace(0,1,"");
110 } 110 }
111 int pos = bName.findRev("/"); 111 int pos = bName.findRev("/");
112 if (pos > 0) 112 if (pos > 0)
113 { 113 {
114 bName.replace(0,pos+1,""); 114 bName.replace(0,pos+1,"");
115 } 115 }
116 if ( bName.lower() == "outgoing" ) 116 //qDebug("name *%s* ",bName.lower().latin1() );
117 if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) {
117 refreshCurrent(); 118 refreshCurrent();
119 // qDebug("refresh ");
120 }
118} 121}
119 122
120void AccountView::refreshCurrent() 123void AccountView::refreshCurrent()
121{ 124{
122 m_currentItem = currentItem(); 125 m_currentItem = currentItem();
123 if ( !m_currentItem ) return; 126 if ( !m_currentItem ) return;
124 QValueList<RecMailP> headerlist; 127 QValueList<RecMailP> headerlist;
125 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 128 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
126 view->refresh(headerlist); 129 view->refresh(headerlist);
127 emit refreshMailview(headerlist); 130 emit refreshMailview(headerlist);
128} 131}
129 132
130void AccountView::refreshAll() 133void AccountView::refreshAll()
131{ 134{
132} 135}
133 136
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index 24f4786..5096f67 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -29,34 +29,35 @@ SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
29 m_SmtpAccount = aSmtp; 29 m_SmtpAccount = aSmtp;
30 KConfig cfg( locateLocal("config", "kopiemailrc" ) ); 30 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
31 cfg.setGroup( "Status" ); 31 cfg.setGroup( "Status" );
32 m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); 32 m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
33 emit queuedMails( m_queuedMail ); 33 emit queuedMails( m_queuedMail );
34 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); 34 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
35 m_smtp = 0; 35 m_smtp = 0;
36} 36}
37 37
38SMTPwrapper::~SMTPwrapper() 38SMTPwrapper::~SMTPwrapper()
39{ 39{
40 disc_server(); 40 disc_server();
41} 41}
42 42
43void SMTPwrapper::emitQCop( int queued ) { 43void SMTPwrapper::emitQCop( int queued ) {
44#ifndef DESKTOP_VERSION 44#ifndef DESKTOP_VERSION
45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 45 // LR : not used in kde-pim
46 env << queued; 46 //QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
47 //env << queued;
47#endif 48#endif
48} 49}
49 50
50QString SMTPwrapper::mailsmtpError( int errnum ) { 51QString SMTPwrapper::mailsmtpError( int errnum ) {
51 switch ( errnum ) { 52 switch ( errnum ) {
52 case MAILSMTP_NO_ERROR: 53 case MAILSMTP_NO_ERROR:
53 return i18n( "No error" ); 54 return i18n( "No error" );
54 case MAILSMTP_ERROR_UNEXPECTED_CODE: 55 case MAILSMTP_ERROR_UNEXPECTED_CODE:
55 return i18n( "Unexpected error code" ); 56 return i18n( "Unexpected error code" );
56 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 57 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
57 return i18n( "Service not available" ); 58 return i18n( "Service not available" );
58 case MAILSMTP_ERROR_STREAM: 59 case MAILSMTP_ERROR_STREAM:
59 return i18n( "Stream error" ); 60 return i18n( "Stream error" );
60 case MAILSMTP_ERROR_HOSTNAME: 61 case MAILSMTP_ERROR_HOSTNAME:
61 return i18n( "gethostname() failed" ); 62 return i18n( "gethostname() failed" );
62 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 63 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
@@ -428,43 +429,42 @@ bool SMTPwrapper::flushOutbox() {
428 // ok 429 // ok
429 user = login.getUser().latin1(); 430 user = login.getUser().latin1();
430 pass = login.getPassword().latin1(); 431 pass = login.getPassword().latin1();
431 reset_user_value = true; 432 reset_user_value = true;
432 m_SmtpAccount->setUser(user); 433 m_SmtpAccount->setUser(user);
433 m_SmtpAccount->setPassword(pass); 434 m_SmtpAccount->setPassword(pass);
434 } else { 435 } else {
435 return true; 436 return true;
436 } 437 }
437 } 438 }
438 439
439 440
440 sendProgress = new progressMailSend(); 441 sendProgress = new progressMailSend();
441 sendProgress->show(); 442 sendProgress->show();
442 sendProgress->setMaxMails(mailsToSend.count()); 443 sendProgress->setMaxMails(mailsToSend.count());
443 444
444 while (mailsToSend.count()>0) { 445 while (returnValue && mailsToSend.count()>0) {
445 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { 446 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
446 QMessageBox::critical(0,i18n("Error sending mail"), 447 QMessageBox::critical(0,i18n("Error sending mail"),
447 i18n("Error sending queued mail - breaking")); 448 i18n("Error sending queued mail.\nBreaking."));
448 returnValue = false; 449 returnValue = false;
449 break;
450 } 450 }
451 mailsToRemove.append((*mailsToSend.begin())); 451 mailsToRemove.append((*mailsToSend.begin()));
452 mailsToSend.remove(mailsToSend.begin()); 452 mailsToSend.remove(mailsToSend.begin());
453 sendProgress->setCurrentMails(mailsToRemove.count()); 453 sendProgress->setCurrentMails(mailsToRemove.count());
454 } 454 }
455 if (reset_user_value) { 455 if (reset_user_value) {
456 m_SmtpAccount->setUser(oldUser); 456 m_SmtpAccount->setUser(oldUser);
457 m_SmtpAccount->setPassword(oldPw); 457 m_SmtpAccount->setPassword(oldPw);
458 } 458 }
459 KConfig cfg( locateLocal("config", "kopiemailrc" ) ); 459 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
460 cfg.setGroup( "Status" ); 460 cfg.setGroup( "Status" );
461 m_queuedMail = 0; 461 m_queuedMail = mailsToSend.count();
462 cfg.writeEntry( "outgoing", m_queuedMail ); 462 cfg.writeEntry( "outgoing", m_queuedMail );
463 emit queuedMails( m_queuedMail ); 463 emit queuedMails( m_queuedMail );
464 sendProgress->hide(); 464 sendProgress->hide();
465 delete sendProgress; 465 delete sendProgress;
466 sendProgress = 0; 466 sendProgress = 0;
467 wrap->deleteMails(mbox,mailsToRemove); 467 wrap->deleteMails(mbox,mailsToRemove);
468 delete wrap; 468 delete wrap;
469 return returnValue; 469 return returnValue;
470} 470}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index f68467c..197f7ec 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -130,58 +130,60 @@ void OpieMail::slotwriteMail2(const QString& namemail )
130 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 130 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
131 } 131 }
132 int sub = to.find( ">:"); 132 int sub = to.find( ">:");
133 if ( sub > 0 ) { 133 if ( sub > 0 ) {
134 compose.setTo( to.left(sub+1) ); 134 compose.setTo( to.left(sub+1) );
135 compose.setSubject( to.mid(sub+2) ); 135 compose.setSubject( to.mid(sub+2) );
136 } else 136 } else
137 compose.setTo( to ); 137 compose.setTo( to );
138 } 138 }
139 compose.slotAdjustColumns(); 139 compose.slotAdjustColumns();
140#ifndef DESKTOP_VERSION 140#ifndef DESKTOP_VERSION
141 compose.showMaximized(); 141 compose.showMaximized();
142#endif 142#endif
143 mCurrentComposer = &compose; 143 mCurrentComposer = &compose;
144 compose.exec(); 144 compose.exec();
145 mCurrentComposer = 0; 145 mCurrentComposer = 0;
146 folderView->refreshOutgoing();
146 raise(); 147 raise();
147 //qDebug("retttich "); 148 //qDebug("retttich ");
148} 149}
149void OpieMail::slotwriteMail(const QString&name,const QString&email) 150void OpieMail::slotwriteMail(const QString&name,const QString&email)
150{ 151{
151 // qDebug("OpieMail::slotwriteMail "); 152 // qDebug("OpieMail::slotwriteMail ");
152 ComposeMail compose( settings, this, 0, true ); 153 ComposeMail compose( settings, this, 0, true );
153 if (!email.isEmpty()) 154 if (!email.isEmpty())
154 { 155 {
155 if (!name.isEmpty()) 156 if (!name.isEmpty())
156 { 157 {
157 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 158 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
158 } 159 }
159 else 160 else
160 { 161 {
161 compose.setTo(email); 162 compose.setTo(email);
162 } 163 }
163 } 164 }
164 compose.slotAdjustColumns(); 165 compose.slotAdjustColumns();
165#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
166 compose.showMaximized(); 167 compose.showMaximized();
167#endif 168#endif
168 169
169 mCurrentComposer = &compose; 170 mCurrentComposer = &compose;
170 compose.exec(); 171 compose.exec();
171 mCurrentComposer = 0; 172 mCurrentComposer = 0;
173 folderView->refreshOutgoing();
172 raise(); 174 raise();
173} 175}
174 176
175void OpieMail::slotComposeMail() 177void OpieMail::slotComposeMail()
176{ 178{
177 if ( mPendingEmail == QString::null && mPendingName == QString::null) 179 if ( mPendingEmail == QString::null && mPendingName == QString::null)
178 slotwriteMail2( QString () ); 180 slotwriteMail2( QString () );
179 else { 181 else {
180 if ( mPendingEmail == QString::null ) 182 if ( mPendingEmail == QString::null )
181 slotwriteMail2( mPendingName ); 183 slotwriteMail2( mPendingName );
182 else 184 else
183 slotwriteMail( mPendingName, mPendingEmail ); 185 slotwriteMail( mPendingName, mPendingEmail );
184 } 186 }
185 //slotwriteMail(0l,0l); 187 //slotwriteMail(0l,0l);
186} 188}
187 189
@@ -301,32 +303,33 @@ void OpieMail::replyMail()
301 if (mail->Replyto().isEmpty()) { 303 if (mail->Replyto().isEmpty()) {
302 composer.setTo( mail->getFrom()); 304 composer.setTo( mail->getFrom());
303 } else { 305 } else {
304 composer.setTo( mail->Replyto()); 306 composer.setTo( mail->Replyto());
305 } 307 }
306 composer.setSubject( prefix + mail->getSubject()); 308 composer.setSubject( prefix + mail->getSubject());
307 composer.setMessage( rtext ); 309 composer.setMessage( rtext );
308 composer.setInReplyTo( mail->Msgid()); 310 composer.setInReplyTo( mail->Msgid());
309 composer.setCharset( body->getCharset() ); 311 composer.setCharset( body->getCharset() );
310 312
311 mCurrentComposer = &composer; 313 mCurrentComposer = &composer;
312 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 314 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
313 { 315 {
314 mail->Wrapper()->answeredMail(mail); 316 mail->Wrapper()->answeredMail(mail);
315 } 317 }
316 mCurrentComposer = 0; 318 mCurrentComposer = 0;
319 folderView->refreshOutgoing();
317 delete settings; 320 delete settings;
318 321
319} 322}
320void OpieMail::closeViewMail(ViewMail * vm) 323void OpieMail::closeViewMail(ViewMail * vm)
321{ 324{
322 vm->hide(); 325 vm->hide();
323} 326}
324 327
325void OpieMail::slotDownloadMail( ) 328void OpieMail::slotDownloadMail( )
326{ 329{
327 QListViewItem*item = mailView->currentItem(); 330 QListViewItem*item = mailView->currentItem();
328 if (!item ) { 331 if (!item ) {
329 Global::statusMessage("Error: No item slected!"); 332 Global::statusMessage("Error: No item slected!");
330 return; 333 return;
331 } 334 }
332 RecMailP mail = ((MailListViewItem*)item)->data(); 335 RecMailP mail = ((MailListViewItem*)item)->data();
@@ -636,37 +639,39 @@ void OpieMail::slotMoveCopyAllMail()
636} 639}
637 640
638void OpieMail::reEditMail() 641void OpieMail::reEditMail()
639{ 642{
640 if (!mailView->currentItem()) return; 643 if (!mailView->currentItem()) return;
641 644
642 ComposeMail compose( settings, this, 0, true ); 645 ComposeMail compose( settings, this, 0, true );
643 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 646 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
644 compose.slotAdjustColumns(); 647 compose.slotAdjustColumns();
645#ifndef DESKTOP_VERSION 648#ifndef DESKTOP_VERSION
646 compose.showMaximized(); 649 compose.showMaximized();
647#else 650#else
648 compose.resize(640,480); 651 compose.resize(640,480);
649#endif 652#endif
650 mCurrentComposer = &compose; 653 mCurrentComposer = &compose;
651 compose.exec(); 654 compose.exec();
655 folderView->refreshOutgoing();
652 mCurrentComposer = 0; 656 mCurrentComposer = 0;
653} 657}
654 658
655void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 659void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
656{ 660{
657 661
658 if ( mCurrentComposer ) { 662 if ( mCurrentComposer ) {
659 mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); 663 mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList);
660 } else { 664 } else {
661 ComposeMail compose( settings, this, 0, true ); 665 ComposeMail compose( settings, this, 0, true );
662 compose.slotAdjustColumns(); 666 compose.slotAdjustColumns();
663#ifndef DESKTOP_VERSION 667#ifndef DESKTOP_VERSION
664 compose.showMaximized(); 668 compose.showMaximized();
665#endif 669#endif
666 mCurrentComposer = &compose; 670 mCurrentComposer = &compose;
667 mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); 671 mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList);
668 compose.exec(); 672 compose.exec();
669 mCurrentComposer = 0; 673 mCurrentComposer = 0;
674 folderView->refreshOutgoing();
670 raise(); 675 raise();
671 } 676 }
672} 677}