summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
authorzautrix <zautrix>2004-11-07 10:11:25 (UTC)
committer zautrix <zautrix>2004-11-07 10:11:25 (UTC)
commitb6ef669713ee1d52adcfc9754dd039a4ff6675da (patch) (unidiff)
treeeac59d1b135cbf87e0b9aca21213115331995203 /kmicromail/composemail.cpp
parentdcb3a171bca38934185de67e378956e6fd044f17 (diff)
downloadkdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.zip
kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.tar.gz
kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.tar.bz2
encoding fixes
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp58
1 files changed, 35 insertions, 23 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index f44100b..49fd14f 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,10 +1,10 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3#include <kabc/addresseedialog.h> 3
4#include <kabc/stdaddressbook.h>
5#include <kabc/addressee.h>
6#ifdef DESKTOP_VERSION 4#ifdef DESKTOP_VERSION
7#include <qapplication.h> 5#include <qapplication.h>
8#include <kabc/addresseedialog.h> 6#include <kabc/addresseedialog.h>
7#include <kabc/stdaddressbook.h>
8#include <kabc/addressee.h>
9#endif //DESKTOP_VERSION 9#endif //DESKTOP_VERSION
10#include <libkdepim/externalapphandler.h> 10#include <libkdepim/externalapphandler.h>
@@ -49,5 +49,7 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo
49 : ComposeMailUI( parent, name, modal ) 49 : ComposeMailUI( parent, name, modal )
50{ 50{
51
51 mPickLineEdit = 0; 52 mPickLineEdit = 0;
53 mEncoding = KOPrefs::instance()->mCurrentCodeName;
52 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 54 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
53 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 55 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
@@ -166,11 +168,11 @@ void ComposeMail::saveAsDraft()
166 168
167 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 169 Opie::Core::OSmartPointer<Mail> mail= new Mail();
168 mail->setMail(fromBox->currentText().utf8 ()); 170 mail->setMail(fromBox->currentText());
169 mail->setTo( toLine->text().utf8 () ); 171 mail->setTo( toLine->text() );
170 mail->setName(senderNameEdit->text().utf8 ()); 172 mail->setName(senderNameEdit->text());
171 mail->setCC( ccLine->text().utf8 () ); 173 mail->setCC( ccLine->text() );
172 mail->setBCC( bccLine->text().utf8 () ); 174 mail->setBCC( bccLine->text() );
173 mail->setReply( replyLine->text().utf8 () ); 175 mail->setReply( replyLine->text() );
174 mail->setSubject( subjectLine->text().utf8 () ); 176 mail->setSubject( subjectLine->text() );
175 if (!m_replyid.isEmpty()) { 177 if (!m_replyid.isEmpty()) {
176 QStringList ids; 178 QStringList ids;
@@ -178,5 +180,5 @@ void ComposeMail::saveAsDraft()
178 mail->setInreply(ids); 180 mail->setInreply(ids);
179 } 181 }
180 QString txt = message->text().utf8 (); 182 QString txt = message->text();
181 if ( !sigMultiLine->text().isEmpty() ) { 183 if ( !sigMultiLine->text().isEmpty() ) {
182 txt.append( "\n--\n" ); 184 txt.append( "\n--\n" );
@@ -184,5 +186,5 @@ void ComposeMail::saveAsDraft()
184 } 186 }
185 mail->setMessage( txt ); 187 mail->setMessage( txt );
186 188 mail->setCharset (mEncoding);
187 /* only use the default drafts folder name! */ 189 /* only use the default drafts folder name! */
188 Storemail wrapper(AbstractMail::draftFolder()); 190 Storemail wrapper(AbstractMail::draftFolder());
@@ -409,8 +411,8 @@ void ComposeMail::accept()
409 411
410 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 412 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
411 mail->setMail(fromBox->currentText().utf8 ()); 413 mail->setMail(fromBox->currentText());
412 414
413 if ( !toLine->text().isEmpty() ) { 415 if ( !toLine->text().isEmpty() ) {
414 mail->setTo( toLine->text().utf8 () ); 416 mail->setTo( toLine->text() );
415 } else { 417 } else {
416 QMessageBox::warning(0,i18n("Sending mail"), 418 QMessageBox::warning(0,i18n("Sending mail"),
@@ -419,20 +421,21 @@ void ComposeMail::accept()
419 } 421 }
420 422
421 mail->setName(senderNameEdit->text().utf8 ()); 423 mail->setName(senderNameEdit->text());
422 mail->setCC( ccLine->text().utf8 () ); 424 mail->setCC( ccLine->text() );
423 mail->setBCC( bccLine->text().utf8 () ); 425 mail->setBCC( bccLine->text() );
424 mail->setReply( replyLine->text().utf8 () ); 426 mail->setReply( replyLine->text() );
425 mail->setSubject( subjectLine->text().utf8 () ); 427 mail->setSubject( subjectLine->text() );
426 if (!m_replyid.isEmpty()) { 428 if (!m_replyid.isEmpty()) {
427 QStringList ids; 429 QStringList ids;
428 ids.append(m_replyid.utf8 ()); 430 ids.append(m_replyid);
429 mail->setInreply(ids); 431 mail->setInreply(ids);
430 } 432 }
431 QString txt = message->text().utf8 (); 433 QString txt = message->text();
432 if ( !sigMultiLine->text().isEmpty() ) { 434 if ( !sigMultiLine->text().isEmpty() ) {
433 txt.append( "\n--\n" ); 435 txt.append( "\n--\n" );
434 txt.append( sigMultiLine->text().utf8 () ); 436 txt.append( sigMultiLine->text() );
435 } 437 }
436 mail->setMessage( txt ); 438 mail->setMessage( txt );
439 mail->setCharset (mEncoding);
437 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 440 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
438 while ( it != 0 ) { 441 while ( it != 0 ) {
@@ -477,4 +480,10 @@ void ComposeMail::reject()
477} 480}
478 481
482void ComposeMail::setCharset(const QString& charset)
483{
484 if ( !charset.isEmpty() )
485 mEncoding = charset;
486 qDebug("ComposeMail::setCharset %s ", mEncoding.latin1());
487}
479ComposeMail::~ComposeMail() 488ComposeMail::~ComposeMail()
480{ 489{
@@ -484,5 +493,7 @@ void ComposeMail::reEditMail(const RecMailP&current)
484{ 493{
485 RecMailP data = current; 494 RecMailP data = current;
486 message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); 495 RecBodyP body = data->Wrapper()->fetchBody(current);
496
497 message->setText(body->Bodytext());
487 subjectLine->setText( data->getSubject()); 498 subjectLine->setText( data->getSubject());
488 toLine->setText(data->To().join(",")); 499 toLine->setText(data->To().join(","));
@@ -490,4 +501,5 @@ void ComposeMail::reEditMail(const RecMailP&current)
490 bccLine->setText(data->Bcc().join(",")); 501 bccLine->setText(data->Bcc().join(","));
491 replyLine->setText(data->Replyto()); 502 replyLine->setText(data->Replyto());
503 setCharset(body->getCharset());
492} 504}
493 505