summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-11-07 10:11:25 (UTC)
committer zautrix <zautrix>2004-11-07 10:11:25 (UTC)
commitb6ef669713ee1d52adcfc9754dd039a4ff6675da (patch) (side-by-side diff)
treeeac59d1b135cbf87e0b9aca21213115331995203 /kmicromail
parentdcb3a171bca38934185de67e378956e6fd044f17 (diff)
downloadkdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.zip
kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.tar.gz
kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.tar.bz2
encoding fixes
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp58
-rw-r--r--kmicromail/composemail.h2
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp1
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp11
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp11
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h3
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h5
-rw-r--r--kmicromail/libmailwrapper/storemail.cpp12
-rw-r--r--kmicromail/opiemail.cpp2
-rw-r--r--kmicromail/viewmail.cpp1
10 files changed, 74 insertions, 32 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index f44100b..49fd14f 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -2,5 +2,3 @@
-#include <kabc/addresseedialog.h>
-#include <kabc/stdaddressbook.h>
-#include <kabc/addressee.h>
+
#ifdef DESKTOP_VERSION
@@ -8,2 +6,4 @@
#include <kabc/addresseedialog.h>
+#include <kabc/stdaddressbook.h>
+#include <kabc/addressee.h>
#endif //DESKTOP_VERSION
@@ -50,3 +50,5 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo
{
+
mPickLineEdit = 0;
+ mEncoding = KOPrefs::instance()->mCurrentCodeName;
connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
@@ -167,9 +169,9 @@ void ComposeMail::saveAsDraft()
Opie::Core::OSmartPointer<Mail> mail= new Mail();
- mail->setMail(fromBox->currentText().utf8 ());
- mail->setTo( toLine->text().utf8 () );
- mail->setName(senderNameEdit->text().utf8 ());
- mail->setCC( ccLine->text().utf8 () );
- mail->setBCC( bccLine->text().utf8 () );
- mail->setReply( replyLine->text().utf8 () );
- mail->setSubject( subjectLine->text().utf8 () );
+ mail->setMail(fromBox->currentText());
+ mail->setTo( toLine->text() );
+ mail->setName(senderNameEdit->text());
+ mail->setCC( ccLine->text() );
+ mail->setBCC( bccLine->text() );
+ mail->setReply( replyLine->text() );
+ mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
@@ -179,3 +181,3 @@ void ComposeMail::saveAsDraft()
}
- QString txt = message->text().utf8 ();
+ QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
@@ -185,3 +187,3 @@ void ComposeMail::saveAsDraft()
mail->setMessage( txt );
-
+ mail->setCharset (mEncoding);
/* only use the default drafts folder name! */
@@ -410,6 +412,6 @@ void ComposeMail::accept()
SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
- mail->setMail(fromBox->currentText().utf8 ());
+ mail->setMail(fromBox->currentText());
if ( !toLine->text().isEmpty() ) {
- mail->setTo( toLine->text().utf8 () );
+ mail->setTo( toLine->text() );
} else {
@@ -420,18 +422,19 @@ void ComposeMail::accept()
- mail->setName(senderNameEdit->text().utf8 ());
- mail->setCC( ccLine->text().utf8 () );
- mail->setBCC( bccLine->text().utf8 () );
- mail->setReply( replyLine->text().utf8 () );
- mail->setSubject( subjectLine->text().utf8 () );
+ mail->setName(senderNameEdit->text());
+ mail->setCC( ccLine->text() );
+ mail->setBCC( bccLine->text() );
+ mail->setReply( replyLine->text() );
+ mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
QStringList ids;
- ids.append(m_replyid.utf8 ());
+ ids.append(m_replyid);
mail->setInreply(ids);
}
- QString txt = message->text().utf8 ();
+ QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
- txt.append( sigMultiLine->text().utf8 () );
+ txt.append( sigMultiLine->text() );
}
mail->setMessage( txt );
+ mail->setCharset (mEncoding);
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
@@ -478,2 +481,8 @@ void ComposeMail::reject()
+void ComposeMail::setCharset(const QString& charset)
+{
+ if ( !charset.isEmpty() )
+ mEncoding = charset;
+ qDebug("ComposeMail::setCharset %s ", mEncoding.latin1());
+}
ComposeMail::~ComposeMail()
@@ -485,3 +494,5 @@ void ComposeMail::reEditMail(const RecMailP&current)
RecMailP data = current;
- message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
+ RecBodyP body = data->Wrapper()->fetchBody(current);
+
+ message->setText(body->Bodytext());
subjectLine->setText( data->getSubject());
@@ -491,2 +502,3 @@ void ComposeMail::reEditMail(const RecMailP&current)
replyLine->setText(data->Replyto());
+ setCharset(body->getCharset());
}
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h
index 0fc41fb..a7fa41c 100644
--- a/kmicromail/composemail.h
+++ b/kmicromail/composemail.h
@@ -50,2 +50,3 @@ public slots:
void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
+ void setCharset(const QString&);
@@ -76,2 +77,3 @@ protected:
QString m_replyid;
+ QString mEncoding;
bool warnAttach;
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index 49227dd..28d45ce 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -228,2 +228,3 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
if ( !charset.isEmpty() ) {
+ target->setCharset( charset );
err = mailmime_encoded_phrase_parse(charset.latin1(),
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index eb2b47d..2a54381 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -52,3 +52,3 @@ void IMAPwrapper::imap_progress( size_t current, size_t maximum )
//qApp->processEvents()
- static int last = 0;
+ static unsigned int last = 0;
if ( last != current )
@@ -291,6 +291,6 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
//qDebug("iii %d ",i);
- msg_att = (mailimap_msg_att*)current->data;
+ msg_att = (mailimap_msg_att*)current->data;
RecMail*m = parse_list_result(msg_att);
if (m) {
- if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) {
+ if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) {
m->setNumber(i);
@@ -417,3 +417,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
mailimap_flag_fetch*cflag;
- int size;
+ int size = 0;
QBitArray mFlags(7);
@@ -763,2 +763,3 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
if ( !charset.isEmpty() ) {
+ target_body->setCharset( charset );
//err = mailmime_encoded_phrase_parse("iso-8859-1",
@@ -1184,3 +1185,3 @@ int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,cons
QString pre = account->getPrefix();
- if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) {
+ if (delemiter.length()>0 && pre.findRev(delemiter)!=((int)pre.length())-1) {
pre+=delemiter;
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp
index af3b9d0..89150ad 100644
--- a/kmicromail/libmailwrapper/mailtypes.cpp
+++ b/kmicromail/libmailwrapper/mailtypes.cpp
@@ -289,2 +289,3 @@ RecBody::RecBody(const RecBody&old)
m_description = old.m_description;
+ mCharset = old.mCharset;
// odebug << "Recbody copy constructor" << oendl;
@@ -332,2 +333,12 @@ const RecPartP& RecBody::Description()const
+void RecBody::setCharset(const QString& str)
+{
+ mCharset = str;
+}
+
+QString RecBody::getCharset()const
+{
+ return mCharset;
+}
+
/* handling encoded content */
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index c1c1a74..32d92c0 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -135,2 +135,3 @@ protected:
QString m_BodyText;
+ QString mCharset;
QValueList<RecPartP> m_PartsList;
@@ -144,2 +145,4 @@ public:
const QString& Bodytext()const;
+ void setCharset(const QString&);
+ QString getCharset()const;
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h
index 88f10da..ea6bf36 100644
--- a/kmicromail/libmailwrapper/mailwrapper.h
+++ b/kmicromail/libmailwrapper/mailwrapper.h
@@ -84,5 +84,8 @@ public:
+ void setCharset( const QString&a ) { charset= a; }
+ const QString& getCharset() { return charset; }
+
private:
QList<Attachment> attList;
- QString name, mail, to, cc, bcc, reply, subject, message;
+ QString name, mail, to, cc, bcc, reply, subject, message, charset;
QStringList m_in_reply_to;
diff --git a/kmicromail/libmailwrapper/storemail.cpp b/kmicromail/libmailwrapper/storemail.cpp
index ed1d44a..9d1735f 100644
--- a/kmicromail/libmailwrapper/storemail.cpp
+++ b/kmicromail/libmailwrapper/storemail.cpp
@@ -9,2 +9,3 @@
#include <stdlib.h>
+#include <kglobal.h>
@@ -67,4 +68,11 @@ int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail)
mailmessage * msg = 0;
- msg = mime_message_init(mimeMail);
- mime_message_set_tmpdir(msg,getenv( "HOME" ));
+ msg = mime_message_init(mimeMail);
+ QString fileName;
+#ifdef DESKTOP_VERSION
+ fileName = locateLocal("tmp", "");
+#else
+ fileName = "/tmp/";
+#endif
+ //mime_message_set_tmpdir(msg,getenv( "HOME" ));
+ mime_message_set_tmpdir(msg,(char*)fileName.latin1());
int r = mailmessage_fetch(msg,&data,&size);
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 18a5600..c20c7ce 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -293,3 +293,3 @@ void OpieMail::replyMail()
composer.setInReplyTo( mail->Msgid());
-
+ composer.setCharset( body->getCharset() );
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 4883231..3bd6f41 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -459,2 +459,3 @@ void ViewMail::slotReply()
composer.setInReplyTo(m_recMail->Msgid());
+ composer.setCharset( m_body->getCharset() );