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 | |
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,24 +1,24 @@ | |||
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 |
17 | 17 | ||
18 | 18 | ||
19 | #include "composemail.h" | 19 | #include "composemail.h" |
20 | 20 | ||
21 | #include <libmailwrapper/smtpwrapper.h> | 21 | #include <libmailwrapper/smtpwrapper.h> |
22 | #include <libmailwrapper/storemail.h> | 22 | #include <libmailwrapper/storemail.h> |
23 | #include <libmailwrapper/abstractmail.h> | 23 | #include <libmailwrapper/abstractmail.h> |
24 | #include <libmailwrapper/mailtypes.h> | 24 | #include <libmailwrapper/mailtypes.h> |
@@ -35,33 +35,35 @@ | |||
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
37 | #include <qiconset.h> | 37 | #include <qiconset.h> |
38 | #include <qtimer.h> | 38 | #include <qtimer.h> |
39 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
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" ); |
60 | 62 | ||
61 | if ( whoami_uid.isEmpty() ) { | 63 | if ( whoami_uid.isEmpty() ) { |
62 | QMessageBox::information( 0, i18n( "Hint" ), | 64 | QMessageBox::information( 0, i18n( "Hint" ), |
63 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 65 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
64 | i18n( "Ok" ) ); | 66 | i18n( "Ok" ) ); |
65 | 67 | ||
66 | 68 | ||
67 | fillSettings(); | 69 | fillSettings(); |
@@ -152,51 +154,51 @@ void ComposeMail::fillSettings() | |||
152 | if ( QApplication::desktop()->width() < 320 ) | 154 | if ( QApplication::desktop()->width() < 320 ) |
153 | fromBox->setMaximumWidth( 100 ); | 155 | fromBox->setMaximumWidth( 100 ); |
154 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); | 156 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); |
155 | QStringList::ConstIterator sit = mailList.begin(); | 157 | QStringList::ConstIterator sit = mailList.begin(); |
156 | int pref = 0; | 158 | int pref = 0; |
157 | for (;sit!=mailList.end();++sit) { | 159 | for (;sit!=mailList.end();++sit) { |
158 | fromBox->insertItem((*sit)); | 160 | fromBox->insertItem((*sit)); |
159 | } | 161 | } |
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 ) |
195 | QMessageBox::warning(0,i18n("Store message"), | 197 | QMessageBox::warning(0,i18n("Store message"), |
196 | i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 198 | i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
197 | warnAttach = false; | 199 | warnAttach = false; |
198 | } | 200 | } |
199 | setStatus( i18n("Mail saved as draft!") ); | 201 | setStatus( i18n("Mail saved as draft!") ); |
200 | } | 202 | } |
201 | void ComposeMail::clearStatus() | 203 | void ComposeMail::clearStatus() |
202 | { | 204 | { |
@@ -395,58 +397,59 @@ void ComposeMail::accept() | |||
395 | int yesno = QMessageBox::warning(0,i18n("Stop editing message"), | 397 | int yesno = QMessageBox::warning(0,i18n("Stop editing message"), |
396 | i18n("Send this message?"), | 398 | i18n("Send this message?"), |
397 | i18n("Yes"), | 399 | i18n("Yes"), |
398 | i18n("Cancel")); | 400 | i18n("Cancel")); |
399 | 401 | ||
400 | if (yesno == 1) { | 402 | if (yesno == 1) { |
401 | return; | 403 | return; |
402 | } | 404 | } |
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() ) ) |
445 | setStatus( tr ("Mail sent")); | 448 | setStatus( tr ("Mail sent")); |
446 | else { | 449 | else { |
447 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 450 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
448 | return; | 451 | return; |
449 | } | 452 | } |
450 | 453 | ||
451 | 454 | ||
452 | QDialog::accept(); | 455 | QDialog::accept(); |
@@ -463,41 +466,50 @@ void ComposeMail::reject() | |||
463 | //qDebug("button %d ", yesno); | 466 | //qDebug("button %d ", yesno); |
464 | if (yesno == 0) { | 467 | if (yesno == 0) { |
465 | if ( toLine->text().isEmpty() ) { | 468 | if ( toLine->text().isEmpty() ) { |
466 | QMessageBox::warning(0,i18n("Sending mail"), | 469 | QMessageBox::warning(0,i18n("Sending mail"), |
467 | i18n("No Receiver spezified" ) ); | 470 | i18n("No Receiver spezified" ) ); |
468 | return; | 471 | return; |
469 | } | 472 | } |
470 | saveAsDraft(); | 473 | saveAsDraft(); |
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() ); |
500 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 512 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
501 | setText( 1, QString::number( att->getSize() ) ); | 513 | setText( 1, QString::number( att->getSize() ) ); |
502 | } | 514 | } |
503 | 515 | ||
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index 0fc41fb..a7fa41c 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h | |||
@@ -35,57 +35,59 @@ class ComposeMail : public ComposeMailUI | |||
35 | 35 | ||
36 | public: | 36 | public: |
37 | 37 | ||
38 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false ); | 38 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false ); |
39 | virtual ~ComposeMail(); | 39 | virtual ~ComposeMail(); |
40 | 40 | ||
41 | void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); | 41 | void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); |
42 | 42 | ||
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 ); |
59 | void fillSettings(); | 60 | void fillSettings(); |
60 | void pickAddress(); | 61 | void pickAddress(); |
61 | void pickAddressTo(); | 62 | void pickAddressTo(); |
62 | void pickAddressCC(); | 63 | void pickAddressCC(); |
63 | void pickAddressBCC(); | 64 | void pickAddressBCC(); |
64 | void pickAddressReply(); | 65 | void pickAddressReply(); |
65 | void saveAsDraft(); | 66 | void saveAsDraft(); |
66 | void addAttachment(); | 67 | void addAttachment(); |
67 | void removeAttachment(); | 68 | void removeAttachment(); |
68 | void clearStatus(); | 69 | void clearStatus(); |
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; } |
85 | 87 | ||
86 | private: | 88 | private: |
87 | Attachment *attachment; | 89 | Attachment *attachment; |
88 | 90 | ||
89 | }; | 91 | }; |
90 | 92 | ||
91 | #endif | 93 | #endif |
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 | |||
@@ -213,32 +213,33 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
213 | rs->setContent(data,len); | 213 | rs->setContent(data,len); |
214 | encodedString*res = decode_String(rs,part->Encoding()); | 214 | encodedString*res = decode_String(rs,part->Encoding()); |
215 | if (countlist.count()>2) { | 215 | if (countlist.count()>2) { |
216 | bodyCache[b]=rs; | 216 | bodyCache[b]=rs; |
217 | target->addPart(part); | 217 | target->addPart(part); |
218 | } else { | 218 | } else { |
219 | delete rs; | 219 | delete rs; |
220 | } | 220 | } |
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 | } |
237 | target->setBodytext(b); | 238 | target->setBodytext(b); |
238 | target->setDescription(part); | 239 | target->setDescription(part); |
239 | } else { | 240 | } else { |
240 | bodyCache[b]=new encodedString(data,len); | 241 | bodyCache[b]=new encodedString(data,len); |
241 | target->addPart(part); | 242 | target->addPart(part); |
242 | } | 243 | } |
243 | } | 244 | } |
244 | break; | 245 | break; |
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 | |||
@@ -37,33 +37,33 @@ int IMAPwrapper::selectMbox(const QString&mbox) | |||
37 | return MAILIMAP_NO_ERROR; | 37 | return MAILIMAP_NO_ERROR; |
38 | } | 38 | } |
39 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); | 39 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); |
40 | if ( err != MAILIMAP_NO_ERROR ) { | 40 | if ( err != MAILIMAP_NO_ERROR ) { |
41 | m_Lastmbox = ""; | 41 | m_Lastmbox = ""; |
42 | return err; | 42 | return err; |
43 | } | 43 | } |
44 | m_Lastmbox = mbox; | 44 | m_Lastmbox = 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; |
62 | if ( m != QString::null ) { | 62 | if ( m != QString::null ) { |
63 | mProgrMess = m; | 63 | mProgrMess = m; |
64 | mCurrent = 1; | 64 | mCurrent = 1; |
65 | return; | 65 | return; |
66 | } | 66 | } |
67 | QString mess; | 67 | QString mess; |
68 | //qDebug("progress "); | 68 | //qDebug("progress "); |
69 | if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax); | 69 | if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax); |
@@ -276,36 +276,36 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma | |||
276 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); | 276 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); |
277 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); | 277 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); |
278 | 278 | ||
279 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 279 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
280 | mailimap_set_free( set ); | 280 | mailimap_set_free( set ); |
281 | mailimap_fetch_type_free( fetchType ); | 281 | mailimap_fetch_type_free( fetchType ); |
282 | 282 | ||
283 | QString date,subject,from; | 283 | QString date,subject,from; |
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())); |
304 | } else { | 304 | } else { |
305 | --tryAgain; | 305 | --tryAgain; |
306 | --tryAgain;//disabled tryagain by adding this line | 306 | --tryAgain;//disabled tryagain by adding this line |
307 | if ( tryAgain < 0 ) | 307 | if ( tryAgain < 0 ) |
308 | Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response)); | 308 | Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response)); |
309 | else | 309 | else |
310 | qDebug("try again... "); | 310 | qDebug("try again... "); |
311 | } | 311 | } |
@@ -402,33 +402,33 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
402 | } | 402 | } |
403 | } else { | 403 | } else { |
404 | qDebug("error fetching folders "); | 404 | qDebug("error fetching folders "); |
405 | 405 | ||
406 | } | 406 | } |
407 | if (result) mailimap_list_result_free( result ); | 407 | if (result) mailimap_list_result_free( result ); |
408 | return folders; | 408 | return folders; |
409 | } | 409 | } |
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) ) { |
427 | current = c; | 427 | current = c; |
428 | size = 0; | 428 | size = 0; |
429 | item = (mailimap_msg_att_item*)current->data; | 429 | item = (mailimap_msg_att_item*)current->data; |
430 | if ( !item ) | 430 | if ( !item ) |
431 | continue; | 431 | continue; |
432 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { | 432 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { |
433 | flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; | 433 | flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; |
434 | if (!flist || !flist->att_list) { | 434 | if (!flist || !flist->att_list) { |
@@ -748,32 +748,33 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
748 | //odebug << "ID = " << id.latin1() << "" << oendl; | 748 | //odebug << "ID = " << id.latin1() << "" << oendl; |
749 | currentPart->setIdentifier(id); | 749 | currentPart->setIdentifier(id); |
750 | fillSinglePart(currentPart,part1); | 750 | fillSinglePart(currentPart,part1); |
751 | /* important: Check for is NULL 'cause a body can be empty! | 751 | /* important: Check for is NULL 'cause a body can be empty! |
752 | And we put it only into the mail if it is the FIRST part */ | 752 | And we put it only into the mail if it is the FIRST part */ |
753 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { | 753 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { |
754 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); | 754 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); |
755 | 755 | ||
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 | } |
772 | if (res) free(res); | 773 | if (res) free(res); |
773 | } | 774 | } |
774 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); | 775 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); |
775 | target_body->setDescription(currentPart); | 776 | target_body->setDescription(currentPart); |
776 | target_body->setBodytext(body_text); | 777 | target_body->setBodytext(body_text); |
777 | if (countlist.count()>1) { | 778 | if (countlist.count()>1) { |
778 | target_body->addPart(currentPart); | 779 | target_body->addPart(currentPart); |
779 | } | 780 | } |
@@ -1169,33 +1170,33 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) | |||
1169 | /* should we realy do that at this moment? */ | 1170 | /* should we realy do that at this moment? */ |
1170 | err = mailimap_expunge(m_imap); | 1171 | err = mailimap_expunge(m_imap); |
1171 | if (err != MAILIMAP_NO_ERROR) { | 1172 | if (err != MAILIMAP_NO_ERROR) { |
1172 | Global::statusMessage(i18n("error deleting mail: %s").arg(m_imap->imap_response)); | 1173 | Global::statusMessage(i18n("error deleting mail: %s").arg(m_imap->imap_response)); |
1173 | return 0; | 1174 | return 0; |
1174 | } | 1175 | } |
1175 | // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; | 1176 | // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; |
1176 | return 1; | 1177 | return 1; |
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) { |
1194 | pre+=delemiter; | 1195 | pre+=delemiter; |
1195 | } else { | 1196 | } else { |
1196 | Global::statusMessage(i18n("Cannot create folder %1 for holding subfolders").arg(pre)); | 1197 | Global::statusMessage(i18n("Cannot create folder %1 for holding subfolders").arg(pre)); |
1197 | return 0; | 1198 | return 0; |
1198 | } | 1199 | } |
1199 | } | 1200 | } |
1200 | // odebug << "Creating " << pre.latin1() << "" << oendl; | 1201 | // odebug << "Creating " << pre.latin1() << "" << oendl; |
1201 | int res = mailimap_create(m_imap,pre.latin1()); | 1202 | int res = mailimap_create(m_imap,pre.latin1()); |
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 | |||
@@ -274,32 +274,33 @@ const QValueList<int>& RecPart::Positionlist()const | |||
274 | { | 274 | { |
275 | return m_poslist; | 275 | return m_poslist; |
276 | } | 276 | } |
277 | 277 | ||
278 | RecBody::RecBody() | 278 | RecBody::RecBody() |
279 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) | 279 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) |
280 | { | 280 | { |
281 | m_PartsList.clear(); | 281 | m_PartsList.clear(); |
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) |
298 | { | 299 | { |
299 | m_BodyText = bodyText; | 300 | m_BodyText = bodyText; |
300 | } | 301 | } |
301 | 302 | ||
302 | const QString& RecBody::Bodytext()const | 303 | const QString& RecBody::Bodytext()const |
303 | { | 304 | { |
304 | return m_BodyText; | 305 | return m_BodyText; |
305 | } | 306 | } |
@@ -317,32 +318,42 @@ const QValueList<RecPartP>& RecBody::Parts()const | |||
317 | 318 | ||
318 | void RecBody::addPart(const RecPartP& part) | 319 | void RecBody::addPart(const RecPartP& part) |
319 | { | 320 | { |
320 | m_PartsList.append(part); | 321 | m_PartsList.append(part); |
321 | } | 322 | } |
322 | 323 | ||
323 | void RecBody::setDescription(const RecPartP&des) | 324 | void RecBody::setDescription(const RecPartP&des) |
324 | { | 325 | { |
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 | { |
341 | init(); | 352 | init(); |
342 | setContent(nContent,nSize); | 353 | setContent(nContent,nSize); |
343 | } | 354 | } |
344 | 355 | ||
345 | encodedString::encodedString(char*nContent,unsigned int nSize) | 356 | encodedString::encodedString(char*nContent,unsigned int nSize) |
346 | { | 357 | { |
347 | init(); | 358 | init(); |
348 | setContent(nContent,nSize); | 359 | setContent(nContent,nSize); |
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 | |||
@@ -120,41 +120,44 @@ public: | |||
120 | 120 | ||
121 | 121 | ||
122 | void setParameters(const part_plist_t&list); | 122 | void setParameters(const part_plist_t&list); |
123 | const part_plist_t&Parameters()const; | 123 | const part_plist_t&Parameters()const; |
124 | void addParameter(const QString&key,const QString&value); | 124 | void addParameter(const QString&key,const QString&value); |
125 | const QString searchParamter(const QString&key)const; | 125 | const QString searchParamter(const QString&key)const; |
126 | void setPositionlist(const QValueList<int>&poslist); | 126 | void setPositionlist(const QValueList<int>&poslist); |
127 | const QValueList<int>& Positionlist()const; | 127 | const QValueList<int>& Positionlist()const; |
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 | }; |
153 | 156 | ||
154 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; | 157 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; |
155 | 158 | ||
156 | class encodedString | 159 | class encodedString |
157 | { | 160 | { |
158 | public: | 161 | public: |
159 | encodedString(); | 162 | encodedString(); |
160 | /* | 163 | /* |
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 | |||
@@ -69,35 +69,38 @@ public: | |||
69 | void setMail( const QString&s ) { mail = s; } | 69 | void setMail( const QString&s ) { mail = s; } |
70 | const QString&getTo()const{ return to; } | 70 | const QString&getTo()const{ return to; } |
71 | void setTo( const QString&s ) { to = s; } | 71 | void setTo( const QString&s ) { to = s; } |
72 | const QString&getCC()const{ return cc; } | 72 | const QString&getCC()const{ return cc; } |
73 | void setCC( const QString&s ) { cc = s; } | 73 | void setCC( const QString&s ) { cc = s; } |
74 | const QString&getBCC()const { return bcc; } | 74 | const QString&getBCC()const { return bcc; } |
75 | void setBCC( const QString&s ) { bcc = s; } | 75 | void setBCC( const QString&s ) { bcc = s; } |
76 | const QString&getMessage()const { return message; } | 76 | const QString&getMessage()const { return message; } |
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(); |
96 | const QString&getDisplayName()const { return nameDisplay; } | 99 | const QString&getDisplayName()const { return nameDisplay; } |
97 | const QString&getName()const { return name; } | 100 | const QString&getName()const { return name; } |
98 | const QString&getPrefix()const{return prefix; } | 101 | const QString&getPrefix()const{return prefix; } |
99 | virtual bool may_select()const{return true;} | 102 | virtual bool may_select()const{return true;} |
100 | virtual bool no_inferior()const{return true;} | 103 | virtual bool no_inferior()const{return true;} |
101 | const QString&Separator()const; | 104 | const QString&Separator()const; |
102 | 105 | ||
103 | protected: | 106 | protected: |
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 | |||
@@ -1,25 +1,26 @@ | |||
1 | #include "storemail.h" | 1 | #include "storemail.h" |
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; |
18 | wrapper = AbstractMail::getWrapper(m_Account); | 19 | wrapper = AbstractMail::getWrapper(m_Account); |
19 | if (wrapper) { | 20 | if (wrapper) { |
20 | wrapper->createMbox(m_tfolder); | 21 | wrapper->createMbox(m_tfolder); |
21 | } | 22 | } |
22 | } | 23 | } |
23 | 24 | ||
24 | Storemail::Storemail(const QString&dir,const QString&aFolder) | 25 | Storemail::Storemail(const QString&dir,const QString&aFolder) |
25 | : Generatemail() | 26 | : Generatemail() |
@@ -52,34 +53,41 @@ Storemail::~Storemail() | |||
52 | int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) | 53 | int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) |
53 | { | 54 | { |
54 | if (!wrapper) return 0; | 55 | if (!wrapper) return 0; |
55 | int ret = 1; | 56 | int ret = 1; |
56 | 57 | ||
57 | mailmime * mimeMail = 0; | 58 | mailmime * mimeMail = 0; |
58 | mimeMail = createMimeMail(mail ); | 59 | mimeMail = createMimeMail(mail ); |
59 | if ( mimeMail == NULL ) { | 60 | if ( mimeMail == NULL ) { |
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 | } |
78 | 86 | ||
79 | if (ret) { | 87 | if (ret) { |
80 | wrapper->storeMessage(data,size,m_tfolder); | 88 | wrapper->storeMessage(data,size,m_tfolder); |
81 | } | 89 | } |
82 | 90 | ||
83 | if (data) { | 91 | if (data) { |
84 | free(data); | 92 | free(data); |
85 | } | 93 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 18a5600..c20c7ce 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -278,33 +278,33 @@ void OpieMail::replyMail() | |||
278 | rtext += "\n"; | 278 | rtext += "\n"; |
279 | 279 | ||
280 | QString prefix; | 280 | QString prefix; |
281 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 281 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
282 | else prefix = "Re: "; // no i18n on purpose | 282 | else prefix = "Re: "; // no i18n on purpose |
283 | 283 | ||
284 | Settings *settings = new Settings(); | 284 | Settings *settings = new Settings(); |
285 | ComposeMail composer( settings ,this, 0, true); | 285 | ComposeMail composer( settings ,this, 0, true); |
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() |
303 | { | 303 | { |
304 | QListViewItem*item = mailView->currentItem(); | 304 | QListViewItem*item = mailView->currentItem(); |
305 | if (!item) return; | 305 | if (!item) return; |
306 | RecMailP mail = ((MailListViewItem*)item)->data(); | 306 | RecMailP mail = ((MailListViewItem*)item)->data(); |
307 | RecBodyP body = folderView->fetchBody(mail); | 307 | RecBodyP body = folderView->fetchBody(mail); |
308 | ViewMail readMail( this,"", Qt::WType_Modal ); | 308 | ViewMail readMail( this,"", Qt::WType_Modal ); |
309 | readMail.setBody( body ); | 309 | readMail.setBody( body ); |
310 | readMail.setMail( mail ); | 310 | readMail.setMail( mail ); |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 4883231..3bd6f41 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -444,32 +444,33 @@ void ViewMail::slotReply() | |||
444 | rtext += "\n"; | 444 | rtext += "\n"; |
445 | 445 | ||
446 | QString prefix; | 446 | QString prefix; |
447 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 447 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
448 | else prefix = "Re: "; // no i18n on purpose | 448 | else prefix = "Re: "; // no i18n on purpose |
449 | 449 | ||
450 | Settings *settings = new Settings(); | 450 | Settings *settings = new Settings(); |
451 | ComposeMail composer( settings ,this, 0, true); | 451 | ComposeMail composer( settings ,this, 0, true); |
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 | ||
468 | void ViewMail::slotForward() | 469 | void ViewMail::slotForward() |
469 | { | 470 | { |
470 | if (!m_gotBody) | 471 | if (!m_gotBody) |
471 | { | 472 | { |
472 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); | 473 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); |
473 | return; | 474 | return; |
474 | } | 475 | } |
475 | 476 | ||