author | zautrix <zautrix> | 2004-11-06 23:30:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-06 23:30:02 (UTC) |
commit | 023e0e82dd8bf6421d12492a2dd25534fc43ad31 (patch) (unidiff) | |
tree | cf0533e3ccc642cb57a41953f184f457fa5365ba | |
parent | f8841c92d5251f713eb7a025af8fdee52de45b3d (diff) | |
download | kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.zip kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.tar.gz kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.tar.bz2 |
many ompi fixes
-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 | |||
@@ -483,12 +483,12 @@ ComposeMail::~ComposeMail() | |||
483 | void ComposeMail::reEditMail(const RecMailP¤t) | 483 | void ComposeMail::reEditMail(const RecMailP¤t) |
484 | { | 484 | { |
485 | RecMailP data = current; | 485 | RecMailP data = current; |
486 | message->setText(QString::fromUtf8( data->Wrapper()->fetchBody(current)->Bodytext().latin1() )); | 486 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
487 | subjectLine->setText( QString::fromUtf8( data->getSubject().latin1() )); | 487 | subjectLine->setText( data->getSubject()); |
488 | toLine->setText(QString::fromUtf8( data->To().join(",").latin1() )); | 488 | toLine->setText(data->To().join(",")); |
489 | ccLine->setText(QString::fromUtf8( data->CC().join(",").latin1() )); | 489 | ccLine->setText(data->CC().join(",")); |
490 | bccLine->setText(QString::fromUtf8( data->Bcc().join(",").latin1() )); | 490 | bccLine->setText(data->Bcc().join(",")); |
491 | replyLine->setText(QString::fromUtf8( data->Replyto().latin1() )); | 491 | replyLine->setText(data->Replyto()); |
492 | } | 492 | } |
493 | 493 | ||
494 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 494 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp index 8143b6f..342bbf3 100644 --- a/kmicromail/koprefs.cpp +++ b/kmicromail/koprefs.cpp | |||
@@ -57,23 +57,27 @@ KOPrefs::KOPrefs() : | |||
57 | mReadFont = QFont("helvetica",12); | 57 | mReadFont = QFont("helvetica",12); |
58 | 58 | ||
59 | KPrefs::setCurrentGroup("General"); | 59 | KPrefs::setCurrentGroup("General"); |
60 | addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); | ||
60 | addItemString("SenderName",&mName,i18n ("Please set at") ); | 61 | addItemString("SenderName",&mName,i18n ("Please set at") ); |
61 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); | 62 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); |
62 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); | 63 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); |
63 | addItemBool("SendMailLater",&mSendLater,true); | 64 | addItemBool("SendMailLater",&mSendLater,true); |
64 | addItemBool("UseKapi",&mUseKapi,false); | 65 | addItemBool("UseKapi",&mUseKapi,false); |
66 | addItemInt("CurrentCodec",&mCurrentCodec,0); | ||
65 | 67 | ||
66 | KPrefs::setCurrentGroup("Fonts"); | 68 | KPrefs::setCurrentGroup("Fonts"); |
67 | addItemFont("Application Font",&mAppFont); | 69 | addItemFont("Application Font",&mAppFont); |
68 | addItemFont("Compose Font",&mComposeFont); | 70 | addItemFont("Compose Font",&mComposeFont); |
69 | addItemFont("Read Font",&mReadFont); | 71 | addItemFont("Read Font",&mReadFont); |
70 | fillMailDefaults(); | 72 | fillMailDefaults(); |
71 | 73 | isDirty = false; | |
72 | } | 74 | } |
73 | 75 | ||
74 | 76 | ||
75 | KOPrefs::~KOPrefs() | 77 | KOPrefs::~KOPrefs() |
76 | { | 78 | { |
79 | if ( isDirty ) | ||
80 | writeConfig(); | ||
77 | if (mInstance == this) | 81 | if (mInstance == this) |
78 | mInstance = insd.setObject(0); | 82 | mInstance = insd.setObject(0); |
79 | 83 | ||
@@ -110,7 +114,6 @@ void KOPrefs::usrReadConfig() | |||
110 | 114 | ||
111 | void KOPrefs::usrWriteConfig() | 115 | void KOPrefs::usrWriteConfig() |
112 | { | 116 | { |
113 | |||
114 | KPimPrefs::usrWriteConfig(); | 117 | KPimPrefs::usrWriteConfig(); |
115 | } | 118 | } |
116 | 119 | ||
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h index f0a4463..91f3fa3 100644 --- a/kmicromail/koprefs.h +++ b/kmicromail/koprefs.h | |||
@@ -68,8 +68,11 @@ class KOPrefs : public KPimPrefs | |||
68 | QFont mComposeFont; | 68 | QFont mComposeFont; |
69 | QFont mReadFont; | 69 | QFont mReadFont; |
70 | QString mName; | 70 | QString mName; |
71 | QString mSendCodec; | ||
71 | QString mEmail; | 72 | QString mEmail; |
72 | bool mSendLater, mViewAsHtml, mUseKapi; | 73 | QString mCurrentCodeName; |
74 | int mCurrentCodec; | ||
75 | bool mSendLater, mViewAsHtml, mUseKapi, isDirty; | ||
73 | private: | 76 | private: |
74 | 77 | ||
75 | }; | 78 | }; |
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp index c878fc9..4abf859 100644 --- a/kmicromail/koprefsdialog.cpp +++ b/kmicromail/koprefsdialog.cpp | |||
@@ -141,13 +141,16 @@ void KOPrefsDialog::setupMailTab() | |||
141 | 141 | ||
142 | KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), | 142 | KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), |
143 | &(KOPrefs::instance()->mViewAsHtml),topFrame); | 143 | &(KOPrefs::instance()->mViewAsHtml),topFrame); |
144 | topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); | 144 | topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); |
145 | 145 | ||
146 | 146 | ||
147 | ttt = addWidBool(i18n("Send mails later"), | 147 | ttt = addWidBool(i18n("Send mails later"), |
148 | &(KOPrefs::instance()->mSendLater),topFrame); | 148 | &(KOPrefs::instance()->mSendLater),topFrame); |
149 | topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); | 149 | topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); |
150 | 150 | mCodecEdit = new QLineEdit(topFrame); | |
151 | topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); | ||
152 | topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); | ||
153 | topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); | ||
151 | 154 | ||
152 | } | 155 | } |
153 | void KOPrefsDialog::setupFontsTab() | 156 | void KOPrefsDialog::setupFontsTab() |
@@ -195,13 +198,15 @@ void KOPrefsDialog::usrReadConfig() | |||
195 | 198 | ||
196 | mNameEdit->setText(KOPrefs::instance()->mName); | 199 | mNameEdit->setText(KOPrefs::instance()->mName); |
197 | mEmailEdit->setText(KOPrefs::instance()->mEmail); | 200 | mEmailEdit->setText(KOPrefs::instance()->mEmail); |
201 | mCodecEdit->setText(KOPrefs::instance()->mSendCodec); | ||
198 | kdelibcfg->readConfig(); | 202 | kdelibcfg->readConfig(); |
199 | } | 203 | } |
200 | void KOPrefsDialog::usrWriteConfig() | 204 | void KOPrefsDialog::usrWriteConfig() |
201 | { | 205 | { |
202 | KOPrefs::instance()->mName = mNameEdit->text(); | 206 | KOPrefs::instance()->mName = mNameEdit->text(); |
203 | KOPrefs::instance()->mEmail = mEmailEdit->text(); | 207 | KOPrefs::instance()->mEmail = mEmailEdit->text(); |
204 | kdelibcfg->writeConfig(); | 208 | KOPrefs::instance()->mSendCodec = mCodecEdit->text(); |
209 | kdelibcfg->writeConfig(); | ||
205 | 210 | ||
206 | 211 | ||
207 | } | 212 | } |
diff --git a/kmicromail/koprefsdialog.h b/kmicromail/koprefsdialog.h index 615574b..a0416ae 100644 --- a/kmicromail/koprefsdialog.h +++ b/kmicromail/koprefsdialog.h | |||
@@ -63,6 +63,7 @@ protected: | |||
63 | private: | 63 | private: |
64 | KDEPIMConfigWidget* kdelibcfg; | 64 | KDEPIMConfigWidget* kdelibcfg; |
65 | QLineEdit *mNameEdit; | 65 | QLineEdit *mNameEdit; |
66 | QLineEdit *mCodecEdit; | ||
66 | QLineEdit *mEmailEdit; | 67 | QLineEdit *mEmailEdit; |
67 | QLabel *mNameLabel; | 68 | QLabel *mNameLabel; |
68 | QLabel *mEmailLabel; | 69 | QLabel *mEmailLabel; |
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 | |||
@@ -117,108 +117,123 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode, | |||
117 | first = TRUE; | 117 | first = TRUE; |
118 | 118 | ||
119 | type = TYPE_ERROR; /* XXX - removes a gcc warning */ | 119 | type = TYPE_ERROR; /* XXX - removes a gcc warning */ |
120 | // LUTZ add | ||
121 | int appendNewLine = FALSE; | ||
122 | while (1) { //while | ||
120 | 123 | ||
121 | while (1) { | 124 | r = mailmime_encoded_word_parse(message, length, &cur_token, &word); |
122 | 125 | if (r == MAILIMF_NO_ERROR) { | |
123 | r = mailmime_encoded_word_parse(message, length, &cur_token, &word); | 126 | if (!first) { |
124 | if (r == MAILIMF_NO_ERROR) { | 127 | if (type != TYPE_ENCODED_WORD) { |
125 | if (!first) { | 128 | if (mmap_string_append_c(gphrase, ' ') == NULL) { |
126 | if (type != TYPE_ENCODED_WORD) { | 129 | mailmime_encoded_word_free(word); |
127 | if (mmap_string_append_c(gphrase, ' ') == NULL) { | 130 | res = MAILIMF_ERROR_MEMORY; |
128 | mailmime_encoded_word_free(word); | 131 | goto free; |
129 | res = MAILIMF_ERROR_MEMORY; | 132 | } |
130 | goto free; | 133 | } |
131 | } | 134 | } |
132 | } | 135 | type = TYPE_ENCODED_WORD; |
133 | } | 136 | wordutf8 = NULL; |
134 | type = TYPE_ENCODED_WORD; | 137 | r = charconv(tocode, word->wd_charset, word->wd_text, |
135 | wordutf8 = NULL; | 138 | strlen(word->wd_text), &wordutf8); |
136 | r = charconv(tocode, word->wd_charset, word->wd_text, | 139 | switch (r) { |
137 | strlen(word->wd_text), &wordutf8); | 140 | case MAIL_CHARCONV_ERROR_MEMORY: |
138 | switch (r) { | 141 | mailmime_encoded_word_free(word); |
139 | case MAIL_CHARCONV_ERROR_MEMORY: | 142 | res = MAILIMF_ERROR_MEMORY; |
140 | mailmime_encoded_word_free(word); | 143 | goto free; |
141 | res = MAILIMF_ERROR_MEMORY; | 144 | |
142 | goto free; | 145 | case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: |
143 | 146 | case MAIL_CHARCONV_ERROR_CONV: | |
144 | case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: | 147 | mailmime_encoded_word_free(word); |
145 | case MAIL_CHARCONV_ERROR_CONV: | 148 | res = MAILIMF_ERROR_PARSE; |
146 | mailmime_encoded_word_free(word); | 149 | goto free; |
147 | res = MAILIMF_ERROR_PARSE; | 150 | } |
148 | goto free; | ||
149 | } | ||
150 | 151 | ||
151 | if (wordutf8 != NULL) { | 152 | if (wordutf8 != NULL) { |
152 | if (mmap_string_append(gphrase, wordutf8) == NULL) { | 153 | if (mmap_string_append(gphrase, wordutf8) == NULL) { |
154 | mailmime_encoded_word_free(word); | ||
155 | free(wordutf8); | ||
156 | res = MAILIMF_ERROR_MEMORY; | ||
157 | goto free; | ||
158 | } | ||
159 | free(wordutf8); | ||
160 | } | ||
153 | mailmime_encoded_word_free(word); | 161 | mailmime_encoded_word_free(word); |
154 | free(wordutf8); | 162 | first = FALSE; |
155 | res = MAILIMF_ERROR_MEMORY; | 163 | } |
164 | else if (r == MAILIMF_ERROR_PARSE) { | ||
165 | /* do nothing */ | ||
166 | } | ||
167 | else { | ||
168 | res = r; | ||
156 | goto free; | 169 | goto free; |
157 | } | ||
158 | free(wordutf8); | ||
159 | } | 170 | } |
160 | mailmime_encoded_word_free(word); | ||
161 | first = FALSE; | ||
162 | } | ||
163 | else if (r == MAILIMF_ERROR_PARSE) { | ||
164 | /* do nothing */ | ||
165 | } | ||
166 | else { | ||
167 | res = r; | ||
168 | goto free; | ||
169 | } | ||
170 | |||
171 | if (r == MAILIMF_ERROR_PARSE) { | ||
172 | char * raw_word; | ||
173 | 171 | ||
174 | r = mailmime_non_encoded_word_parse(message, length, | 172 | if (r == MAILIMF_ERROR_PARSE) { |
175 | &cur_token, &raw_word); | 173 | char * raw_word; |
176 | if (r == MAILIMF_NO_ERROR) { | 174 | |
177 | if (!first) { | 175 | r = mailmime_non_encoded_word_parse(message, length, |
178 | if (mmap_string_append_c(gphrase, ' ') == NULL) { | 176 | &cur_token, &raw_word); |
179 | free(raw_word); | 177 | if (r == MAILIMF_NO_ERROR) { |
180 | res = MAILIMF_ERROR_MEMORY; | 178 | if (!first) { |
181 | goto free; | 179 | if (mmap_string_append_c(gphrase, ' ') == NULL) { |
182 | } | 180 | free(raw_word); |
183 | } | 181 | res = MAILIMF_ERROR_MEMORY; |
184 | type = TYPE_WORD; | 182 | goto free; |
183 | } | ||
184 | } | ||
185 | type = TYPE_WORD; | ||
185 | 186 | ||
186 | wordutf8 = NULL; | 187 | wordutf8 = NULL; |
187 | r = charconv(tocode, default_fromcode, raw_word, | 188 | r = charconv(tocode, default_fromcode, raw_word, |
188 | strlen(raw_word), &wordutf8); | 189 | strlen(raw_word), &wordutf8); |
189 | 190 | ||
190 | switch (r) { | 191 | switch (r) { |
191 | case MAIL_CHARCONV_ERROR_MEMORY: | 192 | case MAIL_CHARCONV_ERROR_MEMORY: |
192 | free(raw_word); | 193 | free(raw_word); |
193 | res = MAILIMF_ERROR_MEMORY; | 194 | res = MAILIMF_ERROR_MEMORY; |
194 | goto free; | 195 | goto free; |
195 | 196 | ||
196 | case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: | 197 | case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: |
197 | case MAIL_CHARCONV_ERROR_CONV: | 198 | case MAIL_CHARCONV_ERROR_CONV: |
198 | free(raw_word); | 199 | free(raw_word); |
199 | res = MAILIMF_ERROR_PARSE; | 200 | res = MAILIMF_ERROR_PARSE; |
200 | goto free; | 201 | goto free; |
201 | } | 202 | } |
202 | 203 | // LUTZ add | |
203 | if (mmap_string_append(gphrase, wordutf8) == NULL) { | 204 | if ( appendNewLine ) { |
204 | free(wordutf8); | 205 | appendNewLine = FALSE; |
205 | free(raw_word); | 206 | if (mmap_string_append(gphrase, "\n") == NULL) { |
206 | res = MAILIMF_ERROR_MEMORY; | 207 | free(wordutf8); |
207 | goto free; | 208 | free(raw_word); |
208 | } | 209 | res = MAILIMF_ERROR_MEMORY; |
209 | // LUTZ fix | 210 | goto free; |
210 | free(wordutf8); | 211 | } |
211 | free(raw_word); | 212 | } |
212 | first = FALSE; | 213 | //fprintf(stderr,"append *%s* \n",wordutf8 ); |
214 | if (mmap_string_append(gphrase, wordutf8) == NULL) { | ||
215 | free(wordutf8); | ||
216 | free(raw_word); | ||
217 | res = MAILIMF_ERROR_MEMORY; | ||
218 | goto free; | ||
219 | } | ||
220 | // LUTZ fix | ||
221 | free(wordutf8); | ||
222 | free(raw_word); | ||
223 | first = FALSE; | ||
224 | } | ||
225 | else if (r == MAILIMF_ERROR_PARSE) { | ||
226 | // LUTZ add | ||
227 | if ( cur_token >= length ) | ||
228 | break; | ||
229 | ++cur_token; | ||
230 | appendNewLine = TRUE; | ||
231 | } | ||
232 | else { | ||
233 | res = r; | ||
234 | goto free; | ||
235 | } | ||
213 | } | 236 | } |
214 | else if (r == MAILIMF_ERROR_PARSE) { | ||
215 | break; | ||
216 | } | ||
217 | else { | ||
218 | res = r; | ||
219 | goto free; | ||
220 | } | ||
221 | } | ||
222 | } | 237 | } |
223 | 238 | ||
224 | if (first) { | 239 | if (first) { |
@@ -287,8 +302,8 @@ mailmime_non_encoded_word_parse(const char * message, size_t length, | |||
287 | } | 302 | } |
288 | 303 | ||
289 | if (cur_token - begin == 0) { | 304 | if (cur_token - begin == 0) { |
290 | res = MAILIMF_ERROR_PARSE; | 305 | res = MAILIMF_ERROR_PARSE; |
291 | goto err; | 306 | goto err; |
292 | } | 307 | } |
293 | 308 | ||
294 | text = malloc(cur_token - begin + 1); | 309 | text = malloc(cur_token - begin + 1); |
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 | |||
@@ -76,7 +76,6 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin | |||
76 | } else if (enc.lower()=="binary") { | 76 | } else if (enc.lower()=="binary") { |
77 | mimetype = MAILMIME_MECHANISM_BINARY; | 77 | mimetype = MAILMIME_MECHANISM_BINARY; |
78 | } | 78 | } |
79 | |||
80 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, | 79 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, |
81 | &result_text,&target_length); | 80 | &result_text,&target_length); |
82 | 81 | ||
@@ -95,11 +94,13 @@ QString AbstractMail::convert_String(const char*text) | |||
95 | int err = MAILIMF_NO_ERROR; | 94 | int err = MAILIMF_NO_ERROR; |
96 | 95 | ||
97 | QString result(text); | 96 | QString result(text); |
98 | 97 | //qDebug("convert_String %s ", text); | |
98 | //err = mailmime_encoded_phrase_parse("iso-8859-1", | ||
99 | // text, strlen(text),&index, "iso-8859-1",&res); | ||
99 | err = mailmime_encoded_phrase_parse("iso-8859-1", | 100 | err = mailmime_encoded_phrase_parse("iso-8859-1", |
100 | text, strlen(text),&index, "iso-8859-1",&res); | 101 | text, strlen(text),&index, "utf-8",&res); |
101 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | 102 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { |
102 | result = QString(res); | 103 | result = QString::fromUtf8(res); |
103 | } | 104 | } |
104 | //qDebug("convert_String:%s ",result.latin1() ); | 105 | //qDebug("convert_String:%s ",result.latin1() ); |
105 | if (res) free(res); | 106 | if (res) free(res); |
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 | |||
@@ -220,6 +220,20 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
220 | } | 220 | } |
221 | b = QString(res->Content()); | 221 | b = QString(res->Content()); |
222 | delete res; | 222 | delete res; |
223 | size_t index = 0; | ||
224 | char*resu = 0; | ||
225 | int err = MAILIMF_NO_ERROR; | ||
226 | QString charset = part->searchParamter( "charset"); | ||
227 | qDebug("CHARSET %s ",charset.latin1() ); | ||
228 | if ( !charset.isEmpty() ) { | ||
229 | err = mailmime_encoded_phrase_parse(charset.latin1(), | ||
230 | b.latin1(), b.length(),&index, "utf-8",&resu); | ||
231 | if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { | ||
232 | //qDebug("res %d %s ", index, resu); | ||
233 | b = QString::fromUtf8(resu); | ||
234 | } | ||
235 | if (resu) free(resu); | ||
236 | } | ||
223 | target->setBodytext(b); | 237 | target->setBodytext(b); |
224 | target->setDescription(part); | 238 | target->setDescription(part); |
225 | } else { | 239 | } else { |
@@ -344,7 +358,7 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) | |||
344 | if ( box->mb_display_name == NULL ) { | 358 | if ( box->mb_display_name == NULL ) { |
345 | result.append( box->mb_addr_spec ); | 359 | result.append( box->mb_addr_spec ); |
346 | } else { | 360 | } else { |
347 | result.append( convert_String(box->mb_display_name).latin1() ); | 361 | result.append( convert_String(box->mb_display_name) ); |
348 | result.append( " <" ); | 362 | result.append( " <" ); |
349 | result.append( box->mb_addr_spec ); | 363 | result.append( box->mb_addr_spec ); |
350 | result.append( ">" ); | 364 | 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 | |||
@@ -752,6 +752,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
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 | |||
756 | size_t index = 0; | ||
757 | char*res = 0; | ||
758 | int err = MAILIMF_NO_ERROR; | ||
759 | |||
760 | QString charset = currentPart->searchParamter( "charset"); | ||
761 | qDebug("CHARSET %s ",charset.latin1() ); | ||
762 | //if ( false ) { | ||
763 | if ( !charset.isEmpty() ) { | ||
764 | //err = mailmime_encoded_phrase_parse("iso-8859-1", | ||
765 | // text, strlen(text),&index, "iso-8859-1",&res); | ||
766 | err = mailmime_encoded_phrase_parse(charset.latin1(), | ||
767 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); | ||
768 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | ||
769 | //qDebug("res %d %s ", index, res); | ||
770 | body_text = QString::fromUtf8(res); | ||
771 | } | ||
772 | if (res) free(res); | ||
773 | } | ||
755 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); | 774 | //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); |
756 | target_body->setDescription(currentPart); | 775 | target_body->setDescription(currentPart); |
757 | target_body->setBodytext(body_text); | 776 | target_body->setBodytext(body_text); |
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 | |||
@@ -125,6 +125,7 @@ RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) | |||
125 | mailmessage_free(msg); | 125 | mailmessage_free(msg); |
126 | return body; | 126 | return body; |
127 | } | 127 | } |
128 | qDebug("MBOXwrapper::fetchBody "); | ||
128 | body = parseMail(msg); | 129 | body = parseMail(msg); |
129 | mailmessage_fetch_result_free(msg,data); | 130 | mailmessage_fetch_result_free(msg,data); |
130 | mailfolder_free(folder); | 131 | mailfolder_free(folder); |
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 | |||
@@ -128,6 +128,7 @@ void MHwrapper::answeredMail(const RecMailP&) | |||
128 | 128 | ||
129 | RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) | 129 | RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) |
130 | { | 130 | { |
131 | qDebug("MHwrapper::fetchBody "); | ||
131 | RecBodyP body = new RecBody(); | 132 | RecBodyP body = new RecBody(); |
132 | init_storage(); | 133 | init_storage(); |
133 | if (!m_storage) { | 134 | if (!m_storage) { |
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 5ef5b6a..484a635 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -55,8 +55,8 @@ void MailListViewItem::showEntry() | |||
55 | //setText(3, fsize + "MB"); | 55 | //setText(3, fsize + "MB"); |
56 | mKeyMap.insert(3, "M" +fsort ); | 56 | mKeyMap.insert(3, "M" +fsort ); |
57 | } | 57 | } |
58 | setText(1,QString::fromUtf8( mail_data->getSubject().latin1())); | 58 | setText(1,mail_data->getSubject()); |
59 | setText(2,QString::fromUtf8( mail_data->getFrom().latin1())); | 59 | setText(2,mail_data->getFrom()); |
60 | #if 0 | 60 | #if 0 |
61 | QString date = mail_data->getDate(); | 61 | QString date = mail_data->getDate(); |
62 | 62 | ||
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 98eb9a5..3013931 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -12,6 +12,7 @@ | |||
12 | #ifdef DESKTOP_VERSION | 12 | #ifdef DESKTOP_VERSION |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | #include <qstatusbar.h> | 14 | #include <qstatusbar.h> |
15 | #include <kabc/stdaddressbook.h> | ||
15 | extern QStatusBar* globalSstatusBarMainWindow; | 16 | extern QStatusBar* globalSstatusBarMainWindow; |
16 | #else | 17 | #else |
17 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
@@ -20,7 +21,7 @@ extern QStatusBar* globalSstatusBarMainWindow; | |||
20 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
21 | #include <KDGanttMinimizeSplitter.h> | 22 | #include <KDGanttMinimizeSplitter.h> |
22 | 23 | ||
23 | #include <kabc/stdaddressbook.h> | 24 | #include "koprefs.h" |
24 | 25 | ||
25 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 26 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
26 | : QMainWindow( parent, name ) //, flags ) | 27 | : QMainWindow( parent, name ) //, flags ) |
@@ -99,7 +100,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
99 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , | 100 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , |
100 | 0, 0, this ); | 101 | 0, 0, this ); |
101 | editAccounts->addTo( settingsMenu ); | 102 | editAccounts->addTo( settingsMenu ); |
102 | 103 | codecMenu = new QPopupMenu( menuBar ); | |
104 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); | ||
105 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); | ||
106 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); | ||
107 | codecMenu->insertItem( "Chinese (big-5)",3,3); | ||
108 | codecMenu->insertItem( "Unicode (utf-8)",4,4); | ||
109 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); | ||
110 | settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); | ||
103 | //setCentralWidget( view ); | 111 | //setCentralWidget( view ); |
104 | 112 | ||
105 | QVBox* wrapperBox = new QVBox( this ); | 113 | QVBox* wrapperBox = new QVBox( this ); |
@@ -183,6 +191,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
183 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); | 191 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); |
184 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); | 192 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); |
185 | li->addTo(helpMenu); | 193 | li->addTo(helpMenu); |
194 | connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); | ||
195 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | ||
186 | #ifdef DESKTOP_VERSION | 196 | #ifdef DESKTOP_VERSION |
187 | resize ( 640, 480 ); | 197 | resize ( 640, 480 ); |
188 | #endif | 198 | #endif |
@@ -192,6 +202,37 @@ MainWindow::~MainWindow() | |||
192 | { | 202 | { |
193 | } | 203 | } |
194 | 204 | ||
205 | void MainWindow::slotSetCodec( int codec ) | ||
206 | { | ||
207 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); | ||
208 | //qDebug("codec %d ", codec); | ||
209 | KOPrefs::instance()->mCurrentCodec = codec; | ||
210 | KOPrefs::instance()->isDirty = true; | ||
211 | QString name; | ||
212 | switch ( codec ) { | ||
213 | case 0: | ||
214 | name = "iso-8859-1"; | ||
215 | break; | ||
216 | case 1: | ||
217 | name = "iso-8859-5"; | ||
218 | break; | ||
219 | case 2: | ||
220 | name = "iso-8859-15"; | ||
221 | break; | ||
222 | case 3: | ||
223 | name = "big-5"; | ||
224 | break; | ||
225 | case 4: | ||
226 | name = "utf-8"; | ||
227 | break; | ||
228 | case 5: | ||
229 | name = KOPrefs::instance()->mSendCodec.lower(); | ||
230 | break; | ||
231 | } | ||
232 | KOPrefs::instance()->mCurrentCodeName = name ; | ||
233 | codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); | ||
234 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); | ||
235 | } | ||
195 | void MainWindow::showLicence() | 236 | void MainWindow::showLicence() |
196 | { | 237 | { |
197 | KApplication::showLicence(); | 238 | KApplication::showLicence(); |
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index f5ab69b..d0a5caf 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h | |||
@@ -45,6 +45,7 @@ protected slots: | |||
45 | virtual void slotGetMail() = 0; | 45 | virtual void slotGetMail() = 0; |
46 | virtual void slotGetAllMail() = 0; | 46 | virtual void slotGetAllMail() = 0; |
47 | virtual void slotDeleteMail(); | 47 | virtual void slotDeleteMail(); |
48 | virtual void slotSetCodec(int); | ||
48 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 49 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
49 | virtual void slotAdjustLayout(); | 50 | virtual void slotAdjustLayout(); |
50 | virtual void slotEditSettings(); | 51 | virtual void slotEditSettings(); |
@@ -57,7 +58,7 @@ protected: | |||
57 | QToolBar *toolBar; | 58 | QToolBar *toolBar; |
58 | StatusWidget *statusWidget; | 59 | StatusWidget *statusWidget; |
59 | QPEMenuBar *menuBar; | 60 | QPEMenuBar *menuBar; |
60 | QPopupMenu *mailMenu, *settingsMenu; | 61 | QPopupMenu *mailMenu, *settingsMenu, *codecMenu; |
61 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 62 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
62 | *editSettings, *editAccounts, *syncFolders; | 63 | *editSettings, *editAccounts, *syncFolders; |
63 | AccountView *folderView; | 64 | AccountView *folderView; |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index af5376f..18a5600 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <libmailwrapper/smtpwrapper.h> | 33 | #include <libmailwrapper/smtpwrapper.h> |
34 | #include <libmailwrapper/mailtypes.h> | 34 | #include <libmailwrapper/mailtypes.h> |
35 | #include <libmailwrapper/abstractmail.h> | 35 | #include <libmailwrapper/abstractmail.h> |
36 | #include "koprefs.h" | ||
36 | 37 | ||
37 | //using namespace Opie::Core; | 38 | //using namespace Opie::Core; |
38 | 39 | ||
@@ -237,6 +238,7 @@ void OpieMail::slotEditSettings() | |||
237 | #endif | 238 | #endif |
238 | settingsDialog.exec(); | 239 | settingsDialog.exec(); |
239 | 240 | ||
241 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | ||
240 | // KApplication::execDialog(settingsDialog); | 242 | // KApplication::execDialog(settingsDialog); |
241 | } | 243 | } |
242 | 244 | ||
@@ -263,10 +265,10 @@ void OpieMail::replyMail() | |||
263 | 265 | ||
264 | QString rtext; | 266 | QString rtext; |
265 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 267 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
266 | .arg( QString::fromUtf8( mail->getFrom().latin1())) | 268 | .arg( mail->getFrom()) |
267 | .arg( QString::fromUtf8( mail->getDate().latin1() )); | 269 | .arg( mail->getDate()); |
268 | 270 | ||
269 | QString text = QString::fromUtf8( body->Bodytext().latin1() ); | 271 | QString text = body->Bodytext(); |
270 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 272 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
271 | QStringList::Iterator it; | 273 | QStringList::Iterator it; |
272 | for (it = lines.begin(); it != lines.end(); it++) | 274 | for (it = lines.begin(); it != lines.end(); it++) |
@@ -282,13 +284,13 @@ void OpieMail::replyMail() | |||
282 | Settings *settings = new Settings(); | 284 | Settings *settings = new Settings(); |
283 | ComposeMail composer( settings ,this, 0, true); | 285 | ComposeMail composer( settings ,this, 0, true); |
284 | if (mail->Replyto().isEmpty()) { | 286 | if (mail->Replyto().isEmpty()) { |
285 | composer.setTo( QString::fromUtf8( mail->getFrom().latin1())); | 287 | composer.setTo( mail->getFrom()); |
286 | } else { | 288 | } else { |
287 | composer.setTo( QString::fromUtf8(mail->Replyto().latin1())); | 289 | composer.setTo( mail->Replyto()); |
288 | } | 290 | } |
289 | composer.setSubject( prefix + QString::fromUtf8( mail->getSubject().latin1() ) ); | 291 | composer.setSubject( prefix + mail->getSubject()); |
290 | composer.setMessage( rtext ); | 292 | composer.setMessage( rtext ); |
291 | composer.setInReplyTo( QString::fromUtf8(mail->Msgid().latin1())); | 293 | composer.setInReplyTo( mail->Msgid()); |
292 | 294 | ||
293 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 295 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
294 | { | 296 | { |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 2093678..4883231 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -98,7 +98,7 @@ void ViewMail::setBody(const RecBodyP&body ) | |||
98 | { | 98 | { |
99 | 99 | ||
100 | m_body = body; | 100 | m_body = body; |
101 | m_mail[2] = QString::fromUtf8( body->Bodytext().latin1() ); | 101 | m_mail[2] = body->Bodytext(); |
102 | // qDebug("********text %s ",m_mail[2].latin1() ); | 102 | // qDebug("********text %s ",m_mail[2].latin1() ); |
103 | attachbutton->setEnabled(body->Parts().count()>0); | 103 | attachbutton->setEnabled(body->Parts().count()>0); |
104 | attachments->setEnabled(body->Parts().count()>0); | 104 | attachments->setEnabled(body->Parts().count()>0); |
@@ -301,10 +301,10 @@ void ViewMail::setMail(const RecMailP&mail ) | |||
301 | 301 | ||
302 | m_recMail = mail; | 302 | m_recMail = mail; |
303 | 303 | ||
304 | m_mail[0] = QString::fromUtf8( mail->getFrom().latin1() ); | 304 | m_mail[0] = mail->getFrom(); |
305 | m_mail[1] = QString::fromUtf8( mail->getSubject().latin1() ); | 305 | m_mail[1] = mail->getSubject(); |
306 | m_mail[3] = QString::fromUtf8( mail->getDate().latin1() ); | 306 | m_mail[3] = mail->getDate(); |
307 | m_mail[4] = QString::fromUtf8( mail->Msgid().latin1() ); | 307 | m_mail[4] = mail->Msgid(); |
308 | 308 | ||
309 | m_mail2[0] = mail->To(); | 309 | m_mail2[0] = mail->To(); |
310 | m_mail2[1] = mail->CC(); | 310 | m_mail2[1] = mail->CC(); |
@@ -350,9 +350,9 @@ void ViewMail::setText() | |||
350 | QString bccString; | 350 | QString bccString; |
351 | 351 | ||
352 | 352 | ||
353 | toString = QString::fromUtf8(m_mail2[0].join(",").latin1()); | 353 | toString = m_mail2[0].join(","); |
354 | ccString = QString::fromUtf8(m_mail2[1].join(",").latin1()); | 354 | ccString = m_mail2[1].join(","); |
355 | bccString = QString::fromUtf8(m_mail2[2].join(",").latin1()); | 355 | bccString = m_mail2[2].join(","); |
356 | 356 | ||
357 | 357 | ||
358 | setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); | 358 | setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); |
@@ -450,9 +450,9 @@ void ViewMail::slotReply() | |||
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( QString::fromUtf8( m_recMail->getFrom().latin1())); | 453 | composer.setTo(m_recMail->getFrom()); |
454 | } else { | 454 | } else { |
455 | composer.setTo( QString::fromUtf8( m_recMail->Replyto().latin1())); | 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 ); |