author | alwin <alwin> | 2004-03-12 19:24:38 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-12 19:24:38 (UTC) |
commit | b600871ce93553a116a66fd80acd6dfc1cc46829 (patch) (side-by-side diff) | |
tree | b361346a49e09d9f0220993583bf183cf29bd974 | |
parent | 874d5a34eca296263dcd1adf857aebe9981825a1 (diff) | |
download | opie-b600871ce93553a116a66fd80acd6dfc1cc46829.zip opie-b600871ce93553a116a66fd80acd6dfc1cc46829.tar.gz opie-b600871ce93553a116a66fd80acd6dfc1cc46829.tar.bz2 |
some more smart-pointers
some bugfixes
some renaming of internals
38 files changed, 347 insertions, 345 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 3e12563..9a09c18 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp @@ -50,5 +50,5 @@ AbstractMail *POP3viewItem::getWrapper() } -void POP3viewItem::refresh( QList<RecMail> & ) +void POP3viewItem::refresh(QValueList<Opie::OSmartPointer<RecMail> > & ) { refresh(); @@ -76,5 +76,5 @@ void POP3viewItem::refresh() } -RecBody POP3viewItem::fetchBody( const RecMail &mail ) +RecBody POP3viewItem::fetchBody( const RecMailP &mail ) { qDebug( "POP3 fetchBody" ); @@ -155,5 +155,5 @@ POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , } -void POP3folderItem::refresh(QList<RecMail>&target) +void POP3folderItem::refresh(QValueList<RecMailP>&target) { if (folder->may_select()) @@ -161,5 +161,5 @@ void POP3folderItem::refresh(QList<RecMail>&target) } -RecBody POP3folderItem::fetchBody(const RecMail&aMail) +RecBody POP3folderItem::fetchBody(const RecMailP&aMail) { return pop3->getWrapper()->fetchBody(aMail); @@ -240,5 +240,5 @@ AbstractMail *NNTPviewItem::getWrapper() } -void NNTPviewItem::refresh( QList<RecMail> & ) +void NNTPviewItem::refresh( QValueList<RecMailP> & ) { refresh(); @@ -267,5 +267,5 @@ void NNTPviewItem::refresh() } -RecBody NNTPviewItem::fetchBody( const RecMail &mail ) +RecBody NNTPviewItem::fetchBody( const RecMailP &mail ) { qDebug( "NNTP fetchBody" ); @@ -359,5 +359,5 @@ NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent } -void NNTPfolderItem::refresh(QList<RecMail>&target) +void NNTPfolderItem::refresh(QValueList<RecMailP>&target) { if (folder->may_select()) @@ -365,5 +365,5 @@ void NNTPfolderItem::refresh(QList<RecMail>&target) } -RecBody NNTPfolderItem::fetchBody(const RecMail&aMail) +RecBody NNTPfolderItem::fetchBody(const RecMailP&aMail) { return nntp->getWrapper()->fetchBody(aMail); @@ -429,5 +429,5 @@ AbstractMail *IMAPviewItem::getWrapper() } -void IMAPviewItem::refresh(QList<RecMail>&) +void IMAPviewItem::refresh(QValueList<RecMailP>&) { refreshFolders(false); @@ -562,5 +562,5 @@ void IMAPviewItem::contextMenuSelected(int id) } -RecBody IMAPviewItem::fetchBody(const RecMail&) +RecBody IMAPviewItem::fetchBody(const RecMailP&) { return RecBody(); @@ -610,5 +610,5 @@ const QString& IMAPfolderItem::Delemiter()const } -void IMAPfolderItem::refresh(QList<RecMail>&target) +void IMAPfolderItem::refresh(QValueList<RecMailP>&target) { if (folder->may_select()) @@ -622,5 +622,5 @@ void IMAPfolderItem::refresh(QList<RecMail>&target) } -RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) +RecBody IMAPfolderItem::fetchBody(const RecMailP&aMail) { return imap->getWrapper()->fetchBody(aMail); @@ -749,5 +749,5 @@ AbstractMail *MHviewItem::getWrapper() } -void MHviewItem::refresh( QList<RecMail> & target) +void MHviewItem::refresh( QValueList<RecMailP> & target) { refresh(false); @@ -800,5 +800,5 @@ void MHviewItem::refresh(bool force) } -RecBody MHviewItem::fetchBody( const RecMail &mail ) +RecBody MHviewItem::fetchBody( const RecMailP &mail ) { qDebug( "MH fetchBody" ); @@ -915,5 +915,5 @@ const FolderP&MHfolderItem::getFolder()const } -void MHfolderItem::refresh(QList<RecMail>&target) +void MHfolderItem::refresh(QValueList<RecMailP>&target) { if (folder->may_select()) @@ -921,5 +921,5 @@ void MHfolderItem::refresh(QList<RecMail>&target) } -RecBody MHfolderItem::fetchBody(const RecMail&aMail) +RecBody MHfolderItem::fetchBody(const RecMailP&aMail) { return mbox->getWrapper()->fetchBody(aMail); @@ -1043,5 +1043,5 @@ AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) } -AccountViewItem::AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) +AccountViewItem::AccountViewItem( const Opie::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) :QListViewItem( parent,after ),folder(folderInit) { diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index 8f712f5..276eae0 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h @@ -4,5 +4,5 @@ #include <qlistview.h> #include <qlist.h> -#include <opie2/osmart_pointer.h> +#include <opie2/osmartpointer.h> class POP3wrapper; @@ -25,9 +25,9 @@ public: AccountViewItem( QListViewItem *parent); AccountViewItem( QListViewItem *parent , QListViewItem*after ); - AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); + AccountViewItem( const Opie::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); virtual ~AccountViewItem(); - virtual void refresh(QList<RecMail>&)=0; - virtual RecBody fetchBody(const RecMail&)=0; + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&)=0; + virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&)=0; virtual QPopupMenu * getContextMenu(){return 0;}; virtual void contextMenuSelected(int){} @@ -40,8 +40,8 @@ protected: virtual void init(); virtual void removeChilds(); - virtual void deleteAllMail(AbstractMail*wrapper,const Opie::osmart_pointer<Folder>&f); + virtual void deleteAllMail(AbstractMail*wrapper,const Opie::OSmartPointer<Folder>&f); static const QString contextName; AccountView*m_Backlink; - Opie::osmart_pointer<Folder> folder; + Opie::OSmartPointer<Folder> folder; }; @@ -52,6 +52,6 @@ public: POP3viewItem( POP3account *a, AccountView *parent ); virtual ~POP3viewItem(); - virtual void refresh( QList<RecMail> &target ); - virtual RecBody fetchBody( const RecMail &mail ); + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target ); + virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); virtual QPopupMenu * getContextMenu(); @@ -70,8 +70,8 @@ class POP3folderItem : public AccountViewItem public: - POP3folderItem( const Opie::osmart_pointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); + POP3folderItem( const Opie::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); virtual ~POP3folderItem(); - virtual void refresh(QList<RecMail>&); - virtual RecBody fetchBody(const RecMail&); + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&); + virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); @@ -89,6 +89,6 @@ public: NNTPviewItem( NNTPaccount *a, AccountView *parent ); virtual ~NNTPviewItem(); - virtual void refresh( QList<RecMail> &target ); - virtual RecBody fetchBody( const RecMail &mail ); + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target ); + virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); virtual QPopupMenu * getContextMenu(); @@ -108,8 +108,8 @@ class NNTPfolderItem : public AccountViewItem public: - NNTPfolderItem(const Opie::osmart_pointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); + NNTPfolderItem(const Opie::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); virtual ~NNTPfolderItem(); - virtual void refresh(QList<RecMail>&); - virtual RecBody fetchBody(const RecMail&); + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&); + virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); @@ -128,6 +128,6 @@ public: IMAPviewItem( IMAPaccount *a, AccountView *parent ); virtual ~IMAPviewItem(); - virtual void refresh(QList<RecMail>&); - virtual RecBody fetchBody(const RecMail&); + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&); + virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&); AbstractMail *getWrapper(); virtual QPopupMenu * getContextMenu(); @@ -148,9 +148,9 @@ class IMAPfolderItem : public AccountViewItem public: - IMAPfolderItem( const Opie::osmart_pointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); - IMAPfolderItem( const Opie::osmart_pointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); + IMAPfolderItem( const Opie::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); + IMAPfolderItem( const Opie::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); virtual ~IMAPfolderItem(); - virtual void refresh(QList<RecMail>&); - virtual RecBody fetchBody(const RecMail&); + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&); + virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); @@ -170,6 +170,6 @@ public: MHviewItem( const QString&aMboxPath, AccountView *parent ); virtual ~MHviewItem(); - virtual void refresh( QList<RecMail> &target ); - virtual RecBody fetchBody( const RecMail &mail ); + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target ); + virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); virtual QPopupMenu * getContextMenu(); @@ -190,12 +190,12 @@ class MHfolderItem : public AccountViewItem public: - MHfolderItem( const Opie::osmart_pointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); - MHfolderItem( const Opie::osmart_pointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); + MHfolderItem( const Opie::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); + MHfolderItem( const Opie::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); virtual ~MHfolderItem(); - virtual void refresh(QList<RecMail>&); - virtual RecBody fetchBody(const RecMail&); + virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&); + virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); - virtual const Opie::osmart_pointer<Folder>&getFolder()const; + virtual const Opie::OSmartPointer<Folder>&getFolder()const; virtual bool isDraftfolder(); diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 297f553..26107ff 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -93,9 +93,8 @@ void AccountView::refresh(QListViewItem *item) { m_currentItem = item; - QList<RecMail> headerlist; - headerlist.setAutoDelete(true); + QValueList<RecMailP> headerlist; AccountViewItem *view = static_cast<AccountViewItem *>(item); view->refresh(headerlist); - emit refreshMailview(&headerlist); + emit refreshMailview(headerlist); } } @@ -105,9 +104,8 @@ void AccountView::refreshCurrent() m_currentItem = currentItem(); if ( !m_currentItem ) return; - QList<RecMail> headerlist; - headerlist.setAutoDelete(true); + QValueList<RecMailP> headerlist; AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); view->refresh(headerlist); - emit refreshMailview(&headerlist); + emit refreshMailview(headerlist); } @@ -116,5 +114,5 @@ void AccountView::refreshAll() } -RecBody AccountView::fetchBody(const RecMail&aMail) +RecBody AccountView::fetchBody(const RecMailP&aMail) { QListViewItem*item = selectedItem (); diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 3478c0b..d236058 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h @@ -4,9 +4,8 @@ #include <qlistview.h> #include <qlist.h> -#include <opie2/osmart_pointer.h> +#include <opie2/osmartpointer.h> +#include <libmailwrapper/mailtypes.h> class Selectstore; -class RecMail; -class RecBody; class Folder; class AbstractMail; @@ -23,6 +22,6 @@ public: virtual ~AccountView(); virtual void populate( QList<Account> list ); - virtual RecBody fetchBody(const RecMail&aMail); - virtual void downloadMails(const Opie::osmart_pointer<Folder>&fromFolder,AbstractMail*fromWrapper); + virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&aMail); + virtual void downloadMails(const Opie::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); virtual bool currentisDraft(); @@ -36,5 +35,5 @@ public slots: signals: - void refreshMailview(QList<RecMail>*); + void refreshMailview(const QValueList<RecMailP>& ); protected: diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 445cc5e..74ccc7b 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp @@ -189,5 +189,5 @@ void ComposeMail::accept() smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); #endif - Opie::osmart_pointer<Mail> mail=new Mail; + Opie::OSmartPointer<Mail> mail=new Mail; SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); @@ -237,5 +237,5 @@ void ComposeMail::reject() if (yesno == 0) { - Opie::osmart_pointer<Mail> mail=new Mail(); + Opie::OSmartPointer<Mail> mail=new Mail(); mail->setMail(fromBox->currentText()); mail->setTo( toLine->text() ); @@ -276,13 +276,13 @@ ComposeMail::~ComposeMail() } -void ComposeMail::reEditMail(const RecMail¤t) +void ComposeMail::reEditMail(const RecMailP¤t) { - RecMail data = current; - message->setText(data.Wrapper()->fetchBody(current).Bodytext()); - subjectLine->setText( data.getSubject()); - toLine->setText(data.To().join(",")); - ccLine->setText(data.CC().join(",")); - bccLine->setText(data.Bcc().join(",")); - replyLine->setText(data.Replyto()); + RecMailP data = current; + message->setText(data->Wrapper()->fetchBody(current).Bodytext()); + subjectLine->setText( data->getSubject()); + toLine->setText(data->To().join(",")); + ccLine->setText(data->CC().join(",")); + bccLine->setText(data->Bcc().join(",")); + replyLine->setText(data->Replyto()); } diff --git a/noncore/net/mail/composemail.h b/noncore/net/mail/composemail.h index 1b9fc79..c12eb30 100644 --- a/noncore/net/mail/composemail.h +++ b/noncore/net/mail/composemail.h @@ -10,5 +10,7 @@ #include <libmailwrapper/mailwrapper.h> +class RecMail; +#include <opie2/osmartpointer.h> class AddressPicker : public AddressPickerUI @@ -36,5 +38,5 @@ public: virtual ~ComposeMail(); - void reEditMail(const RecMail¤t); + void reEditMail(const Opie::OSmartPointer<RecMail>¤t); public slots: diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 7e6d383..68a7a4d 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp @@ -82,5 +82,5 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin QString AbstractMail::convert_String(const char*text) { - size_t index = 0; + //size_t index = 0; char*res = 0; int err = MAILIMF_NO_ERROR; @@ -112,5 +112,5 @@ QString AbstractMail::gen_attachment_id() } -int AbstractMail::createMbox(const QString&,const FolderP&,const QString& delemiter,bool) +int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) { return 0; @@ -130,5 +130,5 @@ QString AbstractMail::draftFolder() /* temporary - will be removed when implemented in all classes */ -void AbstractMail::deleteMails(const QString &,QList<RecMail> &) +void AbstractMail::deleteMails(const QString &,const QValueList<Opie::OSmartPointer<RecMail> > &) { } @@ -137,15 +137,15 @@ void AbstractMail::mvcpAllMails(const FolderP&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { - QList<RecMail> t; + QValueList<RecMailP> t; listMessages(fromFolder->getName(),t); encodedString*st = 0; while (t.count()>0) { - RecMail*r = t.at(0); - st = fetchRawBody(*r); + RecMailP r = (*t.begin()); + st = fetchRawBody(r); if (st) { targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); delete st; } - t.removeFirst(); + t.remove(t.begin()); } if (moveit) { @@ -154,5 +154,5 @@ void AbstractMail::mvcpAllMails(const FolderP&fromFolder, } -void AbstractMail::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) +void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { encodedString*st = 0; diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index d911468..b03d757 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h @@ -7,9 +7,7 @@ #include <qobject.h> -#include <opie2/osmart_pointer.h> +#include <opie2/osmartpointer.h> +#include "mailtypes.h" -class RecMail; -class RecBody; -class RecPart; class IMAPwrapper; class POP3wrapper; @@ -24,23 +22,23 @@ public: AbstractMail(){}; virtual ~AbstractMail(){} - virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders()=0; - virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; + virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders()=0; + virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target )=0; virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; - virtual RecBody fetchBody(const RecMail&mail)=0; - virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; - virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; - virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; - virtual encodedString* fetchRawBody(const RecMail&mail)=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 encodedString* fetchRawBody(const RecMailP&mail)=0; - virtual void deleteMail(const RecMail&mail)=0; - virtual void answeredMail(const RecMail&mail)=0; - virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&)=0; - virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); - virtual int deleteMbox(const Opie::osmart_pointer<Folder>&)=0; + virtual void deleteMail(const RecMailP&mail)=0; + virtual void answeredMail(const RecMailP&mail)=0; + virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&)=0; + virtual void deleteMails(const QString & FolderName,const QValueList<Opie::OSmartPointer<RecMail> >&target); + virtual int deleteMbox(const Opie::OSmartPointer<Folder>&)=0; virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; - virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, + virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); - virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); + virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void cleanMimeCache(){}; @@ -50,5 +48,5 @@ public: * them has to be appended automatic. */ - virtual int createMbox(const QString&,const Opie::osmart_pointer<Folder>&parentfolder=0, + virtual int createMbox(const QString&,const Opie::OSmartPointer<Folder>&parentfolder=0, const QString& delemiter="/",bool getsubfolder=false); virtual void logout()=0; diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp index 4f7ec0c..cb7ccc0 100644 --- a/noncore/net/mail/libmailwrapper/generatemail.cpp +++ b/noncore/net/mail/libmailwrapper/generatemail.cpp @@ -280,5 +280,5 @@ mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail } -mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&mail ) +mailimf_fields *Generatemail::createImfFields(const Opie::OSmartPointer<Mail>&mail ) { mailimf_fields *fields = NULL; @@ -400,5 +400,5 @@ mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&m } -mailmime *Generatemail::createMimeMail(const Opie::osmart_pointer<Mail> &mail ) { +mailmime *Generatemail::createMimeMail(const Opie::OSmartPointer<Mail> &mail ) { mailmime *message, *txtPart; mailimf_fields *fields; diff --git a/noncore/net/mail/libmailwrapper/generatemail.h b/noncore/net/mail/libmailwrapper/generatemail.h index 409a55e..c246a2a 100644 --- a/noncore/net/mail/libmailwrapper/generatemail.h +++ b/noncore/net/mail/libmailwrapper/generatemail.h @@ -7,5 +7,5 @@ #include <libetpan/clist.h> -#include <opie2/osmart_pointer.h> +#include <opie2/osmartpointer.h> class Mail; @@ -37,6 +37,6 @@ protected: mailmime *buildTxtPart(const QString&str ); mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); - mailimf_fields *createImfFields(const Opie::osmart_pointer<Mail> &mail ); - mailmime *createMimeMail(const Opie::osmart_pointer<Mail>&mail ); + mailimf_fields *createImfFields(const Opie::OSmartPointer<Mail> &mail ); + mailmime *createMimeMail(const Opie::OSmartPointer<Mail>&mail ); clist *createRcptList( mailimf_fields *fields ); diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 6c8a5a1..ee2c8cd 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp @@ -332,5 +332,5 @@ QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) } -encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) +encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPart&part) { QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); @@ -340,5 +340,5 @@ encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&par } -encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) +encodedString* Genericwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part) { QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); @@ -348,5 +348,5 @@ encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&par } -QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) +QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part) { encodedString*t = fetchDecodedPart(mail,part); @@ -388,5 +388,5 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) } -void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) +void Genericwrapper::parseList(QValueList<Opie::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) { int r; @@ -416,5 +416,5 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const continue; } - RecMail * mail = new RecMail(); + RecMailP mail = new RecMail(); mail->setWrapper(this); mail_flags * flag_result = 0; diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index d0db45a..f9968d1 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h @@ -35,9 +35,9 @@ public: virtual ~Genericwrapper(); - virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); - virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); - virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); + 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 void cleanMimeCache(); - virtual int deleteMbox(const Opie::osmart_pointer<Folder>&){return 1;} + virtual int deleteMbox(const Opie::OSmartPointer<Folder>&){return 1;} virtual void logout(){}; virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; @@ -55,5 +55,5 @@ protected: static void fillParameters(RecPart&target,clist*parameters); static QString getencoding(mailmime_mechanism*aEnc); - virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); + virtual void parseList(QValueList<Opie::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false); QStringList parseInreplies(mailimf_in_reply_to * in_replies); diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 3b3be0f..071e734 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp @@ -206,5 +206,5 @@ void IMAPwrapper::logout() } -void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) +void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::OSmartPointer<RecMail> > &target ) { int err = MAILIMAP_NO_ERROR; @@ -267,5 +267,5 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) } -QValueList<Opie::osmart_pointer<Folder> >* IMAPwrapper::listFolders() +QValueList<Opie::OSmartPointer<Folder> >* IMAPwrapper::listFolders() { const char *path, *mask; @@ -483,5 +483,5 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) } -RecBody IMAPwrapper::fetchBody(const RecMail&mail) +RecBody IMAPwrapper::fetchBody(const RecMailP&mail) { RecBody body; @@ -495,5 +495,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) mailimap_body*body_desc = 0; - mb = mail.getMbox().latin1(); + mb = mail->getMbox().latin1(); login(); @@ -501,5 +501,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) return body; } - err = selectMbox(mail.getMbox()); + err = selectMbox(mail->getMbox()); if ( err != MAILIMAP_NO_ERROR ) { return body; @@ -507,5 +507,5 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail) /* the range has to start at 1!!! not with 0!!!! */ - set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); + set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); fetchAtt = mailimap_fetch_att_new_bodystructure(); fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); @@ -569,5 +569,5 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list) } -encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) +encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) { encodedString*res=new encodedString; @@ -586,10 +586,10 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> } if (!internal_call) { - err = selectMbox(mail.getMbox()); + err = selectMbox(mail->getMbox()); if ( err != MAILIMAP_NO_ERROR ) { return res; } } - set = mailimap_set_new_single(mail.getNumber()); + set = mailimap_set_new_single(mail->getNumber()); clist*id_list = 0; @@ -642,5 +642,5 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int> /* current_recursion is for recursive calls. current_count means the position inside the internal loop! */ -void IMAPwrapper::traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body, +void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body, int current_recursion,QValueList<int>recList,int current_count) { @@ -870,5 +870,5 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) } -void IMAPwrapper::deleteMail(const RecMail&mail) +void IMAPwrapper::deleteMail(const RecMailP&mail) { mailimap_flag_list*flist; @@ -880,5 +880,5 @@ void IMAPwrapper::deleteMail(const RecMail&mail) return; } - err = selectMbox(mail.getMbox()); + err = selectMbox(mail->getMbox()); if ( err != MAILIMAP_NO_ERROR ) { return; @@ -887,5 +887,5 @@ void IMAPwrapper::deleteMail(const RecMail&mail) mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); store_flags = mailimap_store_att_flags_new_set_flags(flist); - set = mailimap_set_new_single(mail.getNumber()); + set = mailimap_set_new_single(mail->getNumber()); err = mailimap_store(m_imap,set,store_flags); mailimap_set_free( set ); @@ -905,5 +905,5 @@ void IMAPwrapper::deleteMail(const RecMail&mail) } -void IMAPwrapper::answeredMail(const RecMail&mail) +void IMAPwrapper::answeredMail(const RecMailP&mail) { mailimap_flag_list*flist; @@ -915,5 +915,5 @@ void IMAPwrapper::answeredMail(const RecMail&mail) return; } - err = selectMbox(mail.getMbox()); + err = selectMbox(mail->getMbox()); if ( err != MAILIMAP_NO_ERROR ) { return; @@ -922,5 +922,5 @@ void IMAPwrapper::answeredMail(const RecMail&mail) mailimap_flag_list_add(flist,mailimap_flag_new_answered()); store_flags = mailimap_store_att_flags_new_add_flags(flist); - set = mailimap_set_new_single(mail.getNumber()); + set = mailimap_set_new_single(mail->getNumber()); err = mailimap_store(m_imap,set,store_flags); mailimap_set_free( set ); @@ -933,5 +933,5 @@ void IMAPwrapper::answeredMail(const RecMail&mail) } -QString IMAPwrapper::fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call,const QString&enc) +QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) { QString body(""); @@ -948,10 +948,10 @@ QString IMAPwrapper::fetchTextPart(const RecMail&mail,const QValueList<int>&path } -QString IMAPwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) +QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part) { return fetchTextPart(mail,part.Positionlist(),false,part.Encoding()); } -encodedString* IMAPwrapper::fetchDecodedPart(const RecMail&mail,const RecPart&part) +encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPart&part) { encodedString*res = fetchRawPart(mail,part.Positionlist(),false); @@ -961,5 +961,5 @@ encodedString* IMAPwrapper::fetchDecodedPart(const RecMail&mail,const RecPart&pa } -encodedString* IMAPwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) +encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part) { return fetchRawPart(mail,part.Positionlist(),false); @@ -1056,5 +1056,4 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) clistiter * cur = 0; int r = 0; - int res = 0; target_stat.message_count = 0; target_stat.message_unseen = 0; @@ -1116,5 +1115,5 @@ const QString&IMAPwrapper::getName()const } -encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) +encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) { // dummy @@ -1155,5 +1154,5 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, } -void IMAPwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) +void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { if (targetWrapper != this) { @@ -1167,9 +1166,9 @@ void IMAPwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,Abstrac return; } - int err = selectMbox(mail.getMbox()); + int err = selectMbox(mail->getMbox()); if ( err != MAILIMAP_NO_ERROR ) { return; } - set = mailimap_set_new_single(mail.getNumber()); + set = mailimap_set_new_single(mail->getNumber()); err = mailimap_copy(m_imap,set,targetFolder.latin1()); mailimap_set_free( set ); diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 15f049f..3bd5967 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h @@ -24,25 +24,25 @@ public: IMAPwrapper( IMAPaccount *a ); virtual ~IMAPwrapper(); - virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); - virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); + virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); + virtual void listMessages(const QString & mailbox,QValueList<Opie::OSmartPointer<RecMail> >&target ); virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); - virtual void deleteMail(const RecMail&mail); - virtual void answeredMail(const RecMail&mail); - virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&folder); + virtual void deleteMail(const RecMailP&mail); + virtual void answeredMail(const RecMailP&mail); + virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&folder); virtual void storeMessage(const char*msg,size_t length, const QString&folder); - virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, + virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); - virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); + virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); - virtual RecBody fetchBody(const RecMail&mail); - virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); - virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part); - virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part); - virtual encodedString* fetchRawBody(const RecMail&mail); + 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 encodedString* fetchRawBody(const RecMailP&mail); - virtual int createMbox(const QString&,const Opie::osmart_pointer<Folder>&parentfolder=0, + virtual int createMbox(const QString&,const Opie::OSmartPointer<Folder>&parentfolder=0, const QString& delemiter="/",bool getsubfolder=false); - virtual int deleteMbox(const Opie::osmart_pointer<Folder>&folder); + virtual int deleteMbox(const Opie::OSmartPointer<Folder>&folder); static void imap_progress( size_t current, size_t maximum ); @@ -57,6 +57,6 @@ protected: bool start_tls(bool force=true); - virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); - virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call); + virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); + virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); int selectMbox(const QString&mbox); @@ -66,5 +66,5 @@ protected: void fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which); void fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which); - void traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); + void traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body,int current_recursion,QValueList<int>recList,int current_count=1); /* just helpers */ diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index 49b3caa..7dd7e58 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp @@ -3,5 +3,5 @@ RecMail::RecMail() - :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) + :Opie::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) { init(); @@ -9,5 +9,5 @@ RecMail::RecMail() RecMail::RecMail(const RecMail&old) - :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) + :Opie::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) { init(); diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index 10d367f..dc10de6 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h @@ -9,4 +9,6 @@ #define FLAG_RECENT 5 +#include <opie2/osmartpointer.h> + #include <qbitarray.h> #include <qstring.h> @@ -28,5 +30,5 @@ class AbstractMail; get the body. Same words for the attachments. */ -class RecMail +class RecMail:public Opie::ORefCount { public: @@ -35,6 +37,6 @@ public: virtual ~RecMail(); - const int getNumber()const{return msg_number;} - void setNumber(int number){msg_number=number;} + const unsigned int getNumber()const{return msg_number;} + void setNumber(unsigned int number){msg_number=number;} const QString&getDate()const{ return date; } void setDate( const QString&a ) { date = a; } @@ -49,6 +51,6 @@ public: void setReplyto(const QString&reply){replyto=reply;} const QString&Replyto()const{return replyto;} - void setMsgsize(int size){msg_size = size;} - const int Msgsize()const{return msg_size;} + void setMsgsize(unsigned int size){msg_size = size;} + const unsigned int Msgsize()const{return msg_size;} @@ -72,5 +74,5 @@ public: protected: QString subject,date,from,mbox,msg_id,replyto; - int msg_number,msg_size; + unsigned int msg_number,msg_size; QBitArray msg_flags; QStringList to,cc,bcc,in_reply_to,references; @@ -80,4 +82,5 @@ protected: }; +typedef Opie::OSmartPointer<RecMail> RecMailP; typedef QMap<QString,QString> part_plist_t; diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index c71d69f..9bf2fd3 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp @@ -156,5 +156,5 @@ QString IMAPFolder::decodeFolderName( const QString &name ) Mail::Mail() - :Opie::oref_count(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") + :Opie::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") { } diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h index 3b3bb32..6bf0078 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.h +++ b/noncore/net/mail/libmailwrapper/mailwrapper.h @@ -9,5 +9,5 @@ #include "settings.h" -#include <opie2/osmart_pointer.h> +#include <opie2/osmartpointer.h> class Attachment @@ -29,5 +29,5 @@ protected: }; -class Mail:public Opie::oref_count +class Mail:public Opie::ORefCount { public: @@ -67,5 +67,5 @@ private: }; -class Folder:public Opie::oref_count +class Folder:public Opie::ORefCount { public: @@ -83,5 +83,5 @@ protected: }; -typedef Opie::osmart_pointer<Folder> FolderP; +typedef Opie::OSmartPointer<Folder> FolderP; class MHFolder : public Folder diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index 9ff3de2..5e6b714 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp @@ -20,5 +20,5 @@ MBOXwrapper::~MBOXwrapper() } -void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) +void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target ) { mailstorage*storage = mailstorage_new(NULL); @@ -45,7 +45,7 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) } -QValueList<Opie::osmart_pointer<Folder> >* MBOXwrapper::listFolders() +QValueList<Opie::OSmartPointer<Folder> >* MBOXwrapper::listFolders() { - QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); + QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >(); QDir dir(MBOXPath); if (!dir.exists()) return folders; @@ -60,9 +60,9 @@ QValueList<Opie::osmart_pointer<Folder> >* MBOXwrapper::listFolders() } -void MBOXwrapper::deleteMail(const RecMail&mail) +void MBOXwrapper::deleteMail(const RecMailP & mail) { mailstorage*storage = mailstorage_new(NULL); QString p = MBOXPath+"/"; - p+=mail.getMbox(); + p+=mail->getMbox(); int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); mailfolder*folder; @@ -75,5 +75,5 @@ void MBOXwrapper::deleteMail(const RecMail&mail) return; } - r = mailsession_remove_message(folder->fld_session,mail.getNumber()); + r = mailsession_remove_message(folder->fld_session,mail->getNumber()); if (r != MAIL_NO_ERROR) { qDebug("error deleting mail"); @@ -83,14 +83,14 @@ void MBOXwrapper::deleteMail(const RecMail&mail) } -void MBOXwrapper::answeredMail(const RecMail&) +void MBOXwrapper::answeredMail(const RecMailP&) { } -RecBody MBOXwrapper::fetchBody( const RecMail &mail ) +RecBody MBOXwrapper::fetchBody( const RecMailP &mail ) { RecBody body; mailstorage*storage = mailstorage_new(NULL); QString p = MBOXPath+"/"; - p+=mail.getMbox(); + p+=mail->getMbox(); mailmessage * msg; char*data=0; @@ -107,7 +107,7 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) return body; } - r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); + r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { - qDebug("Error fetching mail %i",mail.getNumber()); + qDebug("Error fetching mail %i",mail->getNumber()); mailfolder_free(folder); mailstorage_free(storage); @@ -116,5 +116,5 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) r = mailmessage_fetch(msg,&data,&size); if (r != MAIL_NO_ERROR) { - qDebug("Error fetching mail %i",mail.getNumber()); + qDebug("Error fetching mail %i",mail->getNumber()); mailfolder_free(folder); mailstorage_free(storage); @@ -170,10 +170,10 @@ void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folde } -encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail) +encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail) { RecBody body; mailstorage*storage = mailstorage_new(NULL); QString p = MBOXPath+"/"; - p+=mail.getMbox(); + p+=mail->getMbox(); mailmessage * msg; char*data=0; @@ -190,7 +190,7 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail) return 0; } - r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg); + r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { - Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); + Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); mailfolder_free(folder); mailstorage_free(storage); @@ -199,5 +199,5 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail) r = mailmessage_fetch(msg,&data,&size); if (r != MAIL_NO_ERROR) { - Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); + Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); mailfolder_free(folder); mailstorage_free(storage); @@ -213,5 +213,5 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail) } -void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) +void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) { QString p = MBOXPath+"/"; @@ -227,10 +227,11 @@ void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) } -void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target) +void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target) { if (!f) return; int r; - for (unsigned int i=0; i < target.count();++i) { - r = mailmbox_delete_msg(f,target.at(i)->getNumber()); + QValueList<RecMailP>::ConstIterator it; + for (it=target.begin(); it != target.end();++it) { + r = mailmbox_delete_msg(f,(*it)->getNumber()); if (r!=MAILMBOX_NO_ERROR) { qDebug("error delete mail"); diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index c3d9b50..33eeb1e 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h @@ -5,6 +5,4 @@ #include <qstring.h> -class RecMail; -class RecBody; class encodedString; struct mailmbox_folder; @@ -18,28 +16,28 @@ public: virtual ~MBOXwrapper(); - virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); - virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); + virtual void listMessages(const QString & mailbox, QValueList<RecMailP>&target ); + virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); - virtual void deleteMail(const RecMail&mail); - virtual void answeredMail(const RecMail&mail); + virtual void deleteMail(const RecMailP&mail); + virtual void answeredMail(const RecMailP&mail); - virtual int createMbox(const QString&folder,const Opie::osmart_pointer<Folder>&f=0, + virtual int createMbox(const QString&folder,const Opie::OSmartPointer<Folder>&f=0, const QString&d="",bool s=false); - virtual int deleteMbox(const Opie::osmart_pointer<Folder>&); + virtual int deleteMbox(const Opie::OSmartPointer<Folder>&); virtual void storeMessage(const char*msg,size_t length, const QString&folder); - virtual RecBody fetchBody( const RecMail &mail ); + virtual RecBody fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); - virtual encodedString* fetchRawBody(const RecMail&mail); - virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); - virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); + virtual encodedString* fetchRawBody(const RecMailP&mail); + virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target); + virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; protected: - static void deleteMails(mailmbox_folder*f,QList<RecMail> &target); + static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target); QString MBOXPath; QString MBOXName; diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index aaaa20a..0b00a2e 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp @@ -61,5 +61,5 @@ MHwrapper::~MHwrapper() } -void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) +void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target ) { init_storage(); @@ -77,7 +77,7 @@ void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) } -QValueList<Opie::osmart_pointer<Folder> >* MHwrapper::listFolders() +QValueList<Opie::OSmartPointer<Folder> >* MHwrapper::listFolders() { - QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); + QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >(); /* this is needed! */ if (m_storage) mailstorage_disconnect(m_storage); @@ -102,5 +102,5 @@ QValueList<Opie::osmart_pointer<Folder> >* MHwrapper::listFolders() } -void MHwrapper::deleteMail(const RecMail&mail) +void MHwrapper::deleteMail(const RecMailP&mail) { init_storage(); @@ -108,10 +108,10 @@ void MHwrapper::deleteMail(const RecMail&mail) return; } - int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); + int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r!=MAIL_NO_ERROR) { qDebug("error selecting folder!"); return; } - r = mailsession_remove_message(m_storage->sto_session,mail.getNumber()); + r = mailsession_remove_message(m_storage->sto_session,mail->getNumber()); if (r != MAIL_NO_ERROR) { qDebug("error deleting mail"); @@ -119,9 +119,9 @@ void MHwrapper::deleteMail(const RecMail&mail) } -void MHwrapper::answeredMail(const RecMail&) +void MHwrapper::answeredMail(const RecMailP&) { } -RecBody MHwrapper::fetchBody( const RecMail &mail ) +RecBody MHwrapper::fetchBody( const RecMailP &mail ) { RecBody body; @@ -132,14 +132,13 @@ RecBody MHwrapper::fetchBody( const RecMail &mail ) mailmessage * msg; char*data=0; - size_t size; /* mail should hold the complete path! */ - int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); + int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r != MAIL_NO_ERROR) { return body; } - r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); + r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { - qDebug("Error fetching mail %i",mail.getNumber()); + qDebug("Error fetching mail %i",mail->getNumber()); return body; } @@ -213,5 +212,5 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) } -encodedString* MHwrapper::fetchRawBody(const RecMail&mail) +encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) { encodedString*result = 0; @@ -223,17 +222,17 @@ encodedString* MHwrapper::fetchRawBody(const RecMail&mail) char*data=0; size_t size; - int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); + int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r!=MAIL_NO_ERROR) { qDebug("error selecting folder!"); return result; } - r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg); + r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); if (r != MAIL_NO_ERROR) { - Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); + Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); return 0; } r = mailmessage_fetch(msg,&data,&size); if (r != MAIL_NO_ERROR) { - Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber())); + Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); if (msg) mailmessage_free(msg); return 0; @@ -244,5 +243,5 @@ encodedString* MHwrapper::fetchRawBody(const RecMail&mail) } -void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) +void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) { QString f = buildPath(mailbox); @@ -252,8 +251,7 @@ void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) return; } - RecMail*c = 0; - for (unsigned int i=0; i < target.count();++i) { - c = target.at(i); - r = mailsession_remove_message(m_storage->sto_session,c->getNumber()); + QValueList<RecMailP>::ConstIterator it; + for (it=target.begin(); it!=target.end();++it) { + r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); if (r != MAIL_NO_ERROR) { qDebug("error deleting mail"); @@ -373,5 +371,5 @@ const QString&MHwrapper::getName()const return MHName; } -void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) +void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { init_storage(); @@ -386,5 +384,5 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM qDebug("Using internal routines for move/copy"); QString tf = buildPath(targetFolder); - int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1()); + int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); if (r != MAIL_NO_ERROR) { qDebug("Error selecting source mailbox"); @@ -392,7 +390,7 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM } if (moveit) { - r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); + r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); } else { - r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1()); + r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); } if (r != MAIL_NO_ERROR) { diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h index c7c8183..208cf2f 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.h +++ b/noncore/net/mail/libmailwrapper/mhwrapper.h @@ -7,6 +7,4 @@ #include <qstring.h> -class RecMail; -class RecBody; class encodedString; struct mailmbox_folder; @@ -20,26 +18,26 @@ public: virtual ~MHwrapper(); - virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); - virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); + virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target ); + virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); - virtual void deleteMail(const RecMail&mail); - virtual void answeredMail(const RecMail&mail); - virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); - virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, + virtual void deleteMail(const RecMailP&mail); + virtual void answeredMail(const RecMailP&mail); + virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); + virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); - virtual int createMbox(const QString&folder,const Opie::osmart_pointer<Folder>&f=0, + virtual int createMbox(const QString&folder,const Opie::OSmartPointer<Folder>&f=0, const QString&d="",bool s=false); - virtual int deleteMbox(const Opie::osmart_pointer<Folder>&); + virtual int deleteMbox(const Opie::OSmartPointer<Folder>&); virtual void storeMessage(const char*msg,size_t length, const QString&folder); - virtual RecBody fetchBody( const RecMail &mail ); + virtual RecBody fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); - virtual encodedString* fetchRawBody(const RecMail&mail); - virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); - virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); + virtual encodedString* fetchRawBody(const RecMailP&mail); + virtual void deleteMails(const QString & FolderName,const QValueList<Opie::OSmartPointer<RecMail> > &target); + virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index 2ec052c..c0b3eec 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp @@ -33,5 +33,5 @@ void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { -RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { +RecBody NNTPwrapper::fetchBody( const RecMailP &mail ) { int err = NEWSNNTP_NO_ERROR; char *message = 0; @@ -45,6 +45,6 @@ RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { RecBody body; mailmessage * mailmsg; - if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { - qDebug("Message to large: %i",mail.Msgsize()); + if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { + qDebug("Message to large: %i",mail->Msgsize()); return body; } @@ -54,11 +54,11 @@ RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { cleanMimeCache(); - if (mail.getNumber()!=last_msg_id) { + if (mail->getNumber()!=last_msg_id) { if (msg_cache.exists()) { msg_cache.remove(); } msg_cache.open(IO_ReadWrite|IO_Truncate); - last_msg_id = mail.getNumber(); - err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); + last_msg_id = mail->getNumber(); + err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg); err = mailmessage_fetch(mailmsg,&message,&length); msg_cache.writeBlock(message,length); @@ -97,5 +97,5 @@ RecBody NNTPwrapper::fetchBody( const RecMail &mail ) { -void NNTPwrapper::listMessages(const QString & which, QList<RecMail> &target ) +void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::OSmartPointer<RecMail> > &target ) { login(); @@ -189,7 +189,7 @@ void NNTPwrapper::logout() } -QValueList<Opie::osmart_pointer<Folder> >* NNTPwrapper::listFolders() { +QValueList<Opie::OSmartPointer<Folder> >* NNTPwrapper::listFolders() { - QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); + QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >(); QStringList groups; if (account) { @@ -240,5 +240,5 @@ QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) { } -void NNTPwrapper::answeredMail(const RecMail&) {} +void NNTPwrapper::answeredMail(const RecMailP&) {} void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { @@ -254,10 +254,10 @@ void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) { -encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) { +encodedString* NNTPwrapper::fetchRawBody(const RecMailP&mail) { char*target=0; size_t length=0; encodedString*res = 0; mailmessage * mailmsg = 0; - int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg); + int err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg); err = mailmessage_fetch(mailmsg,&target,&length); if (mailmsg) @@ -277,5 +277,5 @@ const QString&NNTPwrapper::getName()const{ } -void NNTPwrapper::deleteMail(const RecMail&) { +void NNTPwrapper::deleteMail(const RecMailP&) { } diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index d3a384a..a7e4b95 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h @@ -21,16 +21,16 @@ public: /* mailbox will be ignored */ - virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); + virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target ); /* should only get the subscribed one */ - virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); + virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); /* mailbox will be ignored */ virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); QStringList listAllNewsgroups(const QString&mask = QString::null); - virtual void deleteMail(const RecMail&mail); - virtual void answeredMail(const RecMail&mail); - virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); + virtual void deleteMail(const RecMailP&mail); + virtual void answeredMail(const RecMailP&mail); + virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&); - virtual RecBody fetchBody( const RecMail &mail ); - virtual encodedString* fetchRawBody(const RecMail&mail); + virtual RecBody fetchBody( const RecMailP &mail ); + virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void logout(); virtual MAILLIB::ATYPE getType()const; diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 7bf7ed2..6737d6c 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp @@ -31,5 +31,5 @@ void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { } -RecBody POP3wrapper::fetchBody( const RecMail &mail ) { +RecBody POP3wrapper::fetchBody( const RecMailP &mail ) { int err = MAILPOP3_NO_ERROR; char *message = 0; @@ -43,6 +43,6 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) { RecBody body; mailmessage * mailmsg; - if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { - qDebug("Message to large: %i",mail.Msgsize()); + if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { + qDebug("Message to large: %i",mail->Msgsize()); return body; } @@ -52,11 +52,11 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) { cleanMimeCache(); - if (mail.getNumber()!=last_msg_id) { + if (mail->getNumber()!=last_msg_id) { if (msg_cache.exists()) { msg_cache.remove(); } msg_cache.open(IO_ReadWrite|IO_Truncate); - last_msg_id = mail.getNumber(); - err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); + last_msg_id = mail->getNumber(); + err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); err = mailmessage_fetch(mailmsg,&message,&length); msg_cache.writeBlock(message,length); @@ -94,5 +94,5 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) { } -void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) +void POP3wrapper::listMessages(const QString &, QValueList<Opie::OSmartPointer<RecMail> > &target ) { login(); @@ -170,5 +170,4 @@ void POP3wrapper::login() void POP3wrapper::logout() { - int err = MAILPOP3_NO_ERROR; if ( m_pop3 == NULL ) return; @@ -178,6 +177,6 @@ void POP3wrapper::logout() -QValueList<Opie::osmart_pointer<Folder> >* POP3wrapper::listFolders() { - QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<FolderP>(); +QValueList<Opie::OSmartPointer<Folder> >* POP3wrapper::listFolders() { + QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); FolderP inb=new Folder("INBOX","/"); folders->append(inb); @@ -185,9 +184,9 @@ QValueList<Opie::osmart_pointer<Folder> >* POP3wrapper::listFolders() { } -void POP3wrapper::deleteMail(const RecMail&mail) { +void POP3wrapper::deleteMail(const RecMailP&mail) { login(); if (!m_pop3) return; - int err = mailsession_remove_message(m_pop3->sto_session,mail.getNumber()); + int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); if (err != MAIL_NO_ERROR) { Global::statusMessage(tr("error deleting mail")); @@ -195,5 +194,5 @@ void POP3wrapper::deleteMail(const RecMail&mail) { } -void POP3wrapper::answeredMail(const RecMail&) {} +void POP3wrapper::answeredMail(const RecMailP&) {} int POP3wrapper::deleteAllMail(const FolderP&) { @@ -229,12 +228,15 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, &target_stat.message_recent,&target_stat.message_unseen); + if (r != MAIL_NO_ERROR) { + qDebug("error getting folter status."); + } } -encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) { +encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { char*target=0; size_t length=0; encodedString*res = 0; mailmessage * mailmsg = 0; - int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg); + int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); err = mailmessage_fetch(mailmsg,&target,&length); if (mailmsg) diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index e4afb94..31eb6f1 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h @@ -18,15 +18,15 @@ public: virtual ~POP3wrapper(); /* mailbox will be ignored */ - virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); - virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); + virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target ); + virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders(); /* mailbox will be ignored */ virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); - virtual void deleteMail(const RecMail&mail); - virtual void answeredMail(const RecMail&mail); - virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); + virtual void deleteMail(const RecMailP&mail); + virtual void answeredMail(const RecMailP&mail); + virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&); - virtual RecBody fetchBody( const RecMail &mail ); - virtual encodedString* fetchRawBody(const RecMail&mail); + virtual RecBody fetchBody( const RecMailP &mail ); + virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void logout(); virtual MAILLIB::ATYPE getType()const; diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index afc5618..86673aa 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -313,5 +313,5 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) } -void SMTPwrapper::sendMail(const Opie::osmart_pointer<Mail>&mail,bool later ) +void SMTPwrapper::sendMail(const Opie::OSmartPointer<Mail>&mail,bool later ) { mailmime * mimeMail; @@ -333,5 +333,5 @@ void SMTPwrapper::sendMail(const Opie::osmart_pointer<Mail>&mail,bool later ) } -int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,RecMail*which) { +int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { size_t curTok = 0; mailimf_fields *fields = 0; @@ -341,5 +341,5 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,RecMail*which) { int res = 0; - encodedString * data = wrap->fetchRawBody(*which); + encodedString * data = wrap->fetchRawBody(which); if (!data) return 0; @@ -392,6 +392,6 @@ bool SMTPwrapper::flushOutbox() { } QString oldPw, oldUser; - QList<RecMail> mailsToSend; - QList<RecMail> mailsToRemove; + QValueList<RecMailP> mailsToSend; + QValueList<RecMailP> mailsToRemove; QString mbox("Outgoing"); wrap->listMessages(mbox,mailsToSend); @@ -422,5 +422,4 @@ bool SMTPwrapper::flushOutbox() { - mailsToSend.setAutoDelete(false); sendProgress = new progressMailSend(); sendProgress->show(); @@ -428,5 +427,5 @@ bool SMTPwrapper::flushOutbox() { while (mailsToSend.count()>0) { - if (sendQueuedMail(wrap,mailsToSend.at(0))==0) { + if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { QMessageBox::critical(0,tr("Error sending mail"), tr("Error sending queued mail - breaking")); @@ -434,6 +433,6 @@ bool SMTPwrapper::flushOutbox() { break; } - mailsToRemove.append(mailsToSend.at(0)); - mailsToSend.removeFirst(); + mailsToRemove.append((*mailsToSend.begin())); + mailsToSend.remove(mailsToSend.begin()); sendProgress->setCurrentMails(mailsToRemove.count()); } @@ -451,5 +450,4 @@ bool SMTPwrapper::flushOutbox() { sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); - mailsToSend.setAutoDelete(true); delete wrap; return returnValue; diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index 08bde74..71ae35c 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h @@ -12,5 +12,5 @@ #include "generatemail.h" -#include <opie2/osmart_pointer.h> +#include <opie2/osmartpointer.h> class SMTPaccount; @@ -24,5 +24,5 @@ public: SMTPwrapper(SMTPaccount * aSmtp); virtual ~SMTPwrapper(); - void sendMail(const Opie::osmart_pointer<Mail>& mail,bool later=false ); + void sendMail(const Opie::OSmartPointer<Mail>& mail,bool later=false ); bool flushOutbox(); @@ -51,5 +51,5 @@ protected: void storeMail(mailmime*mail, const QString&box); - int sendQueuedMail(AbstractMail*wrap,RecMail*which); + int sendQueuedMail(AbstractMail*wrap,const Opie::OSmartPointer<RecMail>&which); void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp index 052e0f1..595e7fc 100644 --- a/noncore/net/mail/libmailwrapper/storemail.cpp +++ b/noncore/net/mail/libmailwrapper/storemail.cpp @@ -50,5 +50,5 @@ Storemail::~Storemail() } -int Storemail::storeMail(const Opie::osmart_pointer<Mail>&mail) +int Storemail::storeMail(const Opie::OSmartPointer<Mail>&mail) { if (!wrapper) return 0; diff --git a/noncore/net/mail/libmailwrapper/storemail.h b/noncore/net/mail/libmailwrapper/storemail.h index 7d8ea3d..80c7431 100644 --- a/noncore/net/mail/libmailwrapper/storemail.h +++ b/noncore/net/mail/libmailwrapper/storemail.h @@ -19,5 +19,5 @@ public: virtual ~Storemail(); - int storeMail(const Opie::osmart_pointer<Mail>&mail); + int storeMail(const Opie::OSmartPointer<Mail>&mail); protected: diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp index 75633ef..0b926da 100644 --- a/noncore/net/mail/mailistviewitem.cpp +++ b/noncore/net/mail/mailistviewitem.cpp @@ -11,7 +11,7 @@ MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) void MailListViewItem::showEntry() { - if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) { + if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); - } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { + } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { /* I think it looks nicer if there are not such a log of icons but only on mails replied or new - Alwin*/ @@ -20,5 +20,5 @@ void MailListViewItem::showEntry() setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); } - double s = mail_data.Msgsize(); + double s = mail_data->Msgsize(); int w; w=0; @@ -50,16 +50,16 @@ void MailListViewItem::showEntry() } - setText(1,mail_data.getSubject()); - setText(2,mail_data.getFrom()); + setText(1,mail_data->getSubject()); + setText(2,mail_data->getFrom()); setText(3,fsize); - setText(4,mail_data.getDate()); + setText(4,mail_data->getDate()); } -void MailListViewItem::storeData(const RecMail&data) +void MailListViewItem::storeData(const RecMailP&data) { mail_data = data; } -const RecMail& MailListViewItem::data()const +const RecMailP& MailListViewItem::data()const { return mail_data; @@ -68,5 +68,5 @@ const RecMail& MailListViewItem::data()const MAILLIB::ATYPE MailListViewItem::wrapperType() { - if (!mail_data.Wrapper()) return MAILLIB::A_UNDEFINED; - return mail_data.Wrapper()->getType(); + if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; + return mail_data->Wrapper()->getType(); } diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h index f736de0..d953d83 100644 --- a/noncore/net/mail/mailistviewitem.h +++ b/noncore/net/mail/mailistviewitem.h @@ -12,11 +12,11 @@ public: virtual ~MailListViewItem(){} - void storeData(const RecMail&data); - const RecMail&data()const; + void storeData(const RecMailP&data); + const RecMailP&data()const; void showEntry(); MAILLIB::ATYPE wrapperType(); protected: - RecMail mail_data; + RecMailP mail_data; }; diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index bcf0866..c23ad3f 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -120,5 +120,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); - connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); + connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), + this,SLOT(refreshMailView(const QValueList<RecMailP>&))); connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); @@ -178,5 +179,5 @@ void MainWindow::slotShowFolders( bool ) } -void MainWindow::refreshMailView(QList<RecMail>*) +void MainWindow::refreshMailView(const QValueList<RecMailP>&) { qDebug( "refreshMailView not reached" ); diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index 1ba6299..8d004c6 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h @@ -12,4 +12,7 @@ #include "statuswidget.h" +#include <libmailwrapper/mailtypes.h> +#include <opie2/osmartpointer.h> + class RecMail; @@ -31,5 +34,5 @@ protected slots: virtual void slotEditAccounts(); virtual void slotShowFolders( bool show ); - virtual void refreshMailView(QList<RecMail>*); + virtual void refreshMailView(const QValueList<RecMailP>&); virtual void displayMail(); virtual void slotDeleteMail(); diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index d95b3c9..dd305df 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -146,5 +146,5 @@ void OpieMail::displayMail() QListViewItem*item = mailView->currentItem(); if (!item) return; - RecMail mail = ((MailListViewItem*)item)->data(); + RecMailP mail = ((MailListViewItem*)item)->data(); RecBody body = folderView->fetchBody(mail); ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); @@ -167,8 +167,8 @@ void OpieMail::slotDeleteMail() { if (!mailView->currentItem()) return; - RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); - if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) + RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); + if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { - mail.Wrapper()->deleteMail( mail ); + mail->Wrapper()->deleteMail( mail ); folderView->refreshCurrent(); } @@ -218,12 +218,14 @@ void OpieMail::slotShowFolders( bool show ) } -void OpieMail::refreshMailView(QList<RecMail>*list) +void OpieMail::refreshMailView(const QValueList<RecMailP>&list) { MailListViewItem*item = 0; mailView->clear(); - for (unsigned int i = 0; i < list->count();++i) + + QValueList<RecMailP>::ConstIterator it; + for (it = list.begin(); it != list.end();++it) { item = new MailListViewItem(mailView,item); - item->storeData(*(list->at(i))); + item->storeData((*it)); item->showEntry(); } @@ -245,5 +247,5 @@ void OpieMail::slotMoveCopyMail() { if (!mailView->currentItem()) return; - RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); + RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); AbstractMail*targetMail = 0; QString targetFolder = ""; @@ -253,5 +255,5 @@ void OpieMail::slotMoveCopyMail() targetMail = sels.currentMail(); targetFolder = sels.currentFolder(); - if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || + if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || targetFolder.isEmpty()) { @@ -264,5 +266,5 @@ void OpieMail::slotMoveCopyMail() return; } - mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); + mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); folderView->refreshCurrent(); } diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index 88c7ea1..b93bd60 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h @@ -5,4 +5,6 @@ #include <libmailwrapper/settings.h> +#include <opie2/osmartpointer.h> +#include <libmailwrapper/mailtypes.h> class OpieMail : public MainWindow @@ -28,5 +30,5 @@ protected slots: virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotShowFolders( bool show ); - virtual void refreshMailView(QList<RecMail>*); + virtual void refreshMailView(const QValueList<RecMailP>&); virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); virtual void slotMoveCopyMail(); diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 78652d7..894a386 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -226,5 +226,5 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int if( !str.isEmpty() ) { - 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) { @@ -246,7 +246,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int else { - if ( m_recMail.Wrapper() != 0l ) + if ( m_recMail->Wrapper() != 0l ) { // 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() ] ) ); } } @@ -257,17 +257,17 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int -void ViewMail::setMail( RecMail mail ) +void ViewMail::setMail( RecMailP mail ) { m_recMail = mail; - m_mail[0] = mail.getFrom(); - m_mail[1] = mail.getSubject(); - m_mail[3] = mail.getDate(); - m_mail[4] = mail.Msgid(); + m_mail[0] = mail->getFrom(); + m_mail[1] = mail->getSubject(); + m_mail[3] = mail->getDate(); + m_mail[4] = mail->Msgid(); - m_mail2[0] = mail.To(); - m_mail2[1] = mail.CC(); - m_mail2[2] = mail.Bcc(); + m_mail2[0] = mail->To(); + m_mail2[1] = mail->CC(); + m_mail2[2] = mail->Bcc(); setText(); @@ -349,5 +349,5 @@ void ViewMail::setText() ViewMail::~ViewMail() { - m_recMail.Wrapper()->cleanMimeCache(); + m_recMail->Wrapper()->cleanMimeCache(); hide(); } @@ -416,16 +416,16 @@ void ViewMail::slotReply() Settings *settings = new Settings(); ComposeMail composer( settings ,this, 0, true); - if (m_recMail.Replyto().isEmpty()) { - composer.setTo( m_recMail.getFrom()); + if (m_recMail->Replyto().isEmpty()) { + composer.setTo( m_recMail->getFrom()); } else { - composer.setTo( m_recMail.Replyto()); + composer.setTo( m_recMail->Replyto()); } composer.setSubject( prefix + m_mail[1] ); composer.setMessage( rtext ); - composer.setInReplyTo(m_recMail.Msgid()); + composer.setInReplyTo(m_recMail->Msgid()); if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) { - m_recMail.Wrapper()->answeredMail(m_recMail); + m_recMail->Wrapper()->answeredMail(m_recMail); } } @@ -470,5 +470,5 @@ void ViewMail::slotDeleteMail( ) if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { - m_recMail.Wrapper()->deleteMail( m_recMail ); + m_recMail->Wrapper()->deleteMail( m_recMail ); hide(); deleted = true; diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index abbd5b3..6875e3c 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h @@ -37,5 +37,5 @@ public: void hide(); void exec(); - void setMail( RecMail mail ); + void setMail( RecMailP mail ); void setBody( RecBody body ); bool deleted; @@ -61,5 +61,5 @@ private: bool m_gotBody; RecBody m_body; - RecMail m_recMail; + RecMailP m_recMail; bool m_showHtml; |