summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/koprefsdialog.cpp7
-rw-r--r--kmicromail/libmailwrapper/generatemail.cpp16
-rw-r--r--kmicromail/libmailwrapper/generatemail.h1
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp3
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp4
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h2
-rw-r--r--kmicromail/mainwindow.cpp3
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
@@ -118,123 +118,124 @@ void KOPrefsDialog::setupMainTab()
118 mNameEdit = new QLineEdit(topFrame); 118 mNameEdit = new QLineEdit(topFrame);
119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
120 topLayout->addWidget(mNameLabel,0,0); 120 topLayout->addWidget(mNameLabel,0,0);
121 topLayout->addWidget(mNameEdit,0,1); 121 topLayout->addWidget(mNameEdit,0,1);
122 122
123 mEmailEdit = new QLineEdit(topFrame); 123 mEmailEdit = new QLineEdit(topFrame);
124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
125 topLayout->addWidget(mEmailLabel,1,0); 125 topLayout->addWidget(mEmailLabel,1,0);
126 topLayout->addWidget(mEmailEdit,1,1); 126 topLayout->addWidget(mEmailEdit,1,1);
127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); 127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
128 topLayout->addMultiCellWidget(lab,2,2,0,1); 128 topLayout->addMultiCellWidget(lab,2,2,0,1);
129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), 129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
130 &(KOPrefs::instance()->mUseKapi),topFrame); 130 &(KOPrefs::instance()->mUseKapi),topFrame);
131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); 131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
132} 132}
133 133
134void KOPrefsDialog::setupMailTab() 134void KOPrefsDialog::setupMailTab()
135{ 135{
136 QFrame *topFrame = addPage(i18n("Mail"),0,0); 136 QFrame *topFrame = addPage(i18n("Mail"),0,0);
137 137
138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
139 topLayout->setSpacing(spacingHint()); 139 topLayout->setSpacing(spacingHint());
140 topLayout->setMargin(marginHint()); 140 topLayout->setMargin(marginHint());
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 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}
156void KOPrefsDialog::setupFontsTab() 157void 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));
161 162
162 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 163 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
163 topLayout->setSpacing(1); 164 topLayout->setSpacing(1);
164 topLayout->setMargin(3); 165 topLayout->setMargin(3);
165 KPrefsDialogWidFont * tVFont; 166 KPrefsDialogWidFont * tVFont;
166 int i = 0; 167 int i = 0;
167 KPrefsDialogWidFont *timeLabelsFont = 168 KPrefsDialogWidFont *timeLabelsFont =
168 addWidFont(i18n("OK"),i18n("Application(nr)"), 169 addWidFont(i18n("OK"),i18n("Application(nr)"),
169 &(KOPrefs::instance()->mAppFont),topFrame); 170 &(KOPrefs::instance()->mAppFont),topFrame);
170 topLayout->addWidget(timeLabelsFont->label(),i,0); 171 topLayout->addWidget(timeLabelsFont->label(),i,0);
171 topLayout->addWidget(timeLabelsFont->preview(),i,1); 172 topLayout->addWidget(timeLabelsFont->preview(),i,1);
172 topLayout->addWidget(timeLabelsFont->button(),i,2); 173 topLayout->addWidget(timeLabelsFont->button(),i,2);
173 ++i; 174 ++i;
174 175
175 176
176 timeLabelsFont = 177 timeLabelsFont =
177 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), 178 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
178 &(KOPrefs::instance()->mComposeFont),topFrame); 179 &(KOPrefs::instance()->mComposeFont),topFrame);
179 topLayout->addWidget(timeLabelsFont->label(),i,0); 180 topLayout->addWidget(timeLabelsFont->label(),i,0);
180 topLayout->addWidget(timeLabelsFont->preview(),i,1); 181 topLayout->addWidget(timeLabelsFont->preview(),i,1);
181 topLayout->addWidget(timeLabelsFont->button(),i,2); 182 topLayout->addWidget(timeLabelsFont->button(),i,2);
182 ++i; 183 ++i;
183 184
184 KPrefsDialogWidFont *timeBarFont = 185 KPrefsDialogWidFont *timeBarFont =
185 addWidFont(i18n("Hello"),i18n("Read mail:"), 186 addWidFont(i18n("Hello"),i18n("Read mail:"),
186 &(KOPrefs::instance()->mReadFont),topFrame); 187 &(KOPrefs::instance()->mReadFont),topFrame);
187 topLayout->addWidget(timeBarFont->label(),i,0); 188 topLayout->addWidget(timeBarFont->label(),i,0);
188 topLayout->addWidget(timeBarFont->preview(),i,1); 189 topLayout->addWidget(timeBarFont->preview(),i,1);
189 topLayout->addWidget(timeBarFont->button(),i,2); 190 topLayout->addWidget(timeBarFont->button(),i,2);
190 ++i; 191 ++i;
191 192
192 topLayout->setColStretch(1,1); 193 topLayout->setColStretch(1,1);
193 topLayout->setRowStretch(4,1); 194 topLayout->setRowStretch(4,1);
194 195
195} 196}
196void KOPrefsDialog::usrReadConfig() 197void 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}
204void KOPrefsDialog::usrWriteConfig() 205void 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
215void KOPrefsDialog::setupLocaleDateTab() 216void KOPrefsDialog::setupLocaleDateTab()
216{ 217{
217QFrame *topFrame = addPage(i18n("Date Format"),0,0); 218QFrame *topFrame = addPage(i18n("Date Format"),0,0);
218 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 219 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
219 topLayout->setSpacing(spacingHint()); 220 topLayout->setSpacing(spacingHint());
220 topLayout->setMargin(marginHint()); 221 topLayout->setMargin(marginHint());
221 int iii = 0; 222 int iii = 0;
222 223
223 224
224 KPrefsWidRadios *syncPrefsGroup = 225 KPrefsWidRadios *syncPrefsGroup =
225 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 226 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
226 QString format; 227 QString format;
227 if ( QApplication::desktop()->width() < 480 ) 228 if ( QApplication::desktop()->width() < 480 )
228 format = "(%d.%m.%Y)"; 229 format = "(%d.%m.%Y)";
229 else 230 else
230 format = "(%d.%m.%Y|%A %d %B %Y)"; 231 format = "(%d.%m.%Y|%A %d %B %Y)";
231 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 232 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
232 if ( QApplication::desktop()->width() < 480 ) 233 if ( QApplication::desktop()->width() < 480 )
233 format = "(%m.%d.%Y)"; 234 format = "(%m.%d.%Y)";
234 else 235 else
235 format = "(%m.%d.%Y|%A %B %d %Y)"; 236 format = "(%m.%d.%Y|%A %B %d %Y)";
236 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 237 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
237 if ( QApplication::desktop()->width() < 480 ) 238 if ( QApplication::desktop()->width() < 480 )
238 format = "(%Y-%m-%d)"; 239 format = "(%Y-%m-%d)";
239 else 240 else
240 format = "(%Y-%m-%d|%A %Y %B %d)"; 241 format = "(%Y-%m-%d|%A %Y %B %d)";
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
@@ -1,47 +1,48 @@
1#include "generatemail.h" 1#include "generatemail.h"
2#include "mailwrapper.h" 2#include "mailwrapper.h"
3 3
4#include <libetpan/libetpan.h> 4#include <libetpan/libetpan.h>
5 5
6//#include <qt.h> 6//#include <qt.h>
7 7
8#include <stdlib.h> 8#include <stdlib.h>
9#include <qfileinfo.h> 9#include <qfileinfo.h>
10 10
11using namespace Opie::Core; 11using namespace Opie::Core;
12const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; 12const char* Generatemail::USER_AGENT="KOpieMail 33 1/3";
13 13
14Generatemail::Generatemail() 14Generatemail::Generatemail()
15{ 15{
16 mCharset = "iso-8859-1";
16} 17}
17 18
18Generatemail::~Generatemail() 19Generatemail::~Generatemail()
19{ 20{
20} 21}
21 22
22void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { 23void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) {
23 clistiter *it, *it2; 24 clistiter *it, *it2;
24 25
25 for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { 26 for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) {
26 mailimf_address *addr; 27 mailimf_address *addr;
27 addr = (mailimf_address *) it->data; 28 addr = (mailimf_address *) it->data;
28 29
29 if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { 30 if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) {
30 esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); 31 esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL );
31 } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { 32 } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) {
32 clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; 33 clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list;
33 for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { 34 for ( it2 = clist_begin( l ); it2; it2 = it2->next ) {
34 mailimf_mailbox *mbox; 35 mailimf_mailbox *mbox;
35 mbox = (mailimf_mailbox *) it2->data; 36 mbox = (mailimf_mailbox *) it2->data;
36 esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); 37 esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL );
37 } 38 }
38 } 39 }
39 } 40 }
40} 41}
41 42
42char *Generatemail::getFrom( mailimf_field *ffrom) { 43char *Generatemail::getFrom( mailimf_field *ffrom) {
43 char *from = NULL; 44 char *from = NULL;
44 if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) 45 if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM)
45 && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { 46 && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) {
46 clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; 47 clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list;
47 clistiter *it; 48 clistiter *it;
@@ -116,169 +117,172 @@ mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) {
116 QStringList::Iterator it; 117 QStringList::Iterator it;
117 for ( it = list.begin(); it != list.end(); it++ ) { 118 for ( it = list.begin(); it != list.end(); it++ ) {
118 int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); 119 int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() );
119 if ( err != MAILIMF_NO_ERROR ) { 120 if ( err != MAILIMF_NO_ERROR ) {
120 qDebug(" Error parsing"); // *it 121 qDebug(" Error parsing"); // *it
121 } else { 122 } else {
122 } 123 }
123 } 124 }
124 return addresses; 125 return addresses;
125} 126}
126 127
127mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { 128mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) {
128 mailmime * filePart = 0; 129 mailmime * filePart = 0;
129 mailmime_fields * fields = 0; 130 mailmime_fields * fields = 0;
130 mailmime_content * content = 0; 131 mailmime_content * content = 0;
131 mailmime_parameter * param = 0; 132 mailmime_parameter * param = 0;
132 char*name = 0; 133 char*name = 0;
133 char*file = 0; 134 char*file = 0;
134 int err; 135 int err;
135 int pos = filename.findRev( '/' ); 136 int pos = filename.findRev( '/' );
136 137
137 if (filename.length()>0) { 138 if (filename.length()>0) {
138 QString tmp = filename.right( filename.length() - ( pos + 1 ) ); 139 QString tmp = filename.right( filename.length() - ( pos + 1 ) );
139 name = strdup( tmp.latin1() ); // just filename 140 name = strdup( tmp.latin1() ); // just filename
140 file = strdup( filename.latin1() ); // full name with path 141 file = strdup( filename.latin1() ); // full name with path
141 } 142 }
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 );
155 content = mailmime_content_new_with_str( (char*)mimetype.latin1() ); 156 content = mailmime_content_new_with_str( (char*)mimetype.latin1() );
156 if (content!=0 && fields != 0) { 157 if (content!=0 && fields != 0) {
157 if (param) { 158 if (param) {
158 clist_append(content->ct_parameters,param); 159 clist_append(content->ct_parameters,param);
159 param = 0; 160 param = 0;
160 } 161 }
161 if (filename.length()>0) { 162 if (filename.length()>0) {
162 QFileInfo f(filename); 163 QFileInfo f(filename);
163 param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); 164 param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1()));
164 clist_append(content->ct_parameters,param); 165 clist_append(content->ct_parameters,param);
165 param = 0; 166 param = 0;
166 } 167 }
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 }
180 } 182 }
181 183
182 if (!filePart) { 184 if (!filePart) {
183 if ( param != NULL ) { 185 if ( param != NULL ) {
184 mailmime_parameter_free( param ); 186 mailmime_parameter_free( param );
185 } 187 }
186 if (content) { 188 if (content) {
187 mailmime_content_free( content ); 189 mailmime_content_free( content );
188 } 190 }
189 if (fields) { 191 if (fields) {
190 mailmime_fields_free( fields ); 192 mailmime_fields_free( fields );
191 } else { 193 } else {
192 if (name) { 194 if (name) {
193 free( name ); 195 free( name );
194 } 196 }
195 if (file) { 197 if (file) {
196 free( file ); 198 free( file );
197 } 199 }
198 } 200 }
199 } 201 }
200 return filePart; // Success :) 202 return filePart; // Success :)
201 203
202} 204}
203 205
204void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { 206void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) {
205 const Attachment *it; 207 const Attachment *it;
206 unsigned int count = files.count(); 208 unsigned int count = files.count();
207 for ( unsigned int i = 0; i < count; ++i ) { 209 for ( unsigned int i = 0; i < count; ++i ) {
208 mailmime *filePart; 210 mailmime *filePart;
209 int err; 211 int err;
210 it = ((QList<Attachment>)files).at(i); 212 it = ((QList<Attachment>)files).at(i);
211 213
212 filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); 214 filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" );
213 if ( filePart == NULL ) { 215 if ( filePart == NULL ) {
214 continue; 216 continue;
215 } 217 }
216 err = mailmime_smart_add_part( message, filePart ); 218 err = mailmime_smart_add_part( message, filePart );
217 if ( err != MAILIMF_NO_ERROR ) { 219 if ( err != MAILIMF_NO_ERROR ) {
218 mailmime_free( filePart ); 220 mailmime_free( filePart );
219 } 221 }
220 } 222 }
221} 223}
222 224
223mailmime *Generatemail::buildTxtPart(const QString&str ) { 225mailmime *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;
238 241
239 err = clist_append( content->ct_parameters, param ); 242 err = clist_append( content->ct_parameters, param );
240 if ( err != MAILIMF_NO_ERROR ) 243 if ( err != MAILIMF_NO_ERROR )
241 goto err_free_content; 244 goto err_free_content;
242 245
243 fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); 246 fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
244 if ( fields == NULL ) 247 if ( fields == NULL )
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
259err_free_txtPart: 263err_free_txtPart:
260 mailmime_free( txtPart ); 264 mailmime_free( txtPart );
261err_free_fields: 265err_free_fields:
262 mailmime_fields_free( fields ); 266 mailmime_fields_free( fields );
263err_free_content: 267err_free_content:
264 mailmime_content_free( content ); 268 mailmime_content_free( content );
265err_free_param: 269err_free_param:
266 mailmime_parameter_free( param ); 270 mailmime_parameter_free( param );
267err_free: 271err_free:
268 ; 272 ;
269 273
270 return NULL; // Error :( 274 return NULL; // Error :(
271} 275}
272 276
273mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { 277mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) {
274 return mailimf_mailbox_new( strdup( name.latin1() ), 278 return mailimf_mailbox_new( strdup( name.latin1() ),
275 strdup( mail.latin1() ) ); 279 strdup( mail.latin1() ) );
276} 280}
277 281
278mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) 282mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail )
279{ 283{
280 mailimf_fields *fields = NULL; 284 mailimf_fields *fields = NULL;
281 mailimf_field *xmailer = NULL; 285 mailimf_field *xmailer = NULL;
282 mailimf_mailbox *sender=0,*fromBox=0; 286 mailimf_mailbox *sender=0,*fromBox=0;
283 mailimf_mailbox_list *from=0; 287 mailimf_mailbox_list *from=0;
284 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; 288 mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
@@ -369,64 +373,66 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma
369 mailimf_fields_free( fields ); 373 mailimf_fields_free( fields );
370 fields = NULL; 374 fields = NULL;
371 } else { 375 } else {
372 if (reply) 376 if (reply)
373 mailimf_address_list_free( reply ); 377 mailimf_address_list_free( reply );
374 if (bcc) 378 if (bcc)
375 mailimf_address_list_free( bcc ); 379 mailimf_address_list_free( bcc );
376 if (cc) 380 if (cc)
377 mailimf_address_list_free( cc ); 381 mailimf_address_list_free( cc );
378 if (to) 382 if (to)
379 mailimf_address_list_free( to ); 383 mailimf_address_list_free( to );
380 if (fromBox) { 384 if (fromBox) {
381 mailimf_mailbox_free( fromBox ); 385 mailimf_mailbox_free( fromBox );
382 } else if (from) { 386 } else if (from) {
383 mailimf_mailbox_list_free( from ); 387 mailimf_mailbox_list_free( from );
384 } 388 }
385 if (sender) { 389 if (sender) {
386 mailimf_mailbox_free( sender ); 390 mailimf_mailbox_free( sender );
387 } 391 }
388 if (subject) { 392 if (subject) {
389 free( subject ); 393 free( subject );
390 } 394 }
391 } 395 }
392 } 396 }
393 return fields; 397 return fields;
394} 398}
395 399
396mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &mail ) { 400mailmime *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 )
407 goto err_free_fields; 413 goto err_free_fields;
408 414
409 mailmime_set_imf_fields( message, fields ); 415 mailmime_set_imf_fields( message, fields );
410 416
411 txtPart = buildTxtPart( mail->getMessage() ); 417 txtPart = buildTxtPart( mail->getMessage() );
412 418
413 if ( txtPart == NULL ) 419 if ( txtPart == NULL )
414 goto err_free_message; 420 goto err_free_message;
415 421
416 err = mailmime_smart_add_part( message, txtPart ); 422 err = mailmime_smart_add_part( message, txtPart );
417 if ( err != MAILIMF_NO_ERROR ) 423 if ( err != MAILIMF_NO_ERROR )
418 goto err_free_txtPart; 424 goto err_free_txtPart;
419 425
420 addFileParts( message, mail->getAttachments() ); 426 addFileParts( message, mail->getAttachments() );
421 427
422 return message; // Success :) 428 return message; // Success :)
423 429
424err_free_txtPart: 430err_free_txtPart:
425 mailmime_free( txtPart ); 431 mailmime_free( txtPart );
426err_free_message: 432err_free_message:
427 mailmime_free( message ); 433 mailmime_free( message );
428err_free_fields: 434err_free_fields:
429 mailimf_fields_free( fields ); 435 mailimf_fields_free( fields );
430err_free: 436err_free:
431 ; 437 ;
432 438
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
@@ -13,35 +13,36 @@ class Mail;
13class RecMail; 13class RecMail;
14 14
15struct mailimf_fields; 15struct mailimf_fields;
16struct mailimf_field; 16struct mailimf_field;
17struct mailimf_mailbox; 17struct mailimf_mailbox;
18struct mailmime; 18struct mailmime;
19struct mailimf_address_list; 19struct mailimf_address_list;
20class progressMailSend; 20class progressMailSend;
21struct mailsmtp; 21struct mailsmtp;
22 22
23class Generatemail : public QObject 23class Generatemail : public QObject
24{ 24{
25 Q_OBJECT 25 Q_OBJECT
26public: 26public:
27 Generatemail(); 27 Generatemail();
28 virtual ~Generatemail(); 28 virtual ~Generatemail();
29 29
30protected: 30protected:
31 static void addRcpts( clist *list, mailimf_address_list *addr_list ); 31 static void addRcpts( clist *list, mailimf_address_list *addr_list );
32 static char *getFrom( mailmime *mail ); 32 static char *getFrom( mailmime *mail );
33 static char *getFrom( mailimf_field *ffrom); 33 static char *getFrom( mailimf_field *ffrom);
34 static mailimf_field *getField( mailimf_fields *fields, int type ); 34 static mailimf_field *getField( mailimf_fields *fields, int type );
35 mailimf_address_list *parseAddresses(const QString&addr ); 35 mailimf_address_list *parseAddresses(const QString&addr );
36 void addFileParts( mailmime *message,const QList<Attachment>&files ); 36 void addFileParts( mailmime *message,const QList<Attachment>&files );
37 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); 37 mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
38 mailmime *buildTxtPart(const QString&str ); 38 mailmime *buildTxtPart(const QString&str );
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
@@ -196,65 +196,66 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
196 clistiter * cur = 0; 196 clistiter * cur = 0;
197 QString b; 197 QString b;
198 RecPartP part = new RecPart(); 198 RecPartP part = new RecPart();
199 199
200 switch (mime->mm_type) { 200 switch (mime->mm_type) {
201 case MAILMIME_SINGLE: 201 case MAILMIME_SINGLE:
202 { 202 {
203 QValueList<int>countlist = recList; 203 QValueList<int>countlist = recList;
204 countlist.append(current_count); 204 countlist.append(current_count);
205 r = mailmessage_fetch_section(message,mime,&data,&len); 205 r = mailmessage_fetch_section(message,mime,&data,&len);
206 part->setSize(len); 206 part->setSize(len);
207 part->setPositionlist(countlist); 207 part->setPositionlist(countlist);
208 b = gen_attachment_id(); 208 b = gen_attachment_id();
209 part->setIdentifier(b); 209 part->setIdentifier(b);
210 fillSingleBody(part,message,mime); 210 fillSingleBody(part,message,mime);
211 if (part->Type()=="text" && target->Bodytext().isNull()) { 211 if (part->Type()=="text" && target->Bodytext().isNull()) {
212 encodedString*rs = new encodedString(); 212 encodedString*rs = new encodedString();
213 rs->setContent(data,len); 213 rs->setContent(data,len);
214 encodedString*res = decode_String(rs,part->Encoding()); 214 encodedString*res = decode_String(rs,part->Encoding());
215 if (countlist.count()>2) { 215 if (countlist.count()>2) {
216 bodyCache[b]=rs; 216 bodyCache[b]=rs;
217 target->addPart(part); 217 target->addPart(part);
218 } else { 218 } else {
219 delete rs; 219 delete rs;
220 } 220 }
221 b = QString(res->Content()); 221 b = QString(res->Content());
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);
235 } 236 }
236 if (resu) free(resu); 237 if (resu) free(resu);
237 } 238 }
238 target->setBodytext(b); 239 target->setBodytext(b);
239 target->setDescription(part); 240 target->setDescription(part);
240 } else { 241 } else {
241 bodyCache[b]=new encodedString(data,len); 242 bodyCache[b]=new encodedString(data,len);
242 target->addPart(part); 243 target->addPart(part);
243 } 244 }
244 } 245 }
245 break; 246 break;
246 case MAILMIME_MULTIPLE: 247 case MAILMIME_MULTIPLE:
247 { 248 {
248 unsigned int ccount = 1; 249 unsigned int ccount = 1;
249 mailmime*cbody=0; 250 mailmime*cbody=0;
250 QValueList<int>countlist = recList; 251 QValueList<int>countlist = recList;
251 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { 252 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
252 cbody = (mailmime*)clist_content(cur); 253 cbody = (mailmime*)clist_content(cur);
253 if (cbody->mm_type==MAILMIME_MULTIPLE) { 254 if (cbody->mm_type==MAILMIME_MULTIPLE) {
254 RecPartP targetPart = new RecPart(); 255 RecPartP targetPart = new RecPart();
255 targetPart->setType("multipart"); 256 targetPart->setType("multipart");
256 countlist.append(current_count); 257 countlist.append(current_count);
257 targetPart->setPositionlist(countlist); 258 targetPart->setPositionlist(countlist);
258 target->addPart(targetPart); 259 target->addPart(targetPart);
259 } 260 }
260 traverseBody(target,message, cbody,countlist,current_rec+1,ccount); 261 traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
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
@@ -730,66 +730,66 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
730 int current_recursion,QValueList<int>recList,int current_count) 730 int current_recursion,QValueList<int>recList,int current_count)
731{ 731{
732 if (!body || current_recursion>=10) { 732 if (!body || current_recursion>=10) {
733 return; 733 return;
734 } 734 }
735 switch (body->bd_type) { 735 switch (body->bd_type) {
736 case MAILIMAP_BODY_1PART: 736 case MAILIMAP_BODY_1PART:
737 { 737 {
738 QValueList<int>countlist = recList; 738 QValueList<int>countlist = recList;
739 countlist.append(current_count); 739 countlist.append(current_count);
740 RecPartP currentPart = new RecPart(); 740 RecPartP currentPart = new RecPart();
741 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; 741 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
742 QString id(""); 742 QString id("");
743 currentPart->setPositionlist(countlist); 743 currentPart->setPositionlist(countlist);
744 for (unsigned int j = 0; j < countlist.count();++j) { 744 for (unsigned int j = 0; j < countlist.count();++j) {
745 id+=(j>0?" ":""); 745 id+=(j>0?" ":"");
746 id+=QString("%1").arg(countlist[j]); 746 id+=QString("%1").arg(countlist[j]);
747 } 747 }
748 //odebug << "ID = " << id.latin1() << "" << oendl; 748 //odebug << "ID = " << id.latin1() << "" << oendl;
749 currentPart->setIdentifier(id); 749 currentPart->setIdentifier(id);
750 fillSinglePart(currentPart,part1); 750 fillSinglePart(currentPart,part1);
751 /* important: Check for is NULL 'cause a body can be empty! 751 /* important: Check for is NULL 'cause a body can be empty!
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 755
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)) {
770 //qDebug("res %d %s ", index, res); 770 //qDebug("res %d %s ", index, res);
771 body_text = QString::fromUtf8(res); 771 body_text = QString::fromUtf8(res);
772 } 772 }
773 if (res) free(res); 773 if (res) free(res);
774 } 774 }
775 //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); 775 //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() );
776 target_body->setDescription(currentPart); 776 target_body->setDescription(currentPart);
777 target_body->setBodytext(body_text); 777 target_body->setBodytext(body_text);
778 if (countlist.count()>1) { 778 if (countlist.count()>1) {
779 target_body->addPart(currentPart); 779 target_body->addPart(currentPart);
780 } 780 }
781 } else { 781 } else {
782 target_body->addPart(currentPart); 782 target_body->addPart(currentPart);
783 } 783 }
784 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { 784 if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) {
785 traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); 785 traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist);
786 } 786 }
787 } 787 }
788 break; 788 break;
789 case MAILIMAP_BODY_MPART: 789 case MAILIMAP_BODY_MPART:
790 { 790 {
791 QValueList<int>countlist = recList; 791 QValueList<int>countlist = recList;
792 clistcell*current=0; 792 clistcell*current=0;
793 mailimap_body*current_body=0; 793 mailimap_body*current_body=0;
794 unsigned int ccount = 1; 794 unsigned int ccount = 1;
795 mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; 795 mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart;
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
@@ -54,65 +54,65 @@ class Mail:public Opie::Core::ORefCount
54{ 54{
55public: 55public:
56 Mail(); 56 Mail();
57 /* Possible that this destructor must not be declared virtual 57 /* Possible that this destructor must not be declared virtual
58 * 'cause it seems that it will never have some child classes. 58 * 'cause it seems that it will never have some child classes.
59 * in this case this object will not get a virtual table -> memory and 59 * in this case this object will not get a virtual table -> memory and
60 * speed will be a little bit better? 60 * speed will be a little bit better?
61 */ 61 */
62 virtual ~Mail(){} 62 virtual ~Mail(){}
63 void addAttachment( Attachment *att ) { attList.append( att ); } 63 void addAttachment( Attachment *att ) { attList.append( att ); }
64 const QList<Attachment>& getAttachments()const { return attList; } 64 const QList<Attachment>& getAttachments()const { return attList; }
65 void removeAttachment( Attachment *att ) { attList.remove( att ); } 65 void removeAttachment( Attachment *att ) { attList.remove( att ); }
66 const QString&getName()const { return name; } 66 const QString&getName()const { return name; }
67 void setName( QString s ) { name = s; } 67 void setName( QString s ) { name = s; }
68 const QString&getMail()const{ return mail; } 68 const QString&getMail()const{ return mail; }
69 void setMail( const QString&s ) { mail = s; } 69 void setMail( const QString&s ) { mail = s; }
70 const QString&getTo()const{ return to; } 70 const QString&getTo()const{ return to; }
71 void setTo( const QString&s ) { to = s; } 71 void setTo( const QString&s ) { to = s; }
72 const QString&getCC()const{ return cc; } 72 const QString&getCC()const{ return cc; }
73 void setCC( const QString&s ) { cc = s; } 73 void setCC( const QString&s ) { cc = s; }
74 const QString&getBCC()const { return bcc; } 74 const QString&getBCC()const { return bcc; }
75 void setBCC( const QString&s ) { bcc = s; } 75 void setBCC( const QString&s ) { bcc = s; }
76 const QString&getMessage()const { return message; } 76 const QString&getMessage()const { return message; }
77 void setMessage( const QString&s ) { message = s; } 77 void setMessage( const QString&s ) { message = s; }
78 const QString&getSubject()const { return subject; } 78 const QString&getSubject()const { return subject; }
79 void setSubject( const QString&s ) { subject = s; } 79 void setSubject( const QString&s ) { subject = s; }
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
88private: 88private:
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};
93 93
94class Folder:public Opie::Core::ORefCount 94class Folder:public Opie::Core::ORefCount
95{ 95{
96public: 96public:
97 Folder( const QString&init_name,const QString&sep ); 97 Folder( const QString&init_name,const QString&sep );
98 virtual ~Folder(); 98 virtual ~Folder();
99 const QString&getDisplayName()const { return nameDisplay; } 99 const QString&getDisplayName()const { return nameDisplay; }
100 const QString&getName()const { return name; } 100 const QString&getName()const { return name; }
101 const QString&getPrefix()const{return prefix; } 101 const QString&getPrefix()const{return prefix; }
102 virtual bool may_select()const{return true;} 102 virtual bool may_select()const{return true;}
103 virtual bool no_inferior()const{return true;} 103 virtual bool no_inferior()const{return true;}
104 const QString&Separator()const; 104 const QString&Separator()const;
105 105
106protected: 106protected:
107 QString nameDisplay, name, separator,prefix; 107 QString nameDisplay, name, separator,prefix;
108}; 108};
109 109
110typedef Opie::Core::OSmartPointer<Folder> FolderP; 110typedef Opie::Core::OSmartPointer<Folder> FolderP;
111 111
112class MHFolder : public Folder 112class MHFolder : public Folder
113{ 113{
114public: 114public:
115 MHFolder(const QString&disp_name,const QString&mbox); 115 MHFolder(const QString&disp_name,const QString&mbox);
116 virtual ~MHFolder(); 116 virtual ~MHFolder();
117}; 117};
118 118
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 3013931..8c0a4cb 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -78,65 +78,66 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
78 showFolders->setOn( true ); 78 showFolders->setOn( true );
79 connect(showFolders, SIGNAL( toggled(bool) ), 79 connect(showFolders, SIGNAL( toggled(bool) ),
80 SLOT( slotShowFolders(bool) ) ); 80 SLOT( slotShowFolders(bool) ) );
81 81
82 /* 82 /*
83 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 83 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
84 0, 0, this ); 84 0, 0, this );
85 searchMails->addTo( toolBar ); 85 searchMails->addTo( toolBar );
86 searchMails->addTo( mailMenu ); 86 searchMails->addTo( mailMenu );
87 */ 87 */
88 88
89 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 89 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
90 deleteMails->addTo( toolBar ); 90 deleteMails->addTo( toolBar );
91 deleteMails->addTo( mailMenu ); 91 deleteMails->addTo( mailMenu );
92 connect( deleteMails, SIGNAL( activated() ), 92 connect( deleteMails, SIGNAL( activated() ),
93 SLOT( slotDeleteMail() ) ); 93 SLOT( slotDeleteMail() ) );
94 94
95 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , 95 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") ,
96 0, 0, this ); 96 0, 0, this );
97 editSettings->addTo( settingsMenu ); 97 editSettings->addTo( settingsMenu );
98 connect( editSettings, SIGNAL( activated() ), 98 connect( editSettings, SIGNAL( activated() ),
99 SLOT( slotEditSettings() ) ); 99 SLOT( slotEditSettings() ) );
100 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 100 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
101 0, 0, this ); 101 0, 0, this );
102 editAccounts->addTo( settingsMenu ); 102 editAccounts->addTo( settingsMenu );
103 codecMenu = new QPopupMenu( menuBar ); 103 codecMenu = new QPopupMenu( menuBar );
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 );
117 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 118 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
118 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 119 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
119 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 120 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
120 121
121 folderView = new AccountView( split ); 122 folderView = new AccountView( split );
122 folderView->header()->hide(); 123 folderView->header()->hide();
123 folderView->setRootIsDecorated( false ); 124 folderView->setRootIsDecorated( false );
124 folderView->addColumn( i18n( "Mailbox" ) ); 125 folderView->addColumn( i18n( "Mailbox" ) );
125 126
126 //layout->addWidget( folderView ); 127 //layout->addWidget( folderView );
127 128
128 mailView = new QListView( split ); 129 mailView = new QListView( split );
129 mailView->addColumn( i18n( " " ) ); 130 mailView->addColumn( i18n( " " ) );
130 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 131 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
131 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 132 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
132 mailView->addColumn( i18n( "Size" ),QListView::Manual); 133 mailView->addColumn( i18n( "Size" ),QListView::Manual);
133 mailView->addColumn( i18n( "Date" ),QListView::Manual); 134 mailView->addColumn( i18n( "Date" ),QListView::Manual);
134 mailView->setAllColumnsShowFocus(true); 135 mailView->setAllColumnsShowFocus(true);
135 //mailView->setSorting(-1); 136 //mailView->setSorting(-1);
136 mailView->setRootIsDecorated( false ); 137 mailView->setRootIsDecorated( false );
137 statusWidget = new StatusWidget( wrapperBox ); 138 statusWidget = new StatusWidget( wrapperBox );
138 statusWidget->hide(); 139 statusWidget->hide();
139 140
140 //layout->addWidget( mailView ); 141 //layout->addWidget( mailView );
141 //layout->setStretchFactor( folderView, 1 ); 142 //layout->setStretchFactor( folderView, 1 );
142 //layout->setStretchFactor( mailView, 2 ); 143 //layout->setStretchFactor( mailView, 2 );