-rw-r--r-- | kmicromail/koprefsdialog.cpp | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/generatemail.cpp | 16 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/generatemail.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 4 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 3 |
7 files changed, 23 insertions, 13 deletions
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp index 4abf859..13d6681 100644 --- a/kmicromail/koprefsdialog.cpp +++ b/kmicromail/koprefsdialog.cpp @@ -142,21 +142,22 @@ void KOPrefsDialog::setupMailTab() KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), &(KOPrefs::instance()->mViewAsHtml),topFrame); 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); + /* 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() { QFrame *topFrame = addPage(i18n("Fonts"),0,0); // DesktopIcon("fonts",KIcon::SizeMedium)); QGridLayout *topLayout = new QGridLayout(topFrame,7,3); @@ -193,24 +194,24 @@ void KOPrefsDialog::setupFontsTab() topLayout->setRowStretch(4,1); } void KOPrefsDialog::usrReadConfig() { mNameEdit->setText(KOPrefs::instance()->mName); mEmailEdit->setText(KOPrefs::instance()->mEmail); - mCodecEdit->setText(KOPrefs::instance()->mSendCodec); + //mCodecEdit->setText(KOPrefs::instance()->mSendCodec); kdelibcfg->readConfig(); } void KOPrefsDialog::usrWriteConfig() { KOPrefs::instance()->mName = mNameEdit->text(); KOPrefs::instance()->mEmail = mEmailEdit->text(); - KOPrefs::instance()->mSendCodec = mCodecEdit->text(); + //KOPrefs::instance()->mSendCodec = mCodecEdit->text(); kdelibcfg->writeConfig(); } #if 0 void KOPrefsDialog::setupLocaleDateTab() { diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp index 32311d7..2d213fe 100644 --- a/kmicromail/libmailwrapper/generatemail.cpp +++ b/kmicromail/libmailwrapper/generatemail.cpp @@ -8,16 +8,17 @@ #include <stdlib.h> #include <qfileinfo.h> using namespace Opie::Core; const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; Generatemail::Generatemail() { + mCharset = "iso-8859-1"; } Generatemail::~Generatemail() { } void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { clistiter *it, *it2; @@ -140,17 +141,17 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet file = strdup( filename.latin1() ); // full name with path } int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; int mechanism = MAILMIME_MECHANISM_BASE64; if ( mimetype.startsWith( "text/" ) ) { param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( mCharset.latin1() ) ); mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; } fields = mailmime_fields_new_filename( disptype, name, mechanism ); content = mailmime_content_new_with_str( (char*)mimetype.latin1() ); if (content!=0 && fields != 0) { @@ -165,17 +166,18 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet param = 0; } filePart = mailmime_new_empty( content, fields ); } if (filePart) { if (filename.length()>0) { err = mailmime_set_body_file( filePart, file ); } else { - err = mailmime_set_body_text(filePart,strdup( TextContent.utf8()),TextContent.utf8().length()); + err = mailmime_set_body_text(filePart,strdup( TextContent.utf8().data()),TextContent.utf8().length()); + //err = mailmime_set_body_text(filePart,strdup( TextContent.latin1()),TextContent.length()); } if (err != MAILIMF_NO_ERROR) { qDebug("Error setting body with file "); mailmime_free( filePart ); filePart = 0; } } @@ -222,18 +224,19 @@ void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files mailmime *Generatemail::buildTxtPart(const QString&str ) { mailmime *txtPart; mailmime_fields *fields; mailmime_content *content; mailmime_parameter *param; int err; QCString __str; + //qDebug(" Generatemail::buildTxtPart %s", str.latin1()); param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( mCharset.latin1() ) ); if ( param == NULL ) goto err_free; content = mailmime_content_new_with_str( "text/plain" ); if ( content == NULL ) goto err_free_param; err = clist_append( content->ct_parameters, param ); @@ -243,18 +246,19 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); if ( fields == NULL ) goto err_free_content; txtPart = mailmime_new_empty( content, fields ); if ( txtPart == NULL ) goto err_free_fields; { - __str = str.utf8(); - err = mailmime_set_body_text( txtPart, __str.data(), __str.length() ); + //__str = str.utf8(); + __str = QCString (str.latin1()); + err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() ); } if ( err != MAILIMF_NO_ERROR ) goto err_free_txtPart; return txtPart; // Success :) err_free_txtPart: mailmime_free( txtPart ); @@ -393,16 +397,18 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma return fields; } mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &mail ) { mailmime *message, *txtPart; mailimf_fields *fields; int err; + //LR disabled for now + //mCharset = mail->getCharset().lower(); fields = createImfFields( mail ); if ( fields == NULL ) goto err_free; message = mailmime_new_message_data( NULL ); if ( message == NULL ) goto err_free_fields; diff --git a/kmicromail/libmailwrapper/generatemail.h b/kmicromail/libmailwrapper/generatemail.h index b9f8285..a9fb648 100644 --- a/kmicromail/libmailwrapper/generatemail.h +++ b/kmicromail/libmailwrapper/generatemail.h @@ -37,11 +37,12 @@ protected: mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); mailmime *buildTxtPart(const QString&str ); mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); mailimf_fields *createImfFields(const Opie::Core::OSmartPointer<Mail> &mail ); mailmime *createMimeMail(const Opie::Core::OSmartPointer<Mail>&mail ); clist *createRcptList( mailimf_fields *fields ); static const char* USER_AGENT; + QString mCharset; }; #endif diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index 28d45ce..eac05e5 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -220,17 +220,18 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m } 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() ) { + if (false ) { + //if ( !charset.isEmpty() ) { target->setCharset( charset ); 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); diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 2a54381..da7065f 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -754,18 +754,18 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t 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() ) { + if ( false ) { + //if ( !charset.isEmpty() ) { target_body->setCharset( charset ); //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); diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h index ea6bf36..3e8b51f 100644 --- a/kmicromail/libmailwrapper/mailwrapper.h +++ b/kmicromail/libmailwrapper/mailwrapper.h @@ -78,17 +78,17 @@ public: const QString&getSubject()const { return subject; } void setSubject( const QString&s ) { subject = s; } const QString&getReply()const{ return reply; } void setReply( const QString&a ) { reply = a; } void setInreply(const QStringList&list){m_in_reply_to = list;} const QStringList&Inreply()const{return m_in_reply_to;} void setCharset( const QString&a ) { charset= a; } - const QString& getCharset() { return charset; } + const QString& getCharset() const { return charset; } private: QList<Attachment> attList; QString name, mail, to, cc, bcc, reply, subject, message, charset; QStringList m_in_reply_to; }; class Folder:public Opie::Core::ORefCount diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 3013931..8c0a4cb 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -102,17 +102,18 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 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); + //disabled + //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); //setCentralWidget( view ); QVBox* wrapperBox = new QVBox( this ); setCentralWidget( wrapperBox ); // QWidget *view = new QWidget( wrapperBox ); KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |