author | zautrix <zautrix> | 2004-11-07 10:11:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-07 10:11:25 (UTC) |
commit | b6ef669713ee1d52adcfc9754dd039a4ff6675da (patch) (unidiff) | |
tree | eac59d1b135cbf87e0b9aca21213115331995203 /kmicromail | |
parent | dcb3a171bca38934185de67e378956e6fd044f17 (diff) | |
download | kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.zip kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.tar.gz kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.tar.bz2 |
encoding fixes
-rw-r--r-- | kmicromail/composemail.cpp | 58 | ||||
-rw-r--r-- | kmicromail/composemail.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 11 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 11 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.h | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/storemail.cpp | 12 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 2 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 1 |
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,10 +1,10 @@ | |||
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> |
@@ -49,5 +49,7 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo | |||
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&))); |
@@ -166,11 +168,11 @@ void ComposeMail::saveAsDraft() | |||
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; |
@@ -178,5 +180,5 @@ void ComposeMail::saveAsDraft() | |||
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" ); |
@@ -184,5 +186,5 @@ void ComposeMail::saveAsDraft() | |||
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()); |
@@ -409,8 +411,8 @@ void ComposeMail::accept() | |||
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"), |
@@ -419,20 +421,21 @@ void ComposeMail::accept() | |||
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 ) { |
@@ -477,4 +480,10 @@ void ComposeMail::reject() | |||
477 | } | 480 | } |
478 | 481 | ||
482 | void ComposeMail::setCharset(const QString& charset) | ||
483 | { | ||
484 | if ( !charset.isEmpty() ) | ||
485 | mEncoding = charset; | ||
486 | qDebug("ComposeMail::setCharset %s ", mEncoding.latin1()); | ||
487 | } | ||
479 | ComposeMail::~ComposeMail() | 488 | ComposeMail::~ComposeMail() |
480 | { | 489 | { |
@@ -484,5 +493,7 @@ void ComposeMail::reEditMail(const RecMailP¤t) | |||
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(",")); |
@@ -490,4 +501,5 @@ void ComposeMail::reEditMail(const RecMailP¤t) | |||
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 | ||
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index 0fc41fb..a7fa41c 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h | |||
@@ -49,4 +49,5 @@ public slots: | |||
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 | ||
@@ -75,4 +76,5 @@ protected: | |||
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 | }; |
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 | |||
@@ -227,4 +227,5 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
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); |
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 | |||
@@ -51,5 +51,5 @@ void IMAPwrapper::imap_progress( size_t current, size_t 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(); |
@@ -290,8 +290,8 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
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); |
@@ -416,5 +416,5 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
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; |
@@ -762,4 +762,5 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
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); |
@@ -1183,5 +1184,5 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons | |||
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 | } |
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 | |||
@@ -288,4 +288,5 @@ RecBody::RecBody(const RecBody&old) | |||
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 | } |
@@ -331,4 +332,14 @@ const RecPartP& RecBody::Description()const | |||
331 | } | 332 | } |
332 | 333 | ||
334 | void RecBody::setCharset(const QString& str) | ||
335 | { | ||
336 | mCharset = str; | ||
337 | } | ||
338 | |||
339 | QString RecBody::getCharset()const | ||
340 | { | ||
341 | return mCharset; | ||
342 | } | ||
343 | |||
333 | /* handling encoded content */ | 344 | /* handling encoded content */ |
334 | encodedString::encodedString() | 345 | encodedString::encodedString() |
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 | |||
@@ -134,4 +134,5 @@ class RecBody:public Opie::Core::ORefCount | |||
134 | protected: | 134 | protected: |
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; |
@@ -143,4 +144,6 @@ public: | |||
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); |
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 | |||
@@ -83,7 +83,10 @@ public: | |||
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 | |||
85 | private: | 88 | private: |
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 | }; |
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 | |||
@@ -8,4 +8,5 @@ | |||
8 | 8 | ||
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
10 | #include <kglobal.h> | ||
10 | 11 | ||
11 | using namespace Opie::Core; | 12 | using namespace Opie::Core; |
@@ -66,6 +67,13 @@ int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) | |||
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); |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 18a5600..c20c7ce 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -292,5 +292,5 @@ void OpieMail::replyMail() | |||
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 | { |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 4883231..3bd6f41 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -458,4 +458,5 @@ void ViewMail::slotReply() | |||
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 ) ) |