-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 | |||
@@ -144,17 +144,18 @@ void KOPrefsDialog::setupMailTab() | |||
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 | 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( 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(mCodecEdit,3,3,0,1); |
153 | topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); | 154 | topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); |
154 | 155 | */ | |
155 | } | 156 | } |
156 | void KOPrefsDialog::setupFontsTab() | 157 | void KOPrefsDialog::setupFontsTab() |
157 | { | 158 | { |
158 | 159 | ||
159 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 160 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
160 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 161 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
@@ -195,20 +196,20 @@ void KOPrefsDialog::setupFontsTab() | |||
195 | } | 196 | } |
196 | void KOPrefsDialog::usrReadConfig() | 197 | void KOPrefsDialog::usrReadConfig() |
197 | { | 198 | { |
198 | 199 | ||
199 | mNameEdit->setText(KOPrefs::instance()->mName); | 200 | mNameEdit->setText(KOPrefs::instance()->mName); |
200 | mEmailEdit->setText(KOPrefs::instance()->mEmail); | 201 | mEmailEdit->setText(KOPrefs::instance()->mEmail); |
201 | mCodecEdit->setText(KOPrefs::instance()->mSendCodec); | 202 | //mCodecEdit->setText(KOPrefs::instance()->mSendCodec); |
202 | kdelibcfg->readConfig(); | 203 | kdelibcfg->readConfig(); |
203 | } | 204 | } |
204 | void KOPrefsDialog::usrWriteConfig() | 205 | void KOPrefsDialog::usrWriteConfig() |
205 | { | 206 | { |
206 | KOPrefs::instance()->mName = mNameEdit->text(); | 207 | KOPrefs::instance()->mName = mNameEdit->text(); |
207 | KOPrefs::instance()->mEmail = mEmailEdit->text(); | 208 | KOPrefs::instance()->mEmail = mEmailEdit->text(); |
208 | KOPrefs::instance()->mSendCodec = mCodecEdit->text(); | 209 | //KOPrefs::instance()->mSendCodec = mCodecEdit->text(); |
209 | kdelibcfg->writeConfig(); | 210 | kdelibcfg->writeConfig(); |
210 | 211 | ||
211 | 212 | ||
212 | } | 213 | } |
213 | 214 | ||
214 | #if 0 | 215 | #if 0 |
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 | |||
@@ -10,12 +10,13 @@ | |||
10 | 10 | ||
11 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
12 | const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; | 12 | const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; |
13 | 13 | ||
14 | Generatemail::Generatemail() | 14 | Generatemail::Generatemail() |
15 | { | 15 | { |
16 | mCharset = "iso-8859-1"; | ||
16 | } | 17 | } |
17 | 18 | ||
18 | Generatemail::~Generatemail() | 19 | Generatemail::~Generatemail() |
19 | { | 20 | { |
20 | } | 21 | } |
21 | 22 | ||
@@ -142,13 +143,13 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet | |||
142 | 143 | ||
143 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; | 144 | int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; |
144 | int mechanism = MAILMIME_MECHANISM_BASE64; | 145 | int mechanism = MAILMIME_MECHANISM_BASE64; |
145 | 146 | ||
146 | if ( mimetype.startsWith( "text/" ) ) { | 147 | if ( mimetype.startsWith( "text/" ) ) { |
147 | param = mailmime_parameter_new( strdup( "charset" ), | 148 | param = mailmime_parameter_new( strdup( "charset" ), |
148 | strdup( "iso-8859-1" ) ); | 149 | strdup( mCharset.latin1() ) ); |
149 | mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | 150 | mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; |
150 | } | 151 | } |
151 | 152 | ||
152 | fields = mailmime_fields_new_filename( | 153 | fields = mailmime_fields_new_filename( |
153 | disptype, name, | 154 | disptype, name, |
154 | mechanism ); | 155 | mechanism ); |
@@ -167,13 +168,14 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet | |||
167 | filePart = mailmime_new_empty( content, fields ); | 168 | filePart = mailmime_new_empty( content, fields ); |
168 | } | 169 | } |
169 | if (filePart) { | 170 | if (filePart) { |
170 | if (filename.length()>0) { | 171 | if (filename.length()>0) { |
171 | err = mailmime_set_body_file( filePart, file ); | 172 | err = mailmime_set_body_file( filePart, file ); |
172 | } else { | 173 | } else { |
173 | err = mailmime_set_body_text(filePart,strdup( TextContent.utf8()),TextContent.utf8().length()); | 174 | err = mailmime_set_body_text(filePart,strdup( TextContent.utf8().data()),TextContent.utf8().length()); |
175 | //err = mailmime_set_body_text(filePart,strdup( TextContent.latin1()),TextContent.length()); | ||
174 | } | 176 | } |
175 | if (err != MAILIMF_NO_ERROR) { | 177 | if (err != MAILIMF_NO_ERROR) { |
176 | qDebug("Error setting body with file "); | 178 | qDebug("Error setting body with file "); |
177 | mailmime_free( filePart ); | 179 | mailmime_free( filePart ); |
178 | filePart = 0; | 180 | filePart = 0; |
179 | } | 181 | } |
@@ -224,14 +226,15 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { | |||
224 | mailmime *txtPart; | 226 | mailmime *txtPart; |
225 | mailmime_fields *fields; | 227 | mailmime_fields *fields; |
226 | mailmime_content *content; | 228 | mailmime_content *content; |
227 | mailmime_parameter *param; | 229 | mailmime_parameter *param; |
228 | int err; | 230 | int err; |
229 | QCString __str; | 231 | QCString __str; |
232 | //qDebug(" Generatemail::buildTxtPart %s", str.latin1()); | ||
230 | param = mailmime_parameter_new( strdup( "charset" ), | 233 | param = mailmime_parameter_new( strdup( "charset" ), |
231 | strdup( "iso-8859-1" ) ); | 234 | strdup( mCharset.latin1() ) ); |
232 | if ( param == NULL ) | 235 | if ( param == NULL ) |
233 | goto err_free; | 236 | goto err_free; |
234 | 237 | ||
235 | content = mailmime_content_new_with_str( "text/plain" ); | 238 | content = mailmime_content_new_with_str( "text/plain" ); |
236 | if ( content == NULL ) | 239 | if ( content == NULL ) |
237 | goto err_free_param; | 240 | goto err_free_param; |
@@ -245,14 +248,15 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { | |||
245 | goto err_free_content; | 248 | goto err_free_content; |
246 | 249 | ||
247 | txtPart = mailmime_new_empty( content, fields ); | 250 | txtPart = mailmime_new_empty( content, fields ); |
248 | if ( txtPart == NULL ) | 251 | if ( txtPart == NULL ) |
249 | goto err_free_fields; | 252 | goto err_free_fields; |
250 | { | 253 | { |
251 | __str = str.utf8(); | 254 | //__str = str.utf8(); |
252 | err = mailmime_set_body_text( txtPart, __str.data(), __str.length() ); | 255 | __str = QCString (str.latin1()); |
256 | err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() ); | ||
253 | } | 257 | } |
254 | if ( err != MAILIMF_NO_ERROR ) | 258 | if ( err != MAILIMF_NO_ERROR ) |
255 | goto err_free_txtPart; | 259 | goto err_free_txtPart; |
256 | 260 | ||
257 | return txtPart; // Success :) | 261 | return txtPart; // Success :) |
258 | 262 | ||
@@ -395,12 +399,14 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma | |||
395 | 399 | ||
396 | mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &mail ) { | 400 | mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &mail ) { |
397 | mailmime *message, *txtPart; | 401 | mailmime *message, *txtPart; |
398 | mailimf_fields *fields; | 402 | mailimf_fields *fields; |
399 | int err; | 403 | int err; |
400 | 404 | ||
405 | //LR disabled for now | ||
406 | //mCharset = mail->getCharset().lower(); | ||
401 | fields = createImfFields( mail ); | 407 | fields = createImfFields( mail ); |
402 | if ( fields == NULL ) | 408 | if ( fields == NULL ) |
403 | goto err_free; | 409 | goto err_free; |
404 | 410 | ||
405 | message = mailmime_new_message_data( NULL ); | 411 | message = mailmime_new_message_data( NULL ); |
406 | if ( message == NULL ) | 412 | if ( message == NULL ) |
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 | |||
@@ -39,9 +39,10 @@ protected: | |||
39 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); | 39 | mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); |
40 | mailimf_fields *createImfFields(const Opie::Core::OSmartPointer<Mail> &mail ); | 40 | mailimf_fields *createImfFields(const Opie::Core::OSmartPointer<Mail> &mail ); |
41 | mailmime *createMimeMail(const Opie::Core::OSmartPointer<Mail>&mail ); | 41 | mailmime *createMimeMail(const Opie::Core::OSmartPointer<Mail>&mail ); |
42 | clist *createRcptList( mailimf_fields *fields ); | 42 | clist *createRcptList( mailimf_fields *fields ); |
43 | 43 | ||
44 | static const char* USER_AGENT; | 44 | static const char* USER_AGENT; |
45 | QString mCharset; | ||
45 | }; | 46 | }; |
46 | 47 | ||
47 | #endif | 48 | #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 | |||
@@ -222,13 +222,14 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m | |||
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 (false ) { |
229 | //if ( !charset.isEmpty() ) { | ||
229 | target->setCharset( charset ); | 230 | target->setCharset( charset ); |
230 | err = mailmime_encoded_phrase_parse(charset.latin1(), | 231 | err = mailmime_encoded_phrase_parse(charset.latin1(), |
231 | b.latin1(), b.length(),&index, "utf-8",&resu); | 232 | b.latin1(), b.length(),&index, "utf-8",&resu); |
232 | if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { | 233 | if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { |
233 | //qDebug("res %d %s ", index, resu); | 234 | //qDebug("res %d %s ", index, resu); |
234 | b = QString::fromUtf8(resu); | 235 | b = QString::fromUtf8(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 | |||
@@ -756,14 +756,14 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
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 | target_body->setCharset( charset ); |
765 | //err = mailmime_encoded_phrase_parse("iso-8859-1", | 765 | //err = mailmime_encoded_phrase_parse("iso-8859-1", |
766 | // text, strlen(text),&index, "iso-8859-1",&res); | 766 | // text, strlen(text),&index, "iso-8859-1",&res); |
767 | err = mailmime_encoded_phrase_parse(charset.latin1(), | 767 | err = mailmime_encoded_phrase_parse(charset.latin1(), |
768 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); | 768 | body_text.latin1(), body_text.length(),&index, "utf-8",&res); |
769 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | 769 | if (err == MAILIMF_NO_ERROR && res && strlen(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 | |||
@@ -80,13 +80,13 @@ public: | |||
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; } | 85 | void setCharset( const QString&a ) { charset= a; } |
86 | const QString& getCharset() { return charset; } | 86 | const QString& getCharset() const { return charset; } |
87 | 87 | ||
88 | private: | 88 | private: |
89 | QList<Attachment> attList; | 89 | QList<Attachment> attList; |
90 | QString name, mail, to, cc, bcc, reply, subject, message, charset; | 90 | QString name, mail, to, cc, bcc, reply, subject, message, charset; |
91 | QStringList m_in_reply_to; | 91 | QStringList m_in_reply_to; |
92 | }; | 92 | }; |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 3013931..8c0a4cb 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -104,13 +104,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
104 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); | 104 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); |
105 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); | 105 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); |
106 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); | 106 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); |
107 | codecMenu->insertItem( "Chinese (big-5)",3,3); | 107 | codecMenu->insertItem( "Chinese (big-5)",3,3); |
108 | codecMenu->insertItem( "Unicode (utf-8)",4,4); | 108 | codecMenu->insertItem( "Unicode (utf-8)",4,4); |
109 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); | 109 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); |
110 | settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); | 110 | //disabled |
111 | //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); | ||
111 | //setCentralWidget( view ); | 112 | //setCentralWidget( view ); |
112 | 113 | ||
113 | QVBox* wrapperBox = new QVBox( this ); | 114 | QVBox* wrapperBox = new QVBox( this ); |
114 | setCentralWidget( wrapperBox ); | 115 | setCentralWidget( wrapperBox ); |
115 | 116 | ||
116 | // QWidget *view = new QWidget( wrapperBox ); | 117 | // QWidget *view = new QWidget( wrapperBox ); |