-rw-r--r-- | kmicromail/composemail.cpp | 12 | ||||
-rw-r--r-- | kmicromail/koprefs.cpp | 7 | ||||
-rw-r--r-- | kmicromail/koprefs.h | 5 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.cpp | 19 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.h | 1 | ||||
-rw-r--r-- | kmicromail/libetpan/mime/mailmime_decode.c | 203 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 9 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 16 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 19 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mboxwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 4 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 45 | ||||
-rw-r--r-- | kmicromail/mainwindow.h | 3 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 16 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 20 |
16 files changed, 244 insertions, 137 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 2dcbc75..f44100b 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -482,14 +482,14 @@ ComposeMail::~ComposeMail() void ComposeMail::reEditMail(const RecMailP¤t) { RecMailP data = current; - message->setText(QString::fromUtf8( data->Wrapper()->fetchBody(current)->Bodytext().latin1() )); - subjectLine->setText( QString::fromUtf8( data->getSubject().latin1() )); - toLine->setText(QString::fromUtf8( data->To().join(",").latin1() )); - ccLine->setText(QString::fromUtf8( data->CC().join(",").latin1() )); - bccLine->setText(QString::fromUtf8( data->Bcc().join(",").latin1() )); - replyLine->setText(QString::fromUtf8( data->Replyto().latin1() )); + message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); + subjectLine->setText( data->getSubject()); + toLine->setText(data->To().join(",")); + ccLine->setText(data->CC().join(",")); + bccLine->setText(data->Bcc().join(",")); + replyLine->setText(data->Replyto()); } AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) : QListViewItem( parent ) diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index 8143b6f..342bbf3 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp @@ -56,25 +56,29 @@ KOPrefs::KOPrefs() : mComposeFont = QFont("helvetica",12); mReadFont = QFont("helvetica",12); KPrefs::setCurrentGroup("General"); + addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); addItemString("SenderName",&mName,i18n ("Please set at") ); addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); addItemBool("ViewMailAsHtml",&mViewAsHtml,false); addItemBool("SendMailLater",&mSendLater,true); addItemBool("UseKapi",&mUseKapi,false); + addItemInt("CurrentCodec",&mCurrentCodec,0); KPrefs::setCurrentGroup("Fonts"); addItemFont("Application Font",&mAppFont); addItemFont("Compose Font",&mComposeFont); addItemFont("Read Font",&mReadFont); fillMailDefaults(); - + isDirty = false; } KOPrefs::~KOPrefs() { + if ( isDirty ) + writeConfig(); if (mInstance == this) mInstance = insd.setObject(0); } @@ -109,9 +113,8 @@ void KOPrefs::usrReadConfig() void KOPrefs::usrWriteConfig() { - KPimPrefs::usrWriteConfig(); } diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h index f0a4463..91f3fa3 100644 --- a/kmicromail/koprefs.h +++ b/kmicromail/koprefs.h @@ -67,10 +67,13 @@ class KOPrefs : public KPimPrefs QFont mAppFont; QFont mComposeFont; QFont mReadFont; QString mName; + QString mSendCodec; QString mEmail; - bool mSendLater, mViewAsHtml, mUseKapi; + QString mCurrentCodeName; + int mCurrentCodec; + bool mSendLater, mViewAsHtml, mUseKapi, isDirty; private: }; diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp index c878fc9..4abf859 100644 --- a/kmicromail/koprefsdialog.cpp +++ b/kmicromail/koprefsdialog.cpp @@ -140,15 +140,18 @@ void KOPrefsDialog::setupMailTab() topLayout->setMargin(marginHint()); KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), &(KOPrefs::instance()->mViewAsHtml),topFrame); - topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); - - + topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); + + ttt = addWidBool(i18n("Send mails later"), - &(KOPrefs::instance()->mSendLater),topFrame); - topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); - + &(KOPrefs::instance()->mSendLater),topFrame); + topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); + mCodecEdit = new QLineEdit(topFrame); + topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); + topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); + topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); } void KOPrefsDialog::setupFontsTab() { @@ -194,15 +197,17 @@ void KOPrefsDialog::usrReadConfig() { mNameEdit->setText(KOPrefs::instance()->mName); mEmailEdit->setText(KOPrefs::instance()->mEmail); + mCodecEdit->setText(KOPrefs::instance()->mSendCodec); kdelibcfg->readConfig(); } void KOPrefsDialog::usrWriteConfig() { KOPrefs::instance()->mName = mNameEdit->text(); KOPrefs::instance()->mEmail = mEmailEdit->text(); - kdelibcfg->writeConfig(); + KOPrefs::instance()->mSendCodec = mCodecEdit->text(); + kdelibcfg->writeConfig(); } diff --git a/kmicromail/koprefsdialog.h b/kmicromail/koprefsdialog.h index 615574b..a0416ae 100644 --- a/kmicromail/koprefsdialog.h +++ b/kmicromail/koprefsdialog.h @@ -62,8 +62,9 @@ protected: void setupFontsTab(); private: KDEPIMConfigWidget* kdelibcfg; QLineEdit *mNameEdit; + QLineEdit *mCodecEdit; QLineEdit *mEmailEdit; QLabel *mNameLabel; QLabel *mEmailLabel; #if 0 diff --git a/kmicromail/libetpan/mime/mailmime_decode.c b/kmicromail/libetpan/mime/mailmime_decode.c index dbaeb68..b2ab0f7 100644 --- a/kmicromail/libetpan/mime/mailmime_decode.c +++ b/kmicromail/libetpan/mime/mailmime_decode.c @@ -116,110 +116,125 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode, first = TRUE; type = TYPE_ERROR; /* XXX - removes a gcc warning */ + // LUTZ add + int appendNewLine = FALSE; + while (1) { //while - while (1) { - - r = mailmime_encoded_word_parse(message, length, &cur_token, &word); - if (r == MAILIMF_NO_ERROR) { - if (!first) { - if (type != TYPE_ENCODED_WORD) { - if (mmap_string_append_c(gphrase, ' ') == NULL) { - mailmime_encoded_word_free(word); - res = MAILIMF_ERROR_MEMORY; - goto free; - } - } - } - type = TYPE_ENCODED_WORD; - wordutf8 = NULL; - r = charconv(tocode, word->wd_charset, word->wd_text, - strlen(word->wd_text), &wordutf8); - switch (r) { - case MAIL_CHARCONV_ERROR_MEMORY: - mailmime_encoded_word_free(word); - res = MAILIMF_ERROR_MEMORY; - goto free; - - case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: - case MAIL_CHARCONV_ERROR_CONV: - mailmime_encoded_word_free(word); - res = MAILIMF_ERROR_PARSE; - goto free; - } + r = mailmime_encoded_word_parse(message, length, &cur_token, &word); + if (r == MAILIMF_NO_ERROR) { + if (!first) { + if (type != TYPE_ENCODED_WORD) { + if (mmap_string_append_c(gphrase, ' ') == NULL) { + mailmime_encoded_word_free(word); + res = MAILIMF_ERROR_MEMORY; + goto free; + } + } + } + type = TYPE_ENCODED_WORD; + wordutf8 = NULL; + r = charconv(tocode, word->wd_charset, word->wd_text, + strlen(word->wd_text), &wordutf8); + switch (r) { + case MAIL_CHARCONV_ERROR_MEMORY: + mailmime_encoded_word_free(word); + res = MAILIMF_ERROR_MEMORY; + goto free; + + case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: + case MAIL_CHARCONV_ERROR_CONV: + mailmime_encoded_word_free(word); + res = MAILIMF_ERROR_PARSE; + goto free; + } - if (wordutf8 != NULL) { - if (mmap_string_append(gphrase, wordutf8) == NULL) { + if (wordutf8 != NULL) { + if (mmap_string_append(gphrase, wordutf8) == NULL) { + mailmime_encoded_word_free(word); + free(wordutf8); + res = MAILIMF_ERROR_MEMORY; + goto free; + } + free(wordutf8); + } mailmime_encoded_word_free(word); - free(wordutf8); - res = MAILIMF_ERROR_MEMORY; + first = FALSE; + } + else if (r == MAILIMF_ERROR_PARSE) { + /* do nothing */ + } + else { + res = r; goto free; - } - free(wordutf8); } - mailmime_encoded_word_free(word); - first = FALSE; - } - else if (r == MAILIMF_ERROR_PARSE) { - /* do nothing */ - } - else { - res = r; - goto free; - } - - if (r == MAILIMF_ERROR_PARSE) { - char * raw_word; - r = mailmime_non_encoded_word_parse(message, length, - &cur_token, &raw_word); - if (r == MAILIMF_NO_ERROR) { - if (!first) { - if (mmap_string_append_c(gphrase, ' ') == NULL) { - free(raw_word); - res = MAILIMF_ERROR_MEMORY; - goto free; - } - } - type = TYPE_WORD; + if (r == MAILIMF_ERROR_PARSE) { + char * raw_word; + + r = mailmime_non_encoded_word_parse(message, length, + &cur_token, &raw_word); + if (r == MAILIMF_NO_ERROR) { + if (!first) { + if (mmap_string_append_c(gphrase, ' ') == NULL) { + free(raw_word); + res = MAILIMF_ERROR_MEMORY; + goto free; + } + } + type = TYPE_WORD; - wordutf8 = NULL; - r = charconv(tocode, default_fromcode, raw_word, - strlen(raw_word), &wordutf8); + wordutf8 = NULL; + r = charconv(tocode, default_fromcode, raw_word, + strlen(raw_word), &wordutf8); - switch (r) { - case MAIL_CHARCONV_ERROR_MEMORY: - free(raw_word); - res = MAILIMF_ERROR_MEMORY; - goto free; + switch (r) { + case MAIL_CHARCONV_ERROR_MEMORY: + free(raw_word); + res = MAILIMF_ERROR_MEMORY; + goto free; - case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: - case MAIL_CHARCONV_ERROR_CONV: - free(raw_word); - res = MAILIMF_ERROR_PARSE; - goto free; - } - - if (mmap_string_append(gphrase, wordutf8) == NULL) { - free(wordutf8); - free(raw_word); - res = MAILIMF_ERROR_MEMORY; - goto free; - } - // LUTZ fix - free(wordutf8); - free(raw_word); - first = FALSE; + case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: + case MAIL_CHARCONV_ERROR_CONV: + free(raw_word); + res = MAILIMF_ERROR_PARSE; + goto free; + } + // LUTZ add + if ( appendNewLine ) { + appendNewLine = FALSE; + if (mmap_string_append(gphrase, "\n") == NULL) { + free(wordutf8); + free(raw_word); + res = MAILIMF_ERROR_MEMORY; + goto free; + } + } + //fprintf(stderr,"append *%s* \n",wordutf8 ); + if (mmap_string_append(gphrase, wordutf8) == NULL) { + free(wordutf8); + free(raw_word); + res = MAILIMF_ERROR_MEMORY; + goto free; + } + // LUTZ fix + free(wordutf8); + free(raw_word); + first = FALSE; + } + else if (r == MAILIMF_ERROR_PARSE) { + // LUTZ add + if ( cur_token >= length ) + break; + ++cur_token; + appendNewLine = TRUE; + } + else { + res = r; + goto free; + } } - else if (r == MAILIMF_ERROR_PARSE) { - break; - } - else { - res = r; - goto free; - } - } } if (first) { res = MAILIMF_ERROR_PARSE; @@ -286,10 +301,10 @@ mailmime_non_encoded_word_parse(const char * message, size_t length, cur_token ++; } if (cur_token - begin == 0) { - res = MAILIMF_ERROR_PARSE; - goto err; + res = MAILIMF_ERROR_PARSE; + goto err; } text = malloc(cur_token - begin + 1); if (text == NULL) { diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 8ee112c..ed5c898 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp @@ -75,9 +75,8 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin mimetype = MAILMIME_MECHANISM_8BIT; } else if (enc.lower()=="binary") { mimetype = MAILMIME_MECHANISM_BINARY; } - int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, &result_text,&target_length); encodedString* result = new encodedString(); @@ -94,13 +93,15 @@ QString AbstractMail::convert_String(const char*text) char*res = 0; int err = MAILIMF_NO_ERROR; QString result(text); - + //qDebug("convert_String %s ", text); + //err = mailmime_encoded_phrase_parse("iso-8859-1", + // text, strlen(text),&index, "iso-8859-1",&res); err = mailmime_encoded_phrase_parse("iso-8859-1", - text, strlen(text),&index, "iso-8859-1",&res); + text, strlen(text),&index, "utf-8",&res); if (err == MAILIMF_NO_ERROR && res && strlen(res)) { - result = QString(res); + result = QString::fromUtf8(res); } //qDebug("convert_String:%s ",result.latin1() ); if (res) free(res); return result; diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index d89a5f9..49227dd 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -219,8 +219,22 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m delete rs; } b = QString(res->Content()); delete res; + size_t index = 0; + char*resu = 0; + int err = MAILIMF_NO_ERROR; + QString charset = part->searchParamter( "charset"); + qDebug("CHARSET %s ",charset.latin1() ); + if ( !charset.isEmpty() ) { + err = mailmime_encoded_phrase_parse(charset.latin1(), + b.latin1(), b.length(),&index, "utf-8",&resu); + if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { + //qDebug("res %d %s ", index, resu); + b = QString::fromUtf8(resu); + } + if (resu) free(resu); + } target->setBodytext(b); target->setDescription(part); } else { bodyCache[b]=new encodedString(data,len); @@ -343,9 +357,9 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) if ( box->mb_display_name == NULL ) { result.append( box->mb_addr_spec ); } else { - result.append( convert_String(box->mb_display_name).latin1() ); + result.append( convert_String(box->mb_display_name) ); result.append( " <" ); result.append( box->mb_addr_spec ); result.append( ">" ); } diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index d90a8d2..eb2b47d 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -751,8 +751,27 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t /* important: Check for is NULL 'cause a body can be empty! And we put it only into the mail if it is the FIRST part */ if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); + + size_t index = 0; + char*res = 0; + int err = MAILIMF_NO_ERROR; + + QString charset = currentPart->searchParamter( "charset"); + qDebug("CHARSET %s ",charset.latin1() ); + //if ( false ) { + if ( !charset.isEmpty() ) { + //err = mailmime_encoded_phrase_parse("iso-8859-1", + // text, strlen(text),&index, "iso-8859-1",&res); + err = mailmime_encoded_phrase_parse(charset.latin1(), + body_text.latin1(), body_text.length(),&index, "utf-8",&res); + if (err == MAILIMF_NO_ERROR && res && strlen(res)) { + //qDebug("res %d %s ", index, res); + body_text = QString::fromUtf8(res); + } + if (res) free(res); + } //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); target_body->setDescription(currentPart); target_body->setBodytext(body_text); if (countlist.count()>1) { diff --git a/kmicromail/libmailwrapper/mboxwrapper.cpp b/kmicromail/libmailwrapper/mboxwrapper.cpp index 0cdbae4..87f8c8a 100644 --- a/kmicromail/libmailwrapper/mboxwrapper.cpp +++ b/kmicromail/libmailwrapper/mboxwrapper.cpp @@ -124,8 +124,9 @@ RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) mailstorage_free(storage); mailmessage_free(msg); return body; } + qDebug("MBOXwrapper::fetchBody "); body = parseMail(msg); mailmessage_fetch_result_free(msg,data); mailfolder_free(folder); mailstorage_free(storage); diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index 90b5d23..982d7a6 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp @@ -127,8 +127,9 @@ void MHwrapper::answeredMail(const RecMailP&) } RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) { + qDebug("MHwrapper::fetchBody "); RecBodyP body = new RecBody(); init_storage(); if (!m_storage) { return body; diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 5ef5b6a..484a635 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp @@ -54,10 +54,10 @@ void MailListViewItem::showEntry() } else { //setText(3, fsize + "MB"); mKeyMap.insert(3, "M" +fsort ); } - setText(1,QString::fromUtf8( mail_data->getSubject().latin1())); - setText(2,QString::fromUtf8( mail_data->getFrom().latin1())); + setText(1,mail_data->getSubject()); + setText(2,mail_data->getFrom()); #if 0 QString date = mail_data->getDate(); int kom = date.find( ",")+2; diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 98eb9a5..3013931 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -11,17 +11,18 @@ #ifdef DESKTOP_VERSION #include <qapplication.h> #include <qstatusbar.h> +#include <kabc/stdaddressbook.h> extern QStatusBar* globalSstatusBarMainWindow; #else #include <qpe/qpeapplication.h> #endif #include "defines.h" #include "mainwindow.h" #include <KDGanttMinimizeSplitter.h> -#include <kabc/stdaddressbook.h> +#include "koprefs.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name ) //, flags ) { @@ -98,9 +99,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) SLOT( slotEditSettings() ) ); editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 0, 0, this ); editAccounts->addTo( settingsMenu ); - + codecMenu = new QPopupMenu( menuBar ); + codecMenu->insertItem( "Western (iso-8859-1)",0,0); + codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); + codecMenu->insertItem( "Western (iso-8859-15)",2,2); + codecMenu->insertItem( "Chinese (big-5)",3,3); + codecMenu->insertItem( "Unicode (utf-8)",4,4); + codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); + settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); //setCentralWidget( view ); QVBox* wrapperBox = new QVBox( this ); setCentralWidget( wrapperBox ); @@ -182,8 +190,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) li->addTo(helpMenu); li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); li->addTo(helpMenu); + connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); + slotSetCodec( KOPrefs::instance()->mCurrentCodec ); #ifdef DESKTOP_VERSION resize ( 640, 480 ); #endif } @@ -191,8 +201,39 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) MainWindow::~MainWindow() { } +void MainWindow::slotSetCodec( int codec ) +{ + codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); + //qDebug("codec %d ", codec); + KOPrefs::instance()->mCurrentCodec = codec; + KOPrefs::instance()->isDirty = true; + QString name; + switch ( codec ) { + case 0: + name = "iso-8859-1"; + break; + case 1: + name = "iso-8859-5"; + break; + case 2: + name = "iso-8859-15"; + break; + case 3: + name = "big-5"; + break; + case 4: + name = "utf-8"; + break; + case 5: + name = KOPrefs::instance()->mSendCodec.lower(); + break; + } + KOPrefs::instance()->mCurrentCodeName = name ; + codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); + codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); +} void MainWindow::showLicence() { KApplication::showLicence(); } diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index f5ab69b..d0a5caf 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h @@ -44,8 +44,9 @@ protected slots: virtual void displayMail(); virtual void slotGetMail() = 0; virtual void slotGetAllMail() = 0; virtual void slotDeleteMail(); + virtual void slotSetCodec(int); virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotAdjustLayout(); virtual void slotEditSettings(); virtual void mailLeftClicked( QListViewItem * ); @@ -56,9 +57,9 @@ protected slots: protected: QToolBar *toolBar; StatusWidget *statusWidget; QPEMenuBar *menuBar; - QPopupMenu *mailMenu, *settingsMenu; + QPopupMenu *mailMenu, *settingsMenu, *codecMenu; QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, *editSettings, *editAccounts, *syncFolders; AccountView *folderView; QListView *mailView; diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index af5376f..18a5600 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -32,8 +32,9 @@ #endif #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> +#include "koprefs.h" //using namespace Opie::Core; OpieMail::OpieMail( QWidget *parent, const char *name ) @@ -236,8 +237,9 @@ void OpieMail::slotEditSettings() settingsDialog.showMaximized(); #endif settingsDialog.exec(); + slotSetCodec( KOPrefs::instance()->mCurrentCodec ); // KApplication::execDialog(settingsDialog); } void OpieMail::slotEditAccounts() @@ -262,12 +264,12 @@ void OpieMail::replyMail() RecBodyP body = folderView->fetchBody(mail); QString rtext; rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose - .arg( QString::fromUtf8( mail->getFrom().latin1())) - .arg( QString::fromUtf8( mail->getDate().latin1() )); + .arg( mail->getFrom()) + .arg( mail->getDate()); - QString text = QString::fromUtf8( body->Bodytext().latin1() ); + QString text = body->Bodytext(); QStringList lines = QStringList::split(QRegExp("\\n"), text); QStringList::Iterator it; for (it = lines.begin(); it != lines.end(); it++) { @@ -281,15 +283,15 @@ void OpieMail::replyMail() Settings *settings = new Settings(); ComposeMail composer( settings ,this, 0, true); if (mail->Replyto().isEmpty()) { - composer.setTo( QString::fromUtf8( mail->getFrom().latin1())); + composer.setTo( mail->getFrom()); } else { - composer.setTo( QString::fromUtf8(mail->Replyto().latin1())); + composer.setTo( mail->Replyto()); } - composer.setSubject( prefix + QString::fromUtf8( mail->getSubject().latin1() ) ); + composer.setSubject( prefix + mail->getSubject()); composer.setMessage( rtext ); - composer.setInReplyTo( QString::fromUtf8(mail->Msgid().latin1())); + composer.setInReplyTo( mail->Msgid()); if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) { mail->Wrapper()->answeredMail(mail); diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 2093678..4883231 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp @@ -97,9 +97,9 @@ AttachItem* ViewMail::lastChild(AttachItem*parent) void ViewMail::setBody(const RecBodyP&body ) { m_body = body; - m_mail[2] = QString::fromUtf8( body->Bodytext().latin1() ); + m_mail[2] = body->Bodytext(); // qDebug("********text %s ",m_mail[2].latin1() ); attachbutton->setEnabled(body->Parts().count()>0); attachments->setEnabled(body->Parts().count()>0); if (body->Parts().count()==0) @@ -300,12 +300,12 @@ void ViewMail::setMail(const RecMailP&mail ) { m_recMail = mail; - m_mail[0] = QString::fromUtf8( mail->getFrom().latin1() ); - m_mail[1] = QString::fromUtf8( mail->getSubject().latin1() ); - m_mail[3] = QString::fromUtf8( mail->getDate().latin1() ); - m_mail[4] = QString::fromUtf8( mail->Msgid().latin1() ); + m_mail[0] = mail->getFrom(); + m_mail[1] = mail->getSubject(); + m_mail[3] = mail->getDate(); + m_mail[4] = mail->Msgid(); m_mail2[0] = mail->To(); m_mail2[1] = mail->CC(); m_mail2[2] = mail->Bcc(); @@ -349,11 +349,11 @@ void ViewMail::setText() QString ccString; QString bccString; - toString = QString::fromUtf8(m_mail2[0].join(",").latin1()); - ccString = QString::fromUtf8(m_mail2[1].join(",").latin1()); - bccString = QString::fromUtf8(m_mail2[2].join(",").latin1()); + toString = m_mail2[0].join(","); + ccString = m_mail2[1].join(","); + bccString = m_mail2[2].join(","); setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); @@ -449,11 +449,11 @@ void ViewMail::slotReply() Settings *settings = new Settings(); ComposeMail composer( settings ,this, 0, true); if (m_recMail->Replyto().isEmpty()) { - composer.setTo( QString::fromUtf8( m_recMail->getFrom().latin1())); + composer.setTo(m_recMail->getFrom()); } else { - composer.setTo( QString::fromUtf8( m_recMail->Replyto().latin1())); + composer.setTo(m_recMail->Replyto()); } composer.setSubject( prefix + m_mail[1] ); composer.setMessage( rtext ); composer.setInReplyTo(m_recMail->Msgid()); |