-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,16 +1,16 @@ | |||
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 | ||
12 | #include "koprefs.h" | 12 | #include "koprefs.h" |
13 | 13 | ||
14 | #ifdef MINIKDE_KDIALOG_H | 14 | #ifdef MINIKDE_KDIALOG_H |
15 | #undef MINIKDE_KDIALOG_H | 15 | #undef MINIKDE_KDIALOG_H |
16 | #endif | 16 | #endif |
@@ -43,17 +43,19 @@ | |||
43 | #include <qtabwidget.h> | 43 | #include <qtabwidget.h> |
44 | #include <qlistview.h> | 44 | #include <qlistview.h> |
45 | 45 | ||
46 | //using namespace Opie::Core; | 46 | //using namespace Opie::Core; |
47 | //using namespace Opie::Ui; | 47 | //using namespace Opie::Ui; |
48 | ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) | 48 | ComposeMail::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; |
55 | m_replyid = ""; | 57 | m_replyid = ""; |
56 | if ( KOPrefs::instance()->mUseKapi) { | 58 | if ( KOPrefs::instance()->mUseKapi) { |
57 | KConfig config( locateLocal("config", "kabcrc") ); | 59 | KConfig config( locateLocal("config", "kabcrc") ); |
58 | config.setGroup( "General" ); | 60 | config.setGroup( "General" ); |
59 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 61 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
@@ -160,35 +162,35 @@ void ComposeMail::fillSettings() | |||
160 | senderNameEdit->setText(KOPrefs::instance()->mName); | 162 | senderNameEdit->setText(KOPrefs::instance()->mName); |
161 | } | 163 | } |
162 | 164 | ||
163 | 165 | ||
164 | void ComposeMail::saveAsDraft() | 166 | 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); |
190 | 192 | ||
191 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 193 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
192 | /* attachments we will ignore! */ | 194 | /* attachments we will ignore! */ |
193 | if ( it != 0 ) { | 195 | if ( it != 0 ) { |
194 | if ( warnAttach ) | 196 | if ( warnAttach ) |
@@ -403,42 +405,43 @@ void ComposeMail::accept() | |||
403 | } | 405 | } |
404 | #if 0 | 406 | #if 0 |
405 | odebug << "Sending Mail with " | 407 | odebug << "Sending Mail with " |
406 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 408 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
407 | #endif | 409 | #endif |
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() ); |
440 | it = (AttachViewItem *) it->nextSibling(); | 443 | it = (AttachViewItem *) it->nextSibling(); |
441 | } | 444 | } |
442 | 445 | ||
443 | SMTPwrapper wrapper( smtp ); | 446 | SMTPwrapper wrapper( smtp ); |
444 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 447 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
@@ -471,29 +474,38 @@ void ComposeMail::reject() | |||
471 | } | 474 | } |
472 | if (yesno == 2) { | 475 | if (yesno == 2) { |
473 | qDebug("return "); | 476 | qDebug("return "); |
474 | return; | 477 | return; |
475 | } | 478 | } |
476 | QDialog::reject(); | 479 | QDialog::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 | { |
481 | } | 490 | } |
482 | 491 | ||
483 | void ComposeMail::reEditMail(const RecMailP¤t) | 492 | 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(",")); |
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 | ||
494 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 506 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
495 | : QListViewItem( parent ) | 507 | : QListViewItem( parent ) |
496 | { | 508 | { |
497 | attachment = att; | 509 | attachment = att; |
498 | if ( !attachment->getPixmap().isNull() ) | 510 | if ( !attachment->getPixmap().isNull() ) |
499 | setPixmap( 0,attachment->getPixmap() ); | 511 | setPixmap( 0,attachment->getPixmap() ); |
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index 0fc41fb..a7fa41c 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h | |||
@@ -43,16 +43,17 @@ public: | |||
43 | public slots: | 43 | public slots: |
44 | void slotAdjustColumns(); | 44 | void slotAdjustColumns(); |
45 | 45 | ||
46 | void setTo( const QString & to ); | 46 | void setTo( const QString & to ); |
47 | void setSubject( const QString & subject ); | 47 | void setSubject( const QString & subject ); |
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 | ||
53 | protected slots: | 54 | protected slots: |
54 | void accept(); | 55 | void accept(); |
55 | void reject(); | 56 | void reject(); |
56 | 57 | ||
57 | private slots: | 58 | private slots: |
58 | void fillValues( int current ); | 59 | void fillValues( int current ); |
@@ -69,16 +70,17 @@ private slots: | |||
69 | void setStatus( QString ); | 70 | void setStatus( QString ); |
70 | 71 | ||
71 | protected: | 72 | protected: |
72 | QLineEdit* mPickLineEdit; | 73 | QLineEdit* mPickLineEdit; |
73 | Opie::Core::OSmartPointer<Mail> mMail; | 74 | Opie::Core::OSmartPointer<Mail> mMail; |
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 | ||
80 | class AttachViewItem : public QListViewItem | 82 | class AttachViewItem : public QListViewItem |
81 | { | 83 | { |
82 | public: | 84 | public: |
83 | AttachViewItem( QListView *parent, Attachment *att ); | 85 | AttachViewItem( QListView *parent, Attachment *att ); |
84 | Attachment *getAttachment() { return attachment; } | 86 | Attachment *getAttachment() { return attachment; } |
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 | |||
@@ -221,16 +221,17 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
221 | b = QString(res->Content()); | 221 | b = QString(res->Content()); |
222 | delete res; | 222 | delete res; |
223 | size_t index = 0; | 223 | size_t index = 0; |
224 | char*resu = 0; | 224 | char*resu = 0; |
225 | int err = MAILIMF_NO_ERROR; | 225 | int err = MAILIMF_NO_ERROR; |
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)) { |
232 | //qDebug("res %d %s ", index, resu); | 233 | //qDebug("res %d %s ", index, resu); |
233 | b = QString::fromUtf8(resu); | 234 | b = QString::fromUtf8(resu); |
234 | } | 235 | } |
235 | if (resu) free(resu); | 236 | if (resu) free(resu); |
236 | } | 237 | } |
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 | |||
@@ -45,17 +45,17 @@ int IMAPwrapper::selectMbox(const QString&mbox) | |||
45 | return err; | 45 | return err; |
46 | } | 46 | } |
47 | 47 | ||
48 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | 48 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) |
49 | { | 49 | { |
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; |
57 | } | 57 | } |
58 | void IMAPwrapper::progress( QString m ) | 58 | void IMAPwrapper::progress( QString m ) |
59 | { | 59 | { |
60 | 60 | ||
61 | static QString mProgrMess; | 61 | static QString mProgrMess; |
@@ -284,20 +284,20 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
284 | 284 | ||
285 | if ( err == MAILIMAP_NO_ERROR ) { | 285 | if ( err == MAILIMAP_NO_ERROR ) { |
286 | tryAgain = -1; | 286 | tryAgain = -1; |
287 | mailimap_msg_att * msg_att; | 287 | mailimap_msg_att * msg_att; |
288 | int i = 0; | 288 | int i = 0; |
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); |
299 | target.append(m); | 299 | target.append(m); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count())); | 303 | Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count())); |
@@ -410,17 +410,17 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
410 | 410 | ||
411 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 411 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
412 | { | 412 | { |
413 | RecMail * m = 0; | 413 | RecMail * m = 0; |
414 | mailimap_msg_att_item *item=0; | 414 | mailimap_msg_att_item *item=0; |
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 | ||
422 | if (!m_att) { | 422 | if (!m_att) { |
423 | return m; | 423 | return m; |
424 | } | 424 | } |
425 | m = new RecMail(); | 425 | m = new RecMail(); |
426 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { | 426 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { |
@@ -756,16 +756,17 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
756 | size_t index = 0; | 756 | size_t index = 0; |
757 | char*res = 0; | 757 | char*res = 0; |
758 | int err = MAILIMF_NO_ERROR; | 758 | int err = MAILIMF_NO_ERROR; |
759 | 759 | ||
760 | QString charset = currentPart->searchParamter( "charset"); | 760 | QString charset = currentPart->searchParamter( "charset"); |
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(), |
767 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); | 768 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); |
768 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | 769 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { |
769 | //qDebug("res %d %s ", index, res); | 770 | //qDebug("res %d %s ", index, res); |
770 | body_text = QString::fromUtf8(res); | 771 | body_text = QString::fromUtf8(res); |
771 | } | 772 | } |
@@ -1177,17 +1178,17 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) | |||
1177 | } | 1178 | } |
1178 | 1179 | ||
1179 | int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) | 1180 | int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) |
1180 | { | 1181 | { |
1181 | if (folder.length()==0) return 0; | 1182 | if (folder.length()==0) return 0; |
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) { |
1189 | pre += parentfolder->getDisplayName()+delemiter; | 1190 | pre += parentfolder->getDisplayName()+delemiter; |
1190 | } | 1191 | } |
1191 | pre+=folder; | 1192 | pre+=folder; |
1192 | if (getsubfolder) { | 1193 | if (getsubfolder) { |
1193 | if (delemiter.length()>0) { | 1194 | if (delemiter.length()>0) { |
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 | |||
@@ -282,16 +282,17 @@ RecBody::RecBody() | |||
282 | } | 282 | } |
283 | 283 | ||
284 | RecBody::RecBody(const RecBody&old) | 284 | RecBody::RecBody(const RecBody&old) |
285 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | 285 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) |
286 | { | 286 | { |
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 | ||
293 | RecBody::~RecBody() | 294 | RecBody::~RecBody() |
294 | { | 295 | { |
295 | } | 296 | } |
296 | 297 | ||
297 | void RecBody::setBodytext(const QString&bodyText) | 298 | void RecBody::setBodytext(const QString&bodyText) |
@@ -325,16 +326,26 @@ void RecBody::setDescription(const RecPartP&des) | |||
325 | m_description = des; | 326 | m_description = des; |
326 | } | 327 | } |
327 | 328 | ||
328 | const RecPartP& RecBody::Description()const | 329 | const RecPartP& RecBody::Description()const |
329 | { | 330 | { |
330 | return m_description; | 331 | return m_description; |
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() |
335 | { | 346 | { |
336 | init(); | 347 | init(); |
337 | } | 348 | } |
338 | 349 | ||
339 | encodedString::encodedString(const char*nContent,unsigned int nSize) | 350 | encodedString::encodedString(const char*nContent,unsigned int nSize) |
340 | { | 351 | { |
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 | |||
@@ -128,25 +128,28 @@ public: | |||
128 | }; | 128 | }; |
129 | 129 | ||
130 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; | 130 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; |
131 | 131 | ||
132 | class RecBody:public Opie::Core::ORefCount | 132 | class RecBody:public Opie::Core::ORefCount |
133 | { | 133 | { |
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; |
138 | 139 | ||
139 | public: | 140 | public: |
140 | RecBody(); | 141 | RecBody(); |
141 | RecBody(const RecBody&old); | 142 | RecBody(const RecBody&old); |
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; |
148 | 151 | ||
149 | void setParts(const QValueList<RecPartP>&parts); | 152 | void setParts(const QValueList<RecPartP>&parts); |
150 | const QValueList<RecPartP>& Parts()const; | 153 | const QValueList<RecPartP>& Parts()const; |
151 | void addPart(const RecPartP&part); | 154 | void addPart(const RecPartP&part); |
152 | }; | 155 | }; |
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 | |||
@@ -77,19 +77,22 @@ public: | |||
77 | void setMessage( const QString&s ) { message = s; } | 77 | void setMessage( const QString&s ) { message = s; } |
78 | const QString&getSubject()const { return subject; } | 78 | const QString&getSubject()const { return subject; } |
79 | void setSubject( const QString&s ) { subject = s; } | 79 | void setSubject( const QString&s ) { subject = s; } |
80 | const QString&getReply()const{ return reply; } | 80 | const QString&getReply()const{ return reply; } |
81 | void setReply( const QString&a ) { reply = a; } | 81 | void setReply( const QString&a ) { reply = a; } |
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 | |||
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 | }; |
90 | 93 | ||
91 | class Folder:public Opie::Core::ORefCount | 94 | class Folder:public Opie::Core::ORefCount |
92 | { | 95 | { |
93 | public: | 96 | public: |
94 | Folder( const QString&init_name,const QString&sep ); | 97 | Folder( const QString&init_name,const QString&sep ); |
95 | virtual ~Folder(); | 98 | virtual ~Folder(); |
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 | |||
@@ -2,16 +2,17 @@ | |||
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | #include "settings.h" | 3 | #include "settings.h" |
4 | #include "abstractmail.h" | 4 | #include "abstractmail.h" |
5 | 5 | ||
6 | #include <libetpan/libetpan.h> | 6 | #include <libetpan/libetpan.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
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; |
12 | Storemail::Storemail(Account*aAccount,const QString&aFolder) | 13 | Storemail::Storemail(Account*aAccount,const QString&aFolder) |
13 | : Generatemail() | 14 | : Generatemail() |
14 | { | 15 | { |
15 | wrapper = 0; | 16 | wrapper = 0; |
16 | m_Account = aAccount; | 17 | m_Account = aAccount; |
17 | m_tfolder = aFolder; | 18 | m_tfolder = aFolder; |
@@ -60,18 +61,25 @@ int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) | |||
60 | qDebug("storeMail: error creating mime mail "); | 61 | qDebug("storeMail: error creating mime mail "); |
61 | return 0; | 62 | return 0; |
62 | } | 63 | } |
63 | char *data; | 64 | char *data; |
64 | size_t size; | 65 | size_t size; |
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); |
73 | msg = 0; | 81 | msg = 0; |
74 | if (r != MAIL_NO_ERROR || !data) { | 82 | if (r != MAIL_NO_ERROR || !data) { |
75 | qDebug("Error fetching mime... "); | 83 | qDebug("Error fetching mime... "); |
76 | ret = 0; | 84 | ret = 0; |
77 | } | 85 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 18a5600..c20c7ce 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -286,17 +286,17 @@ void OpieMail::replyMail() | |||
286 | if (mail->Replyto().isEmpty()) { | 286 | if (mail->Replyto().isEmpty()) { |
287 | composer.setTo( mail->getFrom()); | 287 | composer.setTo( mail->getFrom()); |
288 | } else { | 288 | } else { |
289 | composer.setTo( mail->Replyto()); | 289 | composer.setTo( mail->Replyto()); |
290 | } | 290 | } |
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); |
298 | } | 298 | } |
299 | delete settings; | 299 | delete settings; |
300 | 300 | ||
301 | } | 301 | } |
302 | void OpieMail::displayMail() | 302 | void OpieMail::displayMail() |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 4883231..3bd6f41 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -452,16 +452,17 @@ void ViewMail::slotReply() | |||
452 | if (m_recMail->Replyto().isEmpty()) { | 452 | if (m_recMail->Replyto().isEmpty()) { |
453 | composer.setTo(m_recMail->getFrom()); | 453 | composer.setTo(m_recMail->getFrom()); |
454 | } else { | 454 | } else { |
455 | composer.setTo(m_recMail->Replyto()); | 455 | composer.setTo(m_recMail->Replyto()); |
456 | } | 456 | } |
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 | { |
463 | m_recMail->Wrapper()->answeredMail(m_recMail); | 464 | m_recMail->Wrapper()->answeredMail(m_recMail); |
464 | } | 465 | } |
465 | delete settings; | 466 | delete settings; |
466 | } | 467 | } |
467 | 468 | ||