summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-11-06 23:30:02 (UTC)
committer zautrix <zautrix>2004-11-06 23:30:02 (UTC)
commit023e0e82dd8bf6421d12492a2dd25534fc43ad31 (patch) (side-by-side diff)
treecf0533e3ccc642cb57a41953f184f457fa5365ba /kmicromail
parentf8841c92d5251f713eb7a025af8fdee52de45b3d (diff)
downloadkdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.zip
kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.tar.gz
kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.tar.bz2
many ompi fixes
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp12
-rw-r--r--kmicromail/koprefs.cpp7
-rw-r--r--kmicromail/koprefs.h5
-rw-r--r--kmicromail/koprefsdialog.cpp19
-rw-r--r--kmicromail/koprefsdialog.h1
-rw-r--r--kmicromail/libetpan/mime/mailmime_decode.c203
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp9
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp16
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp19
-rw-r--r--kmicromail/libmailwrapper/mboxwrapper.cpp1
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp1
-rw-r--r--kmicromail/mailistviewitem.cpp4
-rw-r--r--kmicromail/mainwindow.cpp45
-rw-r--r--kmicromail/mainwindow.h3
-rw-r--r--kmicromail/opiemail.cpp16
-rw-r--r--kmicromail/viewmail.cpp20
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
@@ -484,10 +484,10 @@ void ComposeMail::reEditMail(const RecMailP&current)
{
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());
}
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp
index 8143b6f..342bbf3 100644
--- a/kmicromail/koprefs.cpp
+++ b/kmicromail/koprefs.cpp
@@ -58,4 +58,5 @@ KOPrefs::KOPrefs() :
KPrefs::setCurrentGroup("General");
+ addItemString("SendCodec",&mSendCodec,i18n ("userdefined") );
addItemString("SenderName",&mName,i18n ("Please set at") );
addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") );
@@ -63,4 +64,5 @@ KOPrefs::KOPrefs() :
addItemBool("SendMailLater",&mSendLater,true);
addItemBool("UseKapi",&mUseKapi,false);
+ addItemInt("CurrentCodec",&mCurrentCodec,0);
KPrefs::setCurrentGroup("Fonts");
@@ -69,5 +71,5 @@ KOPrefs::KOPrefs() :
addItemFont("Read Font",&mReadFont);
fillMailDefaults();
-
+ isDirty = false;
}
@@ -75,4 +77,6 @@ KOPrefs::KOPrefs() :
KOPrefs::~KOPrefs()
{
+ if ( isDirty )
+ writeConfig();
if (mInstance == this)
mInstance = insd.setObject(0);
@@ -111,5 +115,4 @@ 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
@@ -69,6 +69,9 @@ class KOPrefs : public KPimPrefs
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
@@ -142,11 +142,14 @@ void KOPrefsDialog::setupMailTab()
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);
}
@@ -196,4 +199,5 @@ void KOPrefsDialog::usrReadConfig()
mNameEdit->setText(KOPrefs::instance()->mName);
mEmailEdit->setText(KOPrefs::instance()->mEmail);
+ mCodecEdit->setText(KOPrefs::instance()->mSendCodec);
kdelibcfg->readConfig();
}
@@ -202,5 +206,6 @@ 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
@@ -64,4 +64,5 @@ protected:
KDEPIMConfigWidget* kdelibcfg;
QLineEdit *mNameEdit;
+ QLineEdit *mCodecEdit;
QLineEdit *mEmailEdit;
QLabel *mNameLabel;
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
@@ -118,106 +118,121 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode,
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;
- }
- }
}
@@ -288,6 +303,6 @@ mailmime_non_encoded_word_parse(const char * message, size_t length,
if (cur_token - begin == 0) {
- res = MAILIMF_ERROR_PARSE;
- goto err;
+ res = MAILIMF_ERROR_PARSE;
+ goto err;
}
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
@@ -77,5 +77,4 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin
mimetype = MAILMIME_MECHANISM_BINARY;
}
-
int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
&result_text,&target_length);
@@ -96,9 +95,11 @@ QString AbstractMail::convert_String(const char*text)
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() );
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
@@ -221,4 +221,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() ) {
+ 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);
@@ -345,5 +359,5 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box )
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 );
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
@@ -753,4 +753,23 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
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);
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
@@ -126,4 +126,5 @@ RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail )
return body;
}
+ qDebug("MBOXwrapper::fetchBody ");
body = parseMail(msg);
mailmessage_fetch_result_free(msg,data);
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
@@ -129,4 +129,5 @@ void MHwrapper::answeredMail(const RecMailP&)
RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
{
+ qDebug("MHwrapper::fetchBody ");
RecBodyP body = new RecBody();
init_storage();
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 5ef5b6a..484a635 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -56,6 +56,6 @@ void MailListViewItem::showEntry()
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();
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 98eb9a5..3013931 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -13,4 +13,5 @@
#include <qapplication.h>
#include <qstatusbar.h>
+#include <kabc/stdaddressbook.h>
extern QStatusBar* globalSstatusBarMainWindow;
#else
@@ -21,5 +22,5 @@ extern QStatusBar* globalSstatusBarMainWindow;
#include <KDGanttMinimizeSplitter.h>
-#include <kabc/stdaddressbook.h>
+#include "koprefs.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
@@ -100,5 +101,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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 );
@@ -184,4 +192,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
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 );
@@ -193,4 +203,35 @@ 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()
{
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index f5ab69b..d0a5caf 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -46,4 +46,5 @@ protected slots:
virtual void slotGetAllMail() = 0;
virtual void slotDeleteMail();
+ virtual void slotSetCodec(int);
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotAdjustLayout();
@@ -58,5 +59,5 @@ protected:
StatusWidget *statusWidget;
QPEMenuBar *menuBar;
- QPopupMenu *mailMenu, *settingsMenu;
+ QPopupMenu *mailMenu, *settingsMenu, *codecMenu;
QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
*editSettings, *editAccounts, *syncFolders;
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index af5376f..18a5600 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -34,4 +34,5 @@
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
+#include "koprefs.h"
//using namespace Opie::Core;
@@ -238,4 +239,5 @@ void OpieMail::slotEditSettings()
settingsDialog.exec();
+ slotSetCodec( KOPrefs::instance()->mCurrentCodec );
// KApplication::execDialog(settingsDialog);
}
@@ -264,8 +266,8 @@ void OpieMail::replyMail()
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;
@@ -283,11 +285,11 @@ void OpieMail::replyMail()
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 ) )
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 2093678..4883231 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -99,5 +99,5 @@ 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);
@@ -302,8 +302,8 @@ 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();
@@ -351,7 +351,7 @@ void ViewMail::setText()
- 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(",");
@@ -451,7 +451,7 @@ void ViewMail::slotReply()
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] );