summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp58
-rw-r--r--kmicromail/composemail.h2
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp1
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp11
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp11
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h3
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h5
-rw-r--r--kmicromail/libmailwrapper/storemail.cpp12
-rw-r--r--kmicromail/opiemail.cpp2
-rw-r--r--kmicromail/viewmail.cpp1
10 files changed, 74 insertions, 32 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index f44100b..49fd14f 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,11 +1,11 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3#include <kabc/addresseedialog.h> 3
4#include <kabc/stdaddressbook.h>
5#include <kabc/addressee.h>
6#ifdef DESKTOP_VERSION 4#ifdef DESKTOP_VERSION
7#include <qapplication.h> 5#include <qapplication.h>
8#include <kabc/addresseedialog.h> 6#include <kabc/addresseedialog.h>
7#include <kabc/stdaddressbook.h>
8#include <kabc/addressee.h>
9#endif //DESKTOP_VERSION 9#endif //DESKTOP_VERSION
10#include <libkdepim/externalapphandler.h> 10#include <libkdepim/externalapphandler.h>
11 11
@@ -48,7 +48,9 @@
48ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) 48ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal )
49 : ComposeMailUI( parent, name, modal ) 49 : ComposeMailUI( parent, name, modal )
50{ 50{
51
51 mPickLineEdit = 0; 52 mPickLineEdit = 0;
53 mEncoding = KOPrefs::instance()->mCurrentCodeName;
52 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 54 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
53 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 55 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
54 settings = sett; 56 settings = sett;
@@ -165,25 +167,25 @@ void ComposeMail::saveAsDraft()
165{ 167{
166 168
167 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 169 Opie::Core::OSmartPointer<Mail> mail= new Mail();
168 mail->setMail(fromBox->currentText().utf8 ()); 170 mail->setMail(fromBox->currentText());
169 mail->setTo( toLine->text().utf8 () ); 171 mail->setTo( toLine->text() );
170 mail->setName(senderNameEdit->text().utf8 ()); 172 mail->setName(senderNameEdit->text());
171 mail->setCC( ccLine->text().utf8 () ); 173 mail->setCC( ccLine->text() );
172 mail->setBCC( bccLine->text().utf8 () ); 174 mail->setBCC( bccLine->text() );
173 mail->setReply( replyLine->text().utf8 () ); 175 mail->setReply( replyLine->text() );
174 mail->setSubject( subjectLine->text().utf8 () ); 176 mail->setSubject( subjectLine->text() );
175 if (!m_replyid.isEmpty()) { 177 if (!m_replyid.isEmpty()) {
176 QStringList ids; 178 QStringList ids;
177 ids.append(m_replyid); 179 ids.append(m_replyid);
178 mail->setInreply(ids); 180 mail->setInreply(ids);
179 } 181 }
180 QString txt = message->text().utf8 (); 182 QString txt = message->text();
181 if ( !sigMultiLine->text().isEmpty() ) { 183 if ( !sigMultiLine->text().isEmpty() ) {
182 txt.append( "\n--\n" ); 184 txt.append( "\n--\n" );
183 txt.append( sigMultiLine->text() ); 185 txt.append( sigMultiLine->text() );
184 } 186 }
185 mail->setMessage( txt ); 187 mail->setMessage( txt );
186 188 mail->setCharset (mEncoding);
187 /* only use the default drafts folder name! */ 189 /* only use the default drafts folder name! */
188 Storemail wrapper(AbstractMail::draftFolder()); 190 Storemail wrapper(AbstractMail::draftFolder());
189 wrapper.storeMail(mail); 191 wrapper.storeMail(mail);
@@ -408,32 +410,33 @@ void ComposeMail::accept()
408 Opie::Core::OSmartPointer<Mail> mail=new Mail; 410 Opie::Core::OSmartPointer<Mail> mail=new Mail;
409 411
410 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 412 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
411 mail->setMail(fromBox->currentText().utf8 ()); 413 mail->setMail(fromBox->currentText());
412 414
413 if ( !toLine->text().isEmpty() ) { 415 if ( !toLine->text().isEmpty() ) {
414 mail->setTo( toLine->text().utf8 () ); 416 mail->setTo( toLine->text() );
415 } else { 417 } else {
416 QMessageBox::warning(0,i18n("Sending mail"), 418 QMessageBox::warning(0,i18n("Sending mail"),
417 i18n("No Receiver spezified" ) ); 419 i18n("No Receiver spezified" ) );
418 return; 420 return;
419 } 421 }
420 422
421 mail->setName(senderNameEdit->text().utf8 ()); 423 mail->setName(senderNameEdit->text());
422 mail->setCC( ccLine->text().utf8 () ); 424 mail->setCC( ccLine->text() );
423 mail->setBCC( bccLine->text().utf8 () ); 425 mail->setBCC( bccLine->text() );
424 mail->setReply( replyLine->text().utf8 () ); 426 mail->setReply( replyLine->text() );
425 mail->setSubject( subjectLine->text().utf8 () ); 427 mail->setSubject( subjectLine->text() );
426 if (!m_replyid.isEmpty()) { 428 if (!m_replyid.isEmpty()) {
427 QStringList ids; 429 QStringList ids;
428 ids.append(m_replyid.utf8 ()); 430 ids.append(m_replyid);
429 mail->setInreply(ids); 431 mail->setInreply(ids);
430 } 432 }
431 QString txt = message->text().utf8 (); 433 QString txt = message->text();
432 if ( !sigMultiLine->text().isEmpty() ) { 434 if ( !sigMultiLine->text().isEmpty() ) {
433 txt.append( "\n--\n" ); 435 txt.append( "\n--\n" );
434 txt.append( sigMultiLine->text().utf8 () ); 436 txt.append( sigMultiLine->text() );
435 } 437 }
436 mail->setMessage( txt ); 438 mail->setMessage( txt );
439 mail->setCharset (mEncoding);
437 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 440 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
438 while ( it != 0 ) { 441 while ( it != 0 ) {
439 mail->addAttachment( it->getAttachment() ); 442 mail->addAttachment( it->getAttachment() );
@@ -476,6 +479,12 @@ void ComposeMail::reject()
476 QDialog::reject(); 479 QDialog::reject();
477} 480}
478 481
482void ComposeMail::setCharset(const QString& charset)
483{
484 if ( !charset.isEmpty() )
485 mEncoding = charset;
486 qDebug("ComposeMail::setCharset %s ", mEncoding.latin1());
487}
479ComposeMail::~ComposeMail() 488ComposeMail::~ComposeMail()
480{ 489{
481} 490}
@@ -483,12 +492,15 @@ ComposeMail::~ComposeMail()
483void ComposeMail::reEditMail(const RecMailP&current) 492void ComposeMail::reEditMail(const RecMailP&current)
484{ 493{
485 RecMailP data = current; 494 RecMailP data = current;
486 message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); 495 RecBodyP body = data->Wrapper()->fetchBody(current);
496
497 message->setText(body->Bodytext());
487 subjectLine->setText( data->getSubject()); 498 subjectLine->setText( data->getSubject());
488 toLine->setText(data->To().join(",")); 499 toLine->setText(data->To().join(","));
489 ccLine->setText(data->CC().join(",")); 500 ccLine->setText(data->CC().join(","));
490 bccLine->setText(data->Bcc().join(",")); 501 bccLine->setText(data->Bcc().join(","));
491 replyLine->setText(data->Replyto()); 502 replyLine->setText(data->Replyto());
503 setCharset(body->getCharset());
492} 504}
493 505
494AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 506AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h
index 0fc41fb..a7fa41c 100644
--- a/kmicromail/composemail.h
+++ b/kmicromail/composemail.h
@@ -48,6 +48,7 @@ public slots:
48 void setInReplyTo( const QString & messageId ); 48 void setInReplyTo( const QString & messageId );
49 void setMessage( const QString & text ); 49 void setMessage( const QString & text );
50 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); 50 void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
51 void setCharset(const QString&);
51 52
52 53
53protected slots: 54protected slots:
@@ -74,6 +75,7 @@ protected:
74 Settings *settings; 75 Settings *settings;
75 QList<SMTPaccount> smtpAccounts; 76 QList<SMTPaccount> smtpAccounts;
76 QString m_replyid; 77 QString m_replyid;
78 QString mEncoding;
77 bool warnAttach; 79 bool warnAttach;
78}; 80};
79 81
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index 49227dd..28d45ce 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -226,6 +226,7 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
226 QString charset = part->searchParamter( "charset"); 226 QString charset = part->searchParamter( "charset");
227 qDebug("CHARSET %s ",charset.latin1() ); 227 qDebug("CHARSET %s ",charset.latin1() );
228 if ( !charset.isEmpty() ) { 228 if ( !charset.isEmpty() ) {
229 target->setCharset( charset );
229 err = mailmime_encoded_phrase_parse(charset.latin1(), 230 err = mailmime_encoded_phrase_parse(charset.latin1(),
230 b.latin1(), b.length(),&index, "utf-8",&resu); 231 b.latin1(), b.length(),&index, "utf-8",&resu);
231 if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { 232 if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) {
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index eb2b47d..2a54381 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -50,7 +50,7 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum )
50 //qDebug("imap progress %d of %d ",current,maximum ); 50 //qDebug("imap progress %d of %d ",current,maximum );
51 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum)); 51 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum));
52 //qApp->processEvents() 52 //qApp->processEvents()
53 static int last = 0; 53 static unsigned int last = 0;
54 if ( last != current ) 54 if ( last != current )
55 IMAPwrapper::progress(); 55 IMAPwrapper::progress();
56 last = current; 56 last = current;
@@ -289,10 +289,10 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
289 for (current = clist_begin(result); current != 0; current=clist_next(current)) { 289 for (current = clist_begin(result); current != 0; current=clist_next(current)) {
290 ++i; 290 ++i;
291 //qDebug("iii %d ",i); 291 //qDebug("iii %d ",i);
292 msg_att = (mailimap_msg_att*)current->data; 292 msg_att = (mailimap_msg_att*)current->data;
293 RecMail*m = parse_list_result(msg_att); 293 RecMail*m = parse_list_result(msg_att);
294 if (m) { 294 if (m) {
295 if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) { 295 if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) {
296 m->setNumber(i); 296 m->setNumber(i);
297 m->setMbox(mailbox); 297 m->setMbox(mailbox);
298 m->setWrapper(this); 298 m->setWrapper(this);
@@ -415,7 +415,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
415 clistcell *current,*c,*cf; 415 clistcell *current,*c,*cf;
416 mailimap_msg_att_dynamic*flist; 416 mailimap_msg_att_dynamic*flist;
417 mailimap_flag_fetch*cflag; 417 mailimap_flag_fetch*cflag;
418 int size; 418 int size = 0;
419 QBitArray mFlags(7); 419 QBitArray mFlags(7);
420 QStringList addresslist; 420 QStringList addresslist;
421 421
@@ -761,6 +761,7 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
761 qDebug("CHARSET %s ",charset.latin1() ); 761 qDebug("CHARSET %s ",charset.latin1() );
762 //if ( false ) { 762 //if ( false ) {
763 if ( !charset.isEmpty() ) { 763 if ( !charset.isEmpty() ) {
764 target_body->setCharset( charset );
764 //err = mailmime_encoded_phrase_parse("iso-8859-1", 765 //err = mailmime_encoded_phrase_parse("iso-8859-1",
765 // text, strlen(text),&index, "iso-8859-1",&res); 766 // text, strlen(text),&index, "iso-8859-1",&res);
766 err = mailmime_encoded_phrase_parse(charset.latin1(), 767 err = mailmime_encoded_phrase_parse(charset.latin1(),
@@ -1182,7 +1183,7 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons
1182 login(); 1183 login();
1183 if (!m_imap) {return 0;} 1184 if (!m_imap) {return 0;}
1184 QString pre = account->getPrefix(); 1185 QString pre = account->getPrefix();
1185 if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { 1186 if (delemiter.length()>0 && pre.findRev(delemiter)!=((int)pre.length())-1) {
1186 pre+=delemiter; 1187 pre+=delemiter;
1187 } 1188 }
1188 if (parentfolder) { 1189 if (parentfolder) {
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp
index af3b9d0..89150ad 100644
--- a/kmicromail/libmailwrapper/mailtypes.cpp
+++ b/kmicromail/libmailwrapper/mailtypes.cpp
@@ -287,6 +287,7 @@ RecBody::RecBody(const RecBody&old)
287 m_BodyText = old.m_BodyText; 287 m_BodyText = old.m_BodyText;
288 m_PartsList = old.m_PartsList; 288 m_PartsList = old.m_PartsList;
289 m_description = old.m_description; 289 m_description = old.m_description;
290 mCharset = old.mCharset;
290 // odebug << "Recbody copy constructor" << oendl; 291 // odebug << "Recbody copy constructor" << oendl;
291} 292}
292 293
@@ -330,6 +331,16 @@ const RecPartP& RecBody::Description()const
330 return m_description; 331 return m_description;
331} 332}
332 333
334void RecBody::setCharset(const QString& str)
335{
336 mCharset = str;
337}
338
339QString RecBody::getCharset()const
340{
341 return mCharset;
342}
343
333/* handling encoded content */ 344/* handling encoded content */
334encodedString::encodedString() 345encodedString::encodedString()
335{ 346{
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index c1c1a74..32d92c0 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -133,6 +133,7 @@ class RecBody:public Opie::Core::ORefCount
133{ 133{
134protected: 134protected:
135 QString m_BodyText; 135 QString m_BodyText;
136 QString mCharset;
136 QValueList<RecPartP> m_PartsList; 137 QValueList<RecPartP> m_PartsList;
137 RecPartP m_description; 138 RecPartP m_description;
138 139
@@ -142,6 +143,8 @@ public:
142 virtual ~RecBody(); 143 virtual ~RecBody();
143 void setBodytext(const QString&); 144 void setBodytext(const QString&);
144 const QString& Bodytext()const; 145 const QString& Bodytext()const;
146 void setCharset(const QString&);
147 QString getCharset()const;
145 148
146 void setDescription(const RecPartP&des); 149 void setDescription(const RecPartP&des);
147 const RecPartP& Description()const; 150 const RecPartP& Description()const;
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h
index 88f10da..ea6bf36 100644
--- a/kmicromail/libmailwrapper/mailwrapper.h
+++ b/kmicromail/libmailwrapper/mailwrapper.h
@@ -82,9 +82,12 @@ public:
82 void setInreply(const QStringList&list){m_in_reply_to = list;} 82 void setInreply(const QStringList&list){m_in_reply_to = list;}
83 const QStringList&Inreply()const{return m_in_reply_to;} 83 const QStringList&Inreply()const{return m_in_reply_to;}
84 84
85 void setCharset( const QString&a ) { charset= a; }
86 const QString& getCharset() { return charset; }
87
85private: 88private:
86 QList<Attachment> attList; 89 QList<Attachment> attList;
87 QString name, mail, to, cc, bcc, reply, subject, message; 90 QString name, mail, to, cc, bcc, reply, subject, message, charset;
88 QStringList m_in_reply_to; 91 QStringList m_in_reply_to;
89}; 92};
90 93
diff --git a/kmicromail/libmailwrapper/storemail.cpp b/kmicromail/libmailwrapper/storemail.cpp
index ed1d44a..9d1735f 100644
--- a/kmicromail/libmailwrapper/storemail.cpp
+++ b/kmicromail/libmailwrapper/storemail.cpp
@@ -7,6 +7,7 @@
7#include <qstring.h> 7#include <qstring.h>
8 8
9#include <stdlib.h> 9#include <stdlib.h>
10#include <kglobal.h>
10 11
11using namespace Opie::Core; 12using namespace Opie::Core;
12Storemail::Storemail(Account*aAccount,const QString&aFolder) 13Storemail::Storemail(Account*aAccount,const QString&aFolder)
@@ -65,8 +66,15 @@ int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail)
65 data = 0; 66 data = 0;
66 67
67 mailmessage * msg = 0; 68 mailmessage * msg = 0;
68 msg = mime_message_init(mimeMail); 69 msg = mime_message_init(mimeMail);
69 mime_message_set_tmpdir(msg,getenv( "HOME" )); 70 QString fileName;
71#ifdef DESKTOP_VERSION
72 fileName = locateLocal("tmp", "");
73#else
74 fileName = "/tmp/";
75#endif
76 //mime_message_set_tmpdir(msg,getenv( "HOME" ));
77 mime_message_set_tmpdir(msg,(char*)fileName.latin1());
70 int r = mailmessage_fetch(msg,&data,&size); 78 int r = mailmessage_fetch(msg,&data,&size);
71 mime_message_detach_mime(msg); 79 mime_message_detach_mime(msg);
72 mailmessage_free(msg); 80 mailmessage_free(msg);
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 18a5600..c20c7ce 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -291,7 +291,7 @@ void OpieMail::replyMail()
291 composer.setSubject( prefix + mail->getSubject()); 291 composer.setSubject( prefix + mail->getSubject());
292 composer.setMessage( rtext ); 292 composer.setMessage( rtext );
293 composer.setInReplyTo( mail->Msgid()); 293 composer.setInReplyTo( mail->Msgid());
294 294 composer.setCharset( body->getCharset() );
295 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 295 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
296 { 296 {
297 mail->Wrapper()->answeredMail(mail); 297 mail->Wrapper()->answeredMail(mail);
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 4883231..3bd6f41 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -457,6 +457,7 @@ void ViewMail::slotReply()
457 composer.setSubject( prefix + m_mail[1] ); 457 composer.setSubject( prefix + m_mail[1] );
458 composer.setMessage( rtext ); 458 composer.setMessage( rtext );
459 composer.setInReplyTo(m_recMail->Msgid()); 459 composer.setInReplyTo(m_recMail->Msgid());
460 composer.setCharset( m_body->getCharset() );
460 461
461 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 462 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
462 { 463 {