summaryrefslogtreecommitdiffabout
path: root/kmicromail
Side-by-side diff
Diffstat (limited to 'kmicromail') (more/less context) (show 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.cpp9
-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.cpp10
-rw-r--r--kmicromail/opiemail.cpp2
-rw-r--r--kmicromail/viewmail.cpp1
10 files changed, 72 insertions, 30 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index f44100b..49fd14f 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,24 +1,24 @@
// CHANGED 2004-08-06 Lutz Rogowski
-#include <kabc/addresseedialog.h>
-#include <kabc/stdaddressbook.h>
-#include <kabc/addressee.h>
+
#ifdef DESKTOP_VERSION
#include <qapplication.h>
#include <kabc/addresseedialog.h>
+#include <kabc/stdaddressbook.h>
+#include <kabc/addressee.h>
#endif //DESKTOP_VERSION
#include <libkdepim/externalapphandler.h>
#include "koprefs.h"
#ifdef MINIKDE_KDIALOG_H
#undef MINIKDE_KDIALOG_H
#endif
#include "composemail.h"
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/storemail.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailtypes.h>
@@ -35,33 +35,35 @@
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qiconset.h>
#include <qtimer.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qmultilineedit.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlistview.h>
//using namespace Opie::Core;
//using namespace Opie::Ui;
ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal )
: ComposeMailUI( parent, name, modal )
{
+
mPickLineEdit = 0;
+ mEncoding = KOPrefs::instance()->mCurrentCodeName;
connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
settings = sett;
m_replyid = "";
if ( KOPrefs::instance()->mUseKapi) {
KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
QString whoami_uid = config.readEntry( "WhoAmI" );
if ( whoami_uid.isEmpty() ) {
QMessageBox::information( 0, i18n( "Hint" ),
i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
i18n( "Ok" ) );
fillSettings();
@@ -152,51 +154,51 @@ void ComposeMail::fillSettings()
if ( QApplication::desktop()->width() < 320 )
fromBox->setMaximumWidth( 100 );
QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
QStringList::ConstIterator sit = mailList.begin();
int pref = 0;
for (;sit!=mailList.end();++sit) {
fromBox->insertItem((*sit));
}
senderNameEdit->setText(KOPrefs::instance()->mName);
}
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()) {
QStringList ids;
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() );
}
mail->setMessage( txt );
-
+ mail->setCharset (mEncoding);
/* only use the default drafts folder name! */
Storemail wrapper(AbstractMail::draftFolder());
wrapper.storeMail(mail);
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
/* attachments we will ignore! */
if ( it != 0 ) {
if ( warnAttach )
QMessageBox::warning(0,i18n("Store message"),
i18n("<center>Attachments will not be stored in \"Draft\" folder</center>"));
warnAttach = false;
}
setStatus( i18n("Mail saved as draft!") );
}
void ComposeMail::clearStatus()
{
@@ -395,58 +397,59 @@ void ComposeMail::accept()
int yesno = QMessageBox::warning(0,i18n("Stop editing message"),
i18n("Send this message?"),
i18n("Yes"),
i18n("Cancel"));
if (yesno == 1) {
return;
}
}
#if 0
odebug << "Sending Mail with "
<< smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
#endif
Opie::Core::OSmartPointer<Mail> mail=new Mail;
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 {
QMessageBox::warning(0,i18n("Sending mail"),
i18n("No Receiver spezified" ) );
return;
}
- 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();
while ( it != 0 ) {
mail->addAttachment( it->getAttachment() );
it = (AttachViewItem *) it->nextSibling();
}
SMTPwrapper wrapper( smtp );
if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
setStatus( tr ("Mail sent"));
else {
setStatus( tr ("Error: Something went wrong. Nothing sent"));
return;
}
QDialog::accept();
@@ -463,41 +466,50 @@ void ComposeMail::reject()
//qDebug("button %d ", yesno);
if (yesno == 0) {
if ( toLine->text().isEmpty() ) {
QMessageBox::warning(0,i18n("Sending mail"),
i18n("No Receiver spezified" ) );
return;
}
saveAsDraft();
}
if (yesno == 2) {
qDebug("return ");
return;
}
QDialog::reject();
}
+void ComposeMail::setCharset(const QString& charset)
+{
+ if ( !charset.isEmpty() )
+ mEncoding = charset;
+ qDebug("ComposeMail::setCharset %s ", mEncoding.latin1());
+}
ComposeMail::~ComposeMail()
{
}
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());
toLine->setText(data->To().join(","));
ccLine->setText(data->CC().join(","));
bccLine->setText(data->Bcc().join(","));
replyLine->setText(data->Replyto());
+ setCharset(body->getCharset());
}
AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
: QListViewItem( parent )
{
attachment = att;
if ( !attachment->getPixmap().isNull() )
setPixmap( 0,attachment->getPixmap() );
setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
setText( 1, QString::number( att->getSize() ) );
}
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h
index 0fc41fb..a7fa41c 100644
--- a/kmicromail/composemail.h
+++ b/kmicromail/composemail.h
@@ -35,57 +35,59 @@ class ComposeMail : public ComposeMailUI
public:
ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false );
virtual ~ComposeMail();
void reEditMail(const Opie::Core::OSmartPointer<RecMail>&current);
public slots:
void slotAdjustColumns();
void setTo( const QString & to );
void setSubject( const QString & subject );
void setInReplyTo( const QString & messageId );
void setMessage( const QString & text );
void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
+ void setCharset(const QString&);
protected slots:
void accept();
void reject();
private slots:
void fillValues( int current );
void fillSettings();
void pickAddress();
void pickAddressTo();
void pickAddressCC();
void pickAddressBCC();
void pickAddressReply();
void saveAsDraft();
void addAttachment();
void removeAttachment();
void clearStatus();
void setStatus( QString );
protected:
QLineEdit* mPickLineEdit;
Opie::Core::OSmartPointer<Mail> mMail;
Settings *settings;
QList<SMTPaccount> smtpAccounts;
QString m_replyid;
+ QString mEncoding;
bool warnAttach;
};
class AttachViewItem : public QListViewItem
{
public:
AttachViewItem( QListView *parent, Attachment *att );
Attachment *getAttachment() { return attachment; }
private:
Attachment *attachment;
};
#endif
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
@@ -213,32 +213,33 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m
rs->setContent(data,len);
encodedString*res = decode_String(rs,part->Encoding());
if (countlist.count()>2) {
bodyCache[b]=rs;
target->addPart(part);
} else {
delete rs;
}
b = QString(res->Content());
delete res;
size_t index = 0;
char*resu = 0;
int err = MAILIMF_NO_ERROR;
QString charset = part->searchParamter( "charset");
qDebug("CHARSET %s ",charset.latin1() );
if ( !charset.isEmpty() ) {
+ target->setCharset( charset );
err = mailmime_encoded_phrase_parse(charset.latin1(),
b.latin1(), b.length(),&index, "utf-8",&resu);
if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) {
//qDebug("res %d %s ", index, resu);
b = QString::fromUtf8(resu);
}
if (resu) free(resu);
}
target->setBodytext(b);
target->setDescription(part);
} else {
bodyCache[b]=new encodedString(data,len);
target->addPart(part);
}
}
break;
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
@@ -37,33 +37,33 @@ int IMAPwrapper::selectMbox(const QString&mbox)
return MAILIMAP_NO_ERROR;
}
int err = mailimap_select( m_imap, (char*)mbox.latin1());
if ( err != MAILIMAP_NO_ERROR ) {
m_Lastmbox = "";
return err;
}
m_Lastmbox = mbox;
return err;
}
void IMAPwrapper::imap_progress( size_t current, size_t maximum )
{
//qDebug("imap progress %d of %d ",current,maximum );
//Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum));
//qApp->processEvents()
- static int last = 0;
+ static unsigned int last = 0;
if ( last != current )
IMAPwrapper::progress();
last = current;
}
void IMAPwrapper::progress( QString m )
{
static QString mProgrMess;
if ( m != QString::null ) {
mProgrMess = m;
mCurrent = 1;
return;
}
QString mess;
//qDebug("progress ");
if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax);
@@ -279,33 +279,33 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
QString date,subject,from;
if ( err == MAILIMAP_NO_ERROR ) {
tryAgain = -1;
mailimap_msg_att * msg_att;
int i = 0;
for (current = clist_begin(result); current != 0; current=clist_next(current)) {
++i;
//qDebug("iii %d ",i);
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);
m->setMbox(mailbox);
m->setWrapper(this);
target.append(m);
}
}
}
Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count()));
} else {
--tryAgain;
--tryAgain;//disabled tryagain by adding this line
if ( tryAgain < 0 )
Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response));
else
qDebug("try again... ");
}
@@ -402,33 +402,33 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
}
} else {
qDebug("error fetching folders ");
}
if (result) mailimap_list_result_free( result );
return folders;
}
RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
{
RecMail * m = 0;
mailimap_msg_att_item *item=0;
clistcell *current,*c,*cf;
mailimap_msg_att_dynamic*flist;
mailimap_flag_fetch*cflag;
- int size;
+ int size = 0;
QBitArray mFlags(7);
QStringList addresslist;
if (!m_att) {
return m;
}
m = new RecMail();
for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
current = c;
size = 0;
item = (mailimap_msg_att_item*)current->data;
if ( !item )
continue;
if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
if (!flist || !flist->att_list) {
@@ -748,32 +748,33 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t
//odebug << "ID = " << id.latin1() << "" << oendl;
currentPart->setIdentifier(id);
fillSinglePart(currentPart,part1);
/* important: Check for is NULL 'cause a body can be empty!
And we put it only into the mail if it is the FIRST part */
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
size_t index = 0;
char*res = 0;
int err = MAILIMF_NO_ERROR;
QString charset = currentPart->searchParamter( "charset");
qDebug("CHARSET %s ",charset.latin1() );
//if ( false ) {
if ( !charset.isEmpty() ) {
+ target_body->setCharset( charset );
//err = mailmime_encoded_phrase_parse("iso-8859-1",
// text, strlen(text),&index, "iso-8859-1",&res);
err = mailmime_encoded_phrase_parse(charset.latin1(),
body_text.latin1(), body_text.length(),&index, "utf-8",&res);
if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
//qDebug("res %d %s ", index, res);
body_text = QString::fromUtf8(res);
}
if (res) free(res);
}
//qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() );
target_body->setDescription(currentPart);
target_body->setBodytext(body_text);
if (countlist.count()>1) {
target_body->addPart(currentPart);
}
@@ -1169,33 +1170,33 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
/* should we realy do that at this moment? */
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage(i18n("error deleting mail: %s").arg(m_imap->imap_response));
return 0;
}
// odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
return 1;
}
int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder)
{
if (folder.length()==0) return 0;
login();
if (!m_imap) {return 0;}
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;
}
if (parentfolder) {
pre += parentfolder->getDisplayName()+delemiter;
}
pre+=folder;
if (getsubfolder) {
if (delemiter.length()>0) {
pre+=delemiter;
} else {
Global::statusMessage(i18n("Cannot create folder %1 for holding subfolders").arg(pre));
return 0;
}
}
// odebug << "Creating " << pre.latin1() << "" << oendl;
int res = mailimap_create(m_imap,pre.latin1());
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
@@ -274,32 +274,33 @@ const QValueList<int>& RecPart::Positionlist()const
{
return m_poslist;
}
RecBody::RecBody()
: Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
{
m_PartsList.clear();
}
RecBody::RecBody(const RecBody&old)
:Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
{
m_BodyText = old.m_BodyText;
m_PartsList = old.m_PartsList;
m_description = old.m_description;
+ mCharset = old.mCharset;
// odebug << "Recbody copy constructor" << oendl;
}
RecBody::~RecBody()
{
}
void RecBody::setBodytext(const QString&bodyText)
{
m_BodyText = bodyText;
}
const QString& RecBody::Bodytext()const
{
return m_BodyText;
}
@@ -317,32 +318,42 @@ const QValueList<RecPartP>& RecBody::Parts()const
void RecBody::addPart(const RecPartP& part)
{
m_PartsList.append(part);
}
void RecBody::setDescription(const RecPartP&des)
{
m_description = des;
}
const RecPartP& RecBody::Description()const
{
return m_description;
}
+void RecBody::setCharset(const QString& str)
+{
+ mCharset = str;
+}
+
+QString RecBody::getCharset()const
+{
+ return mCharset;
+}
+
/* handling encoded content */
encodedString::encodedString()
{
init();
}
encodedString::encodedString(const char*nContent,unsigned int nSize)
{
init();
setContent(nContent,nSize);
}
encodedString::encodedString(char*nContent,unsigned int nSize)
{
init();
setContent(nContent,nSize);
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
@@ -120,41 +120,44 @@ public:
void setParameters(const part_plist_t&list);
const part_plist_t&Parameters()const;
void addParameter(const QString&key,const QString&value);
const QString searchParamter(const QString&key)const;
void setPositionlist(const QValueList<int>&poslist);
const QValueList<int>& Positionlist()const;
};
typedef Opie::Core::OSmartPointer<RecPart> RecPartP;
class RecBody:public Opie::Core::ORefCount
{
protected:
QString m_BodyText;
+ QString mCharset;
QValueList<RecPartP> m_PartsList;
RecPartP m_description;
public:
RecBody();
RecBody(const RecBody&old);
virtual ~RecBody();
void setBodytext(const QString&);
const QString& Bodytext()const;
+ void setCharset(const QString&);
+ QString getCharset()const;
void setDescription(const RecPartP&des);
const RecPartP& Description()const;
void setParts(const QValueList<RecPartP>&parts);
const QValueList<RecPartP>& Parts()const;
void addPart(const RecPartP&part);
};
typedef Opie::Core::OSmartPointer<RecBody> RecBodyP;
class encodedString
{
public:
encodedString();
/*
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
@@ -69,35 +69,38 @@ public:
void setMail( const QString&s ) { mail = s; }
const QString&getTo()const{ return to; }
void setTo( const QString&s ) { to = s; }
const QString&getCC()const{ return cc; }
void setCC( const QString&s ) { cc = s; }
const QString&getBCC()const { return bcc; }
void setBCC( const QString&s ) { bcc = s; }
const QString&getMessage()const { return message; }
void setMessage( const QString&s ) { message = s; }
const QString&getSubject()const { return subject; }
void setSubject( const QString&s ) { subject = s; }
const QString&getReply()const{ return reply; }
void setReply( const QString&a ) { reply = a; }
void setInreply(const QStringList&list){m_in_reply_to = list;}
const QStringList&Inreply()const{return m_in_reply_to;}
+ 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;
};
class Folder:public Opie::Core::ORefCount
{
public:
Folder( const QString&init_name,const QString&sep );
virtual ~Folder();
const QString&getDisplayName()const { return nameDisplay; }
const QString&getName()const { return name; }
const QString&getPrefix()const{return prefix; }
virtual bool may_select()const{return true;}
virtual bool no_inferior()const{return true;}
const QString&Separator()const;
protected:
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
@@ -1,25 +1,26 @@
#include "storemail.h"
#include "mailwrapper.h"
#include "settings.h"
#include "abstractmail.h"
#include <libetpan/libetpan.h>
#include <qstring.h>
#include <stdlib.h>
+#include <kglobal.h>
using namespace Opie::Core;
Storemail::Storemail(Account*aAccount,const QString&aFolder)
: Generatemail()
{
wrapper = 0;
m_Account = aAccount;
m_tfolder = aFolder;
wrapper = AbstractMail::getWrapper(m_Account);
if (wrapper) {
wrapper->createMbox(m_tfolder);
}
}
Storemail::Storemail(const QString&dir,const QString&aFolder)
: Generatemail()
@@ -53,33 +54,40 @@ int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail)
{
if (!wrapper) return 0;
int ret = 1;
mailmime * mimeMail = 0;
mimeMail = createMimeMail(mail );
if ( mimeMail == NULL ) {
qDebug("storeMail: error creating mime mail ");
return 0;
}
char *data;
size_t size;
data = 0;
mailmessage * msg = 0;
msg = mime_message_init(mimeMail);
- mime_message_set_tmpdir(msg,getenv( "HOME" ));
+ 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);
mime_message_detach_mime(msg);
mailmessage_free(msg);
msg = 0;
if (r != MAIL_NO_ERROR || !data) {
qDebug("Error fetching mime... ");
ret = 0;
}
if (ret) {
wrapper->storeMessage(data,size,m_tfolder);
}
if (data) {
free(data);
}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 18a5600..c20c7ce 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -278,33 +278,33 @@ void OpieMail::replyMail()
rtext += "\n";
QString prefix;
if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
else prefix = "Re: "; // no i18n on purpose
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
if (mail->Replyto().isEmpty()) {
composer.setTo( mail->getFrom());
} else {
composer.setTo( mail->Replyto());
}
composer.setSubject( prefix + mail->getSubject());
composer.setMessage( rtext );
composer.setInReplyTo( mail->Msgid());
-
+ composer.setCharset( body->getCharset() );
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
mail->Wrapper()->answeredMail(mail);
}
delete settings;
}
void OpieMail::displayMail()
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
ViewMail readMail( this,"", Qt::WType_Modal );
readMail.setBody( body );
readMail.setMail( mail );
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 4883231..3bd6f41 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -444,32 +444,33 @@ void ViewMail::slotReply()
rtext += "\n";
QString prefix;
if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
else prefix = "Re: "; // no i18n on purpose
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
if (m_recMail->Replyto().isEmpty()) {
composer.setTo(m_recMail->getFrom());
} else {
composer.setTo(m_recMail->Replyto());
}
composer.setSubject( prefix + m_mail[1] );
composer.setMessage( rtext );
composer.setInReplyTo(m_recMail->Msgid());
+ composer.setCharset( m_body->getCharset() );
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
m_recMail->Wrapper()->answeredMail(m_recMail);
}
delete settings;
}
void ViewMail::slotForward()
{
if (!m_gotBody)
{
QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
return;
}