author | alwin <alwin> | 2004-03-18 18:00:18 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-18 18:00:18 (UTC) |
commit | fef9cec046fcf21a4f762c36454b8f253dd3e25e (patch) (side-by-side diff) | |
tree | b87ee38164e1e9ce635dde34c13677f09388c058 | |
parent | 69fa0e7b5cab5f4cdfdac736e31ff0fd0fbf4312 (diff) | |
download | opie-fef9cec046fcf21a4f762c36454b8f253dd3e25e.zip opie-fef9cec046fcf21a4f762c36454b8f253dd3e25e.tar.gz opie-fef9cec046fcf21a4f762c36454b8f253dd3e25e.tar.bz2 |
some (hopeful) improvements
23 files changed, 230 insertions, 196 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index e4bb6c5..54d2da2 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp @@ -78,3 +78,3 @@ void POP3viewItem::refresh() -RecBody POP3viewItem::fetchBody( const RecMailP &mail ) +RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) { @@ -163,3 +163,3 @@ void POP3folderItem::refresh(QValueList<RecMailP>&target) -RecBody POP3folderItem::fetchBody(const RecMailP&aMail) +RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) { @@ -269,3 +269,3 @@ void NNTPviewItem::refresh() -RecBody NNTPviewItem::fetchBody( const RecMailP &mail ) +RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) { @@ -367,3 +367,3 @@ void NNTPfolderItem::refresh(QValueList<RecMailP>&target) -RecBody NNTPfolderItem::fetchBody(const RecMailP&aMail) +RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) { @@ -564,5 +564,5 @@ void IMAPviewItem::contextMenuSelected(int id) -RecBody IMAPviewItem::fetchBody(const RecMailP&) +RECBODYP IMAPviewItem::fetchBody(const RecMailP&) { - return RecBody(); + return new RecBody(); } @@ -624,3 +624,3 @@ void IMAPfolderItem::refresh(QValueList<RecMailP>&target) -RecBody IMAPfolderItem::fetchBody(const RecMailP&aMail) +RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) { @@ -802,3 +802,3 @@ void MHviewItem::refresh(bool force) -RecBody MHviewItem::fetchBody( const RecMailP &mail ) +RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) { @@ -923,3 +923,3 @@ void MHfolderItem::refresh(QValueList<RecMailP>&target) -RecBody MHfolderItem::fetchBody(const RecMailP&aMail) +RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) { diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index 6cdb260..f125eeb 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h @@ -19,2 +19,4 @@ class Folder; +#define RECBODYP Opie::Core::OSmartPointer<RecBody> + class AccountViewItem : public QListViewItem @@ -30,3 +32,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; - virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; + virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; virtual QPopupMenu * getContextMenu(){return 0;}; @@ -54,3 +56,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); - virtual RecBody fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); + virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); @@ -74,3 +76,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); - virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); + virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); @@ -91,3 +93,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); - virtual RecBody fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); + virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); @@ -112,3 +114,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); - virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); + virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); @@ -130,3 +132,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); - virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); + virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); AbstractMail *getWrapper(); @@ -153,3 +155,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); - virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); + virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); @@ -172,3 +174,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); - virtual RecBody fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); + virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); @@ -195,3 +197,3 @@ public: virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); - virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&); + virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 811e57a..f0a163e 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -116,6 +116,6 @@ void AccountView::refreshAll() -RecBody AccountView::fetchBody(const RecMailP&aMail) +RecBodyP AccountView::fetchBody(const RecMailP&aMail) { QListViewItem*item = selectedItem (); - if (!item) return RecBody(); + if (!item) return new RecBody(); AccountViewItem *view = static_cast<AccountViewItem *>(item); diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index b082b1f..787b0b0 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h @@ -23,3 +23,3 @@ public: virtual void populate( QList<Account> list ); - virtual RecBody fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); + virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 5bc2883..988a1d9 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp @@ -282,3 +282,3 @@ void ComposeMail::reEditMail(const RecMailP¤t) RecMailP data = current; - message->setText(data->Wrapper()->fetchBody(current).Bodytext()); + message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); subjectLine->setText( data->getSubject()); diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 2d55c83..e5d64a6 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h @@ -26,6 +26,6 @@ public: virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; - virtual RecBody fetchBody(const RecMailP&mail)=0; - virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part)=0; - virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part)=0; - virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part)=0; + virtual RecBodyP fetchBody(const RecMailP&mail)=0; + virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0; + virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0; + virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0; virtual encodedString* fetchRawBody(const RecMailP&mail)=0; diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index f428415..0c68280 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp @@ -24,3 +24,3 @@ Genericwrapper::~Genericwrapper() -void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) +void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) { @@ -40,21 +40,21 @@ void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) if (!type) { - target.setType("text"); - target.setSubtype("plain"); + target->setType("text"); + target->setSubtype("plain"); } else { - target.setSubtype(type->ct_subtype); + target->setSubtype(type->ct_subtype); switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { case MAILMIME_DISCRETE_TYPE_TEXT: - target.setType("text"); + target->setType("text"); break; case MAILMIME_DISCRETE_TYPE_IMAGE: - target.setType("image"); + target->setType("image"); break; case MAILMIME_DISCRETE_TYPE_AUDIO: - target.setType("audio"); + target->setType("audio"); break; case MAILMIME_DISCRETE_TYPE_VIDEO: - target.setType("video"); + target->setType("video"); break; case MAILMIME_DISCRETE_TYPE_APPLICATION: - target.setType("application"); + target->setType("application"); break; @@ -63,3 +63,3 @@ void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { - target.setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); + target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); } @@ -76,9 +76,9 @@ void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) case MAILMIME_FIELD_TRANSFER_ENCODING: - target.setEncoding(getencoding(field->fld_data.fld_encoding)); + target->setEncoding(getencoding(field->fld_data.fld_encoding)); break; case MAILMIME_FIELD_ID: - target.setIdentifier(field->fld_data.fld_id); + target->setIdentifier(field->fld_data.fld_id); break; case MAILMIME_FIELD_DESCRIPTION: - target.setDescription(field->fld_data.fld_description); + target->setDescription(field->fld_data.fld_description); break; @@ -91,3 +91,3 @@ void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) -void Genericwrapper::fillParameters(RecPart&target,clist*parameters) +void Genericwrapper::fillParameters(RecPartP&target,clist*parameters) { @@ -99,3 +99,3 @@ void Genericwrapper::fillParameters(RecPart&target,clist*parameters) if (param) { - target.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); + target->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); } @@ -134,3 +134,3 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) -void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) +void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) { @@ -147,3 +147,3 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi QString b; - RecPart part; + RecPartP part = new RecPart(); @@ -155,14 +155,14 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi r = mailmessage_fetch_section(message,mime,&data,&len); - part.setSize(len); - part.setPositionlist(countlist); + part->setSize(len); + part->setPositionlist(countlist); b = gen_attachment_id(); - part.setIdentifier(b); + part->setIdentifier(b); fillSingleBody(part,message,mime); - if (part.Type()=="text" && target.Bodytext().isNull()) { + if (part->Type()=="text" && target->Bodytext().isNull()) { encodedString*rs = new encodedString(); rs->setContent(data,len); - encodedString*res = decode_String(rs,part.Encoding()); + encodedString*res = decode_String(rs,part->Encoding()); if (countlist.count()>2) { bodyCache[b]=rs; - target.addPart(part); + target->addPart(part); } else { @@ -172,7 +172,7 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi delete res; - target.setBodytext(b); - target.setDescription(part); + target->setBodytext(b); + target->setDescription(part); } else { bodyCache[b]=new encodedString(data,len); - target.addPart(part); + target->addPart(part); } @@ -188,7 +188,7 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi if (cbody->mm_type==MAILMIME_MULTIPLE) { - RecPart targetPart; - targetPart.setType("multipart"); + RecPartP targetPart = new RecPart(); + targetPart->setType("multipart"); countlist.append(current_count); - targetPart.setPositionlist(countlist); - target.addPart(targetPart); + targetPart->setPositionlist(countlist); + target->addPart(targetPart); } @@ -208,12 +208,12 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi if (current_rec > 0) { - part.setPositionlist(countlist); + part->setPositionlist(countlist); r = mailmessage_fetch_section(message,mime,&data,&len); - part.setSize(len); - part.setPositionlist(countlist); + part->setSize(len); + part->setPositionlist(countlist); b = gen_attachment_id(); - part.setIdentifier(b); - part.setType("message"); - part.setSubtype("rfc822"); + part->setIdentifier(b); + part->setType("message"); + part->setSubtype("rfc822"); bodyCache[b]=new encodedString(data,len); - target.addPart(part); + target->addPart(part); } @@ -227,3 +227,3 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi -RecBody Genericwrapper::parseMail( mailmessage * msg ) +RecBodyP Genericwrapper::parseMail( mailmessage * msg ) { @@ -233,3 +233,3 @@ RecBody Genericwrapper::parseMail( mailmessage * msg ) mailmime * mime=0; - RecBody body; + RecBodyP body = new RecBody(); memset(&fields, 0, sizeof(struct mailmime_single_fields)); @@ -334,7 +334,7 @@ QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) -encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPart&part) +encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPartP&part) { - QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); + QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); if (it==bodyCache.end()) return new encodedString(); - encodedString*t = decode_String(it.data(),part.Encoding()); + encodedString*t = decode_String(it.data(),part->Encoding()); return t; @@ -342,5 +342,5 @@ encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPart&pa -encodedString* Genericwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part) +encodedString* Genericwrapper::fetchRawPart(const RecMailP&,const RecPartP&part) { - QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); + QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier()); if (it==bodyCache.end()) return new encodedString(); @@ -350,3 +350,3 @@ encodedString* Genericwrapper::fetchRawPart(const RecMailP&mail,const RecPart&pa -QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part) +QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) { diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index f5b9504..8be9212 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h @@ -36,5 +36,5 @@ public: - virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part); - virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part); - virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part); + virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); + virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); + virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); virtual void cleanMimeCache(); @@ -45,3 +45,3 @@ public: protected: - RecBody parseMail( mailmessage * msg ); + RecBodyP parseMail( mailmessage * msg ); QString parseMailboxList( mailimf_mailbox_list *list ); @@ -52,5 +52,5 @@ protected: - void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); - static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); - static void fillParameters(RecPart&target,clist*parameters); + void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); + static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); + static void fillParameters(RecPartP&target,clist*parameters); static QString getencoding(mailmime_mechanism*aEnc); diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 56e7df9..230cf53 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp @@ -485,5 +485,5 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) -RecBody IMAPwrapper::fetchBody(const RecMailP&mail) +RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) { - RecBody body; + RecBodyP body = new RecBody(); const char *mb; @@ -644,3 +644,3 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int current_count means the position inside the internal loop! */ -void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body, +void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, int current_recursion,QValueList<int>recList,int current_count) @@ -655,6 +655,6 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta countlist.append(current_count); - RecPart currentPart; + RecPartP currentPart = new RecPart(); mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; QString id(""); - currentPart.setPositionlist(countlist); + currentPart->setPositionlist(countlist); for (unsigned int j = 0; j < countlist.count();++j) { @@ -664,3 +664,3 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta qDebug("ID = %s",id.latin1()); - currentPart.setIdentifier(id); + currentPart->setIdentifier(id); fillSinglePart(currentPart,part1); @@ -668,11 +668,11 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta 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()); - target_body.setDescription(currentPart); - target_body.setBodytext(body_text); + 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()); + target_body->setDescription(currentPart); + target_body->setBodytext(body_text); if (countlist.count()>1) { - target_body.addPart(currentPart); + target_body->addPart(currentPart); } } else { - target_body.addPart(currentPart); + target_body->addPart(currentPart); } @@ -693,8 +693,8 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta if (current_body->bd_type==MAILIMAP_BODY_MPART) { - RecPart targetPart; - targetPart.setType("multipart"); + RecPartP targetPart = new RecPart(); + targetPart->setType("multipart"); fillMultiPart(targetPart,mailDescription); countlist.append(current_count); - targetPart.setPositionlist(countlist); - target_body.addPart(targetPart); + targetPart->setPositionlist(countlist); + target_body->addPart(targetPart); QString id(""); @@ -719,3 +719,3 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&ta -void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description) +void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) { @@ -726,3 +726,3 @@ void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*De case MAILIMAP_BODY_TYPE_1PART_TEXT: - target_part.setType("text"); + target_part->setType("text"); fillSingleTextPart(target_part,Description->bd_data.bd_type_text); @@ -733,3 +733,3 @@ void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*De case MAILIMAP_BODY_TYPE_1PART_MSG: - target_part.setType("message"); + target_part->setType("message"); fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); @@ -741,3 +741,3 @@ void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*De -void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) +void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) { @@ -749,4 +749,4 @@ void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text qDebug("Type= text/%s",which->bd_media_text); - target_part.setSubtype(sub.lower()); - target_part.setLines(which->bd_lines); + target_part->setSubtype(sub.lower()); + target_part->setLines(which->bd_lines); fillBodyFields(target_part,which->bd_fields); @@ -754,3 +754,3 @@ void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text -void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which) +void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) { @@ -759,6 +759,6 @@ void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*w } - target_part.setSubtype("rfc822"); + target_part->setSubtype("rfc822"); qDebug("Message part"); /* we set this type to text/plain */ - target_part.setLines(which->bd_lines); + target_part->setLines(which->bd_lines); fillBodyFields(target_part,which->bd_fields); @@ -766,3 +766,3 @@ void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*w -void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which) +void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) { @@ -770,3 +770,3 @@ void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*whi QString sub = which->bd_media_subtype; - target_part.setSubtype(sub.lower()); + target_part->setSubtype(sub.lower()); if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { @@ -777,3 +777,3 @@ void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*whi if (param) { - target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); + target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); } @@ -783,3 +783,3 @@ void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*whi -void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) +void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which) { @@ -820,4 +820,4 @@ void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_bas qDebug("Type = %s/%s",type.latin1(),sub.latin1()); - target_part.setType(type.lower()); - target_part.setSubtype(sub.lower()); + target_part->setType(type.lower()); + target_part->setSubtype(sub.lower()); fillBodyFields(target_part,which->bd_fields); @@ -825,3 +825,3 @@ void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_bas -void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) +void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) { @@ -834,3 +834,3 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) if (param) { - target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); + target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); } @@ -866,6 +866,6 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) if (which->bd_description) { - target_part.setDescription(QString(which->bd_description)); + target_part->setDescription(QString(which->bd_description)); } - target_part.setEncoding(encoding); - target_part.setSize(which->bd_size); + target_part->setEncoding(encoding); + target_part->setSize(which->bd_size); } @@ -950,11 +950,11 @@ QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&pat -QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part) +QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) { - return fetchTextPart(mail,part.Positionlist(),false,part.Encoding()); + return fetchTextPart(mail,part->Positionlist(),false,part->Encoding()); } -encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPart&part) +encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part) { - encodedString*res = fetchRawPart(mail,part.Positionlist(),false); - encodedString*r = decode_String(res,part.Encoding()); + encodedString*res = fetchRawPart(mail,part->Positionlist(),false); + encodedString*r = decode_String(res,part->Encoding()); delete res; @@ -963,5 +963,5 @@ encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPart&p -encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part) +encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPartP&part) { - return fetchRawPart(mail,part.Positionlist(),false); + return fetchRawPart(mail,part->Positionlist(),false); } diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 7448acb..e56605a 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h @@ -37,6 +37,6 @@ public: - virtual RecBody fetchBody(const RecMailP&mail); - virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part); - virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part); - virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part); + virtual RecBodyP fetchBody(const RecMailP&mail); + virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); + virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); + virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); virtual encodedString* fetchRawBody(const RecMailP&mail); @@ -62,11 +62,11 @@ protected: - void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description); - void fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which); - void fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which); - void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); - void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); - void traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); + void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description); + void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which); + void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which); + void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which); + void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which); + void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,QValueList<int>recList,int current_count=1); /* just helpers */ - static void fillBodyFields(RecPart&target_part,mailimap_body_fields*which); + static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which); static QStringList address_list_to_stringlist(clist*list); diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index fd91fe5..90b8865 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp @@ -113,3 +113,4 @@ const QStringList& RecMail::References()const RecPart::RecPart() - : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) + : Opie::Core::ORefCount(), + m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) { @@ -119,2 +120,18 @@ RecPart::RecPart() +RecPart::RecPart(const RecPart&old) + : Opie::Core::ORefCount(), + m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) +{ + m_type = old.m_type; + m_subtype = old.m_subtype; + m_identifier = old.m_identifier; + m_encoding = old.m_encoding; + m_description = old.m_description; + m_lines = old.m_lines; + m_size = old.m_size; + m_Parameters = old.m_Parameters; + m_poslist = old.m_poslist; + qDebug("RecPart copy constructor"); +} + RecPart::~RecPart() @@ -229,3 +246,3 @@ const QValueList<int>& RecPart::Positionlist()const RecBody::RecBody() - : m_BodyText(),m_PartsList(),m_description() + : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) { @@ -234,2 +251,11 @@ RecBody::RecBody() +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; + qDebug("Recbody copy constructor"); +} + RecBody::~RecBody() @@ -248,3 +274,3 @@ const QString& RecBody::Bodytext()const -void RecBody::setParts(const QValueList<RecPart>&parts) +void RecBody::setParts(const QValueList<RecPartP>&parts) { @@ -254,3 +280,3 @@ void RecBody::setParts(const QValueList<RecPart>&parts) -const QValueList<RecPart>& RecBody::Parts()const +const QValueList<RecPartP>& RecBody::Parts()const { @@ -259,3 +285,3 @@ const QValueList<RecPart>& RecBody::Parts()const -void RecBody::addPart(const RecPart& part) +void RecBody::addPart(const RecPartP& part) { @@ -264,3 +290,3 @@ void RecBody::addPart(const RecPart& part) -void RecBody::setDescription(const RecPart&des) +void RecBody::setDescription(const RecPartP&des) { @@ -269,3 +295,3 @@ void RecBody::setDescription(const RecPart&des) -const RecPart& RecBody::Description()const +const RecPartP& RecBody::Description()const { diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index 941556a..c317880 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h @@ -86,3 +86,3 @@ typedef QMap<QString,QString> part_plist_t; -class RecPart +class RecPart:public Opie::Core::ORefCount { @@ -97,2 +97,3 @@ public: RecPart(); + RecPart(const RecPart&); virtual ~RecPart(); @@ -123,3 +124,5 @@ public: -class RecBody +typedef Opie::Core::OSmartPointer<RecPart> RecPartP; + +class RecBody:public Opie::Core::ORefCount { @@ -127,4 +130,4 @@ protected: QString m_BodyText; - QValueList<RecPart> m_PartsList; - RecPart m_description; + QValueList<RecPartP> m_PartsList; + RecPartP m_description; @@ -132,2 +135,3 @@ public: RecBody(); + RecBody(const RecBody&old); virtual ~RecBody(); @@ -136,10 +140,12 @@ public: - void setDescription(const RecPart&des); - const RecPart& Description()const; + void setDescription(const RecPartP&des); + const RecPartP& Description()const; - void setParts(const QValueList<RecPart>&parts); - const QValueList<RecPart>& Parts()const; - void addPart(const RecPart&part); + void setParts(const QValueList<RecPartP>&parts); + const QValueList<RecPartP>& Parts()const; + void addPart(const RecPartP&part); }; +typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; + class encodedString diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 4aee0be..e3c75f3 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp @@ -89,5 +89,5 @@ void MBOXwrapper::answeredMail(const RecMailP&) -RecBody MBOXwrapper::fetchBody( const RecMailP &mail ) +RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) { - RecBody body; + RecBodyP body = new RecBody(); mailstorage*storage = mailstorage_new(NULL); diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index a2ecfee..9731b85 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h @@ -30,3 +30,3 @@ public: - virtual RecBody fetchBody( const RecMailP &mail ); + virtual RecBodyP fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 5eae31f..12472e9 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp @@ -125,5 +125,5 @@ void MHwrapper::answeredMail(const RecMailP&) -RecBody MHwrapper::fetchBody( const RecMailP &mail ) +RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) { - RecBody body; + RecBodyP body = new RecBody(); init_storage(); diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h index 0846ec3..4310c84 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.h +++ b/noncore/net/mail/libmailwrapper/mhwrapper.h @@ -35,3 +35,3 @@ public: - virtual RecBody fetchBody( const RecMailP &mail ); + virtual RecBodyP fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index 9de958d..cc36f32 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp @@ -35,3 +35,3 @@ void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { -RecBody NNTPwrapper::fetchBody( const RecMailP &mail ) { +RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { int err = NEWSNNTP_NO_ERROR; @@ -40,8 +40,8 @@ RecBody NNTPwrapper::fetchBody( const RecMailP &mail ) { + RecBodyP body = new RecBody(); login(); if ( !m_nntp ) { - return RecBody(); + return body; } - RecBody body; mailmessage * mailmsg; diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index a87a8e8..2fb82f2 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h @@ -32,3 +32,3 @@ public: - virtual RecBody fetchBody( const RecMailP &mail ); + virtual RecBodyP fetchBody( const RecMailP &mail ); virtual encodedString* fetchRawBody(const RecMailP&mail); diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index f5694fe..1b7a1b4 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp @@ -33,3 +33,3 @@ void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { -RecBody POP3wrapper::fetchBody( const RecMailP &mail ) { +RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { int err = MAILPOP3_NO_ERROR; @@ -38,8 +38,9 @@ RecBody POP3wrapper::fetchBody( const RecMailP &mail ) { + RecBodyP body = new RecBody(); + login(); if ( !m_pop3 ) { - return RecBody(); + return body; } - RecBody body; mailmessage * mailmsg; diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index c46b941..5101fa5 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h @@ -28,3 +28,3 @@ public: - virtual RecBody fetchBody( const RecMailP &mail ); + virtual RecBodyP fetchBody( const RecMailP &mail ); virtual encodedString* fetchRawBody(const RecMailP&mail); diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index dd305df..5da2161 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -148,3 +148,3 @@ void OpieMail::displayMail() RecMailP mail = ((MailListViewItem*)item)->data(); - RecBody body = folderView->fetchBody(mail); + RecBodyP body = folderView->fetchBody(mail); ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index f00d2cb..156e11d 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -80,3 +80,3 @@ AttachItem* ViewMail::lastChild(AttachItem*parent) -void ViewMail::setBody( RecBody body ) +void ViewMail::setBody(const RecBodyP&body ) { @@ -84,6 +84,6 @@ void ViewMail::setBody( RecBody body ) m_body = body; - m_mail[2] = body.Bodytext(); - attachbutton->setEnabled(body.Parts().count()>0); - attachments->setEnabled(body.Parts().count()>0); - if (body.Parts().count()==0) + m_mail[2] = body->Bodytext(); + attachbutton->setEnabled(body->Parts().count()>0); + attachments->setEnabled(body->Parts().count()>0); + if (body->Parts().count()==0) { @@ -93,5 +93,5 @@ void ViewMail::setBody( RecBody body ) AttachItem * parentItem = 0; - QString type=body.Description().Type()+"/"+body.Description().Subtype(); + QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); QString desc,fsize; - double s = body.Description().Size(); + double s = body->Description()->Size(); int w; @@ -131,11 +131,11 @@ void ViewMail::setBody( RecBody body ) - curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body.Description().Positionlist()); + curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); QString filename = ""; - for (unsigned int i = 0; i < body.Parts().count();++i) + for (unsigned int i = 0; i < body->Parts().count();++i) { filename = ""; - type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); - part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); - for (;it!=body.Parts()[i].Parameters().end();++it) + type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); + part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); + for (;it!=body->Parts()[i]->Parameters().end();++it) { @@ -147,3 +147,3 @@ void ViewMail::setBody( RecBody body ) } - s = body.Parts()[i].Size(); + s = body->Parts()[i]->Size(); w = 0; @@ -171,4 +171,4 @@ void ViewMail::setBody( RecBody body ) o << s << " " << q << "Byte"; - desc = body.Parts()[i].Description(); - parentItem = searchParent(body.Parts()[i].Positionlist()); + desc = body->Parts()[i]->Description(); + parentItem = searchParent(body->Parts()[i]->Positionlist()); if (parentItem) @@ -177,3 +177,3 @@ void ViewMail::setBody( RecBody body ) if (temp) curItem = temp; - curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); + curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); attachments->setRootIsDecorated(true); @@ -183,3 +183,3 @@ void ViewMail::setBody( RecBody body ) { - curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); + curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); } @@ -228,3 +228,3 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int { - encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); + encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); if (content) @@ -250,3 +250,3 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int { // make sure that there is a wrapper , even after delete or simular actions - browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); + browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); } @@ -259,3 +259,3 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int -void ViewMail::setMail( RecMailP mail ) +void ViewMail::setMail(const RecMailP&mail ) { diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index 6875e3c..b60fb8e 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h @@ -38,5 +38,5 @@ public: void exec(); - void setMail( RecMailP mail ); - void setBody( RecBody body ); - bool deleted; + void setMail(const RecMailP&mail ); + void setBody(const RecBodyP&body); + bool deleted; @@ -50,5 +50,5 @@ protected slots: void slotForward(); - void setText(); - void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); - void slotDeleteMail( ); + void setText(); + void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); + void slotDeleteMail( ); void slotShowHtml( bool ); @@ -61,11 +61,10 @@ private: bool m_gotBody; - RecBody m_body; - RecMailP m_recMail; + RecBodyP m_body; + RecMailP m_recMail; bool m_showHtml; - // 0 from 1 subject 2 bodytext 3 date - QMap <int,QString> m_mail; - // 0 to 1 cc 2 bcc - QMap <int,QStringList> m_mail2; - + // 0 from 1 subject 2 bodytext 3 date + QMap <int,QString> m_mail; + // 0 to 1 cc 2 bcc + QMap <int,QStringList> m_mail2; }; |