author | alwin <alwin> | 2004-03-12 14:12:00 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-12 14:12:00 (UTC) |
commit | d1929ef43f0eaaa17aa42196384d1ed925132873 (patch) (side-by-side diff) | |
tree | eff911f93fe7919d7820e5a2e68b72f2f76143da /noncore | |
parent | d38384a6edb0110117e0297864f813b379d52789 (diff) | |
download | opie-d1929ef43f0eaaa17aa42196384d1ed925132873.zip opie-d1929ef43f0eaaa17aa42196384d1ed925132873.tar.gz opie-d1929ef43f0eaaa17aa42196384d1ed925132873.tar.bz2 |
some pointers embedded into osmart_pointer handling
21 files changed, 190 insertions, 172 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 396dcb7..3e12563 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp @@ -56,25 +56,23 @@ void POP3viewItem::refresh( QList<RecMail> & ) void POP3viewItem::refresh() { if (account->getOffline()) return; - QList<Folder> *folders = wrapper->listFolders(); + QValueList<FolderP> *folders = wrapper->listFolders(); QListViewItem *child = firstChild(); while ( child ) { QListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } - Folder *it; + QValueList<FolderP>::ConstIterator it; QListViewItem*item = 0; - for ( it = folders->first(); it; it = folders->next() ) + for ( it = folders->begin(); it!=folders->end(); ++it) { - item = new POP3folderItem( it, this , item ); - item->setSelectable(it->may_select()); + item = new POP3folderItem( (*it), this , item ); + item->setSelectable( (*it)->may_select()); } - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - folders->setAutoDelete(false); delete folders; } RecBody POP3viewItem::fetchBody( const RecMail &mail ) @@ -140,12 +138,11 @@ void POP3viewItem::contextMenuSelected(int which) POP3folderItem::~POP3folderItem() {} -POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) - : AccountViewItem( parent,after ) +POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) + : AccountViewItem(folderInit,parent,after ) { - folder = folderInit; pop3 = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_POP3FOLDER ); @@ -249,25 +246,24 @@ void NNTPviewItem::refresh( QList<RecMail> & ) void NNTPviewItem::refresh() { if (account->getOffline()) return; - QList<Folder> *folders = wrapper->listFolders(); + QValueList<FolderP> *folders = wrapper->listFolders(); + QListViewItem *child = firstChild(); while ( child ) { QListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } - Folder *it; + QValueList<FolderP>::ConstIterator it; QListViewItem*item = 0; - for ( it = folders->first(); it; it = folders->next() ) + for ( it = folders->begin(); it!=folders->end(); ++it) { - item = new NNTPfolderItem( it, this , item ); - item->setSelectable(it->may_select()); + item = new NNTPfolderItem( (*it), this , item ); + item->setSelectable( (*it)->may_select()); } - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - folders->setAutoDelete(false); delete folders; } RecBody NNTPviewItem::fetchBody( const RecMail &mail ) @@ -346,12 +342,11 @@ void NNTPviewItem::contextMenuSelected(int which) NNTPfolderItem::~NNTPfolderItem() {} -NNTPfolderItem::NNTPfolderItem( Folder *folderInit, NNTPviewItem *parent , QListViewItem*after ) - : AccountViewItem( parent,after ) +NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) + : AccountViewItem( folderInit, parent,after ) { - folder = folderInit; nntp = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_POP3FOLDER ); @@ -449,49 +444,47 @@ void IMAPviewItem::refreshFolders(bool force) if (account->getOffline()) return; removeChilds(); currentFolders.clear(); - QList<Folder> *folders = wrapper->listFolders(); + QValueList<FolderP> * folders = wrapper->listFolders(); - Folder *it; + QValueList<FolderP>::Iterator it; QListViewItem*item = 0; QListViewItem*titem = 0; QString fname,del,search; int pos; - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - folders->setAutoDelete(false); - for ( it = folders->first(); it; it = folders->next() ) + for ( it = folders->begin(); it!=folders->end(); ++it) { - if (it->getDisplayName().lower()=="inbox") + if ((*it)->getDisplayName().lower()=="inbox") { - item = new IMAPfolderItem( it, this , item ); + item = new IMAPfolderItem( (*it), this , item ); folders->remove(it); qDebug("inbox found"); break; } } - for ( it = folders->first(); it; it = folders->next() ) + for ( it = folders->begin(); it!=folders->end(); ++it) { - fname = it->getDisplayName(); - currentFolders.append(it->getName()); - pos = fname.findRev(it->Separator()); + fname = (*it)->getDisplayName(); + currentFolders.append((*it)->getName()); + pos = fname.findRev((*it)->Separator()); if (pos != -1) { fname = fname.left(pos); } IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); if (pitem) { titem = item; - item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); + item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); /* setup the short name */ - item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); + item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); item = titem; } else { - item = new IMAPfolderItem( it, this , item ); + item = new IMAPfolderItem( (*it), this , item ); } } delete folders; } @@ -577,12 +570,11 @@ bool IMAPviewItem::offline() { return account->getOffline(); } -IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) - : AccountViewItem( parent , after ) +IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) + : AccountViewItem( folderInit, parent , after ) { - folder = folderInit; imap = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_IMAPFOLDER ); @@ -593,12 +585,11 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList } setText( 0, folder->getDisplayName() ); } -IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) - : AccountViewItem( parent,after ) +IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) + : AccountViewItem(folderInit, parent,after ) { - folder = folderInit; imap = master; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_IMAPFOLDER ); @@ -767,22 +758,22 @@ void MHviewItem::refresh(bool force) { if (childCount()>0 && force==false) return; removeChilds(); currentFolders.clear(); - QList<Folder> *folders = wrapper->listFolders(); - Folder *it; + QValueList<FolderP> *folders = wrapper->listFolders(); + QValueList<FolderP>::ConstIterator it; MHfolderItem*item = 0; MHfolderItem*pmaster = 0; QString fname = ""; int pos; - for ( it = folders->first(); it; it = folders->next() ) + for ( it = folders->begin(); it!=folders->end(); ++it) { - fname = it->getDisplayName(); + fname = (*it)->getDisplayName(); /* this folder itself */ if (fname=="/") { currentFolders.append(fname); - folder = it; + folder = (*it); continue; } currentFolders.append(fname); pos = fname.findRev("/"); @@ -796,18 +787,16 @@ void MHviewItem::refresh(bool force) pmaster = 0; } if (pmaster) { - item = new MHfolderItem( it, pmaster, item, this ); + item = new MHfolderItem( (*it), pmaster, item, this ); } else { - item = new MHfolderItem( it, this , item ); + item = new MHfolderItem( (*it), this , item ); } - item->setSelectable(it->may_select()); + item->setSelectable((*it)->may_select()); } - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - folders->setAutoDelete(false); delete folders; } RecBody MHviewItem::fetchBody( const RecMail &mail ) @@ -877,18 +866,17 @@ void MHviewItem::contextMenuSelected(int which) MHfolderItem::~MHfolderItem() {} -MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) - : AccountViewItem( parent,after ) +MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) + : AccountViewItem(folderInit, parent,after ) { - folder = folderInit; mbox = parent; initName(); } -MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) - : AccountViewItem( parent,after ) +MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) + : AccountViewItem(folderInit, parent,after ) { folder = folderInit; mbox = master; initName(); @@ -920,9 +908,9 @@ void MHfolderItem::initName() } setText( 0, bName ); } -Folder*MHfolderItem::getFolder() +const FolderP&MHfolderItem::getFolder()const { return folder; } @@ -1042,36 +1030,41 @@ AccountViewItem::AccountViewItem( AccountView *parent ) m_Backlink = parent; } AccountViewItem::AccountViewItem( QListViewItem *parent) - : QListViewItem( parent) + : QListViewItem( parent),folder(0) { init(); } AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) - :QListViewItem( parent,after ) + :QListViewItem( parent,after ),folder(0) +{ + init(); +} + +AccountViewItem::AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) + :QListViewItem( parent,after ),folder(folderInit) { init(); } void AccountViewItem::init() { m_Backlink = 0; - folder = 0; } AccountViewItem::~AccountViewItem() { - if (folder) delete folder; + folder = 0; } AccountView*AccountViewItem::accountView() { return m_Backlink; } -void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) +void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) { if (!wrapper) return; QString fname=""; if (folder) fname = folder->getDisplayName(); diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index eb3baa3..8f712f5 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h @@ -2,8 +2,9 @@ #define __ACCOUNT_ITEM #include <qlistview.h> #include <qlist.h> +#include <opie2/osmart_pointer.h> class POP3wrapper; class RecMail; class RecBody; @@ -17,13 +18,15 @@ class AbstractMail; class Folder; class AccountViewItem : public QListViewItem { - + public: AccountViewItem( AccountView *parent ); AccountViewItem( QListViewItem *parent); AccountViewItem( QListViewItem *parent , QListViewItem*after ); + AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); + virtual ~AccountViewItem(); virtual void refresh(QList<RecMail>&)=0; virtual RecBody fetchBody(const RecMail&)=0; virtual QPopupMenu * getContextMenu(){return 0;}; @@ -35,12 +38,12 @@ public: protected: AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); virtual void init(); virtual void removeChilds(); - virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); + virtual void deleteAllMail(AbstractMail*wrapper,const Opie::osmart_pointer<Folder>&f); static const QString contextName; AccountView*m_Backlink; - Folder *folder; + Opie::osmart_pointer<Folder> folder; }; class POP3viewItem : public AccountViewItem { @@ -65,9 +68,9 @@ protected: class POP3folderItem : public AccountViewItem { public: - POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); + POP3folderItem( const Opie::osmart_pointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); virtual ~POP3folderItem(); virtual void refresh(QList<RecMail>&); virtual RecBody fetchBody(const RecMail&); virtual QPopupMenu * getContextMenu(); @@ -103,9 +106,9 @@ protected: class NNTPfolderItem : public AccountViewItem { public: - NNTPfolderItem( Folder *folder, NNTPviewItem *parent , QListViewItem*after ); + NNTPfolderItem(const Opie::osmart_pointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); virtual ~NNTPfolderItem(); virtual void refresh(QList<RecMail>&); virtual RecBody fetchBody(const RecMail&); virtual QPopupMenu * getContextMenu(); @@ -143,10 +146,10 @@ protected: class IMAPfolderItem : public AccountViewItem { public: - IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); - IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); + IMAPfolderItem( const Opie::osmart_pointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); + IMAPfolderItem( const Opie::osmart_pointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); virtual ~IMAPfolderItem(); virtual void refresh(QList<RecMail>&); virtual RecBody fetchBody(const RecMail&); virtual QPopupMenu * getContextMenu(); @@ -185,16 +188,16 @@ protected: class MHfolderItem : public AccountViewItem { public: - MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); - MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); + MHfolderItem( const Opie::osmart_pointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); + MHfolderItem( const Opie::osmart_pointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); virtual ~MHfolderItem(); virtual void refresh(QList<RecMail>&); virtual RecBody fetchBody(const RecMail&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); - virtual Folder*getFolder(); + virtual const Opie::osmart_pointer<Folder>&getFolder()const; virtual bool isDraftfolder(); protected: void downloadMails(); diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 7938d4f..297f553 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -142,9 +142,9 @@ void AccountView::setupFolderselect(Selectstore*sels) sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); } } -void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) +void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) { AbstractMail*targetMail = 0; QString targetFolder = ""; Selectstore sels; diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 5000202..3478c0b 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h @@ -2,8 +2,9 @@ #define ACCOUNTVIEW_H #include <qlistview.h> #include <qlist.h> +#include <opie2/osmart_pointer.h> class Selectstore; class RecMail; class RecBody; @@ -21,9 +22,9 @@ public: AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); virtual ~AccountView(); virtual void populate( QList<Account> list ); virtual RecBody fetchBody(const RecMail&aMail); - virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); + virtual void downloadMails(const Opie::osmart_pointer<Folder>&fromFolder,AbstractMail*fromWrapper); virtual bool currentisDraft(); public slots: virtual void refreshAll(); @@ -33,11 +34,11 @@ public slots: virtual void slotContextMenu(int id); void setupFolderselect(Selectstore*sels); signals: - void refreshMailview(QList<RecMail>*); + void refreshMailview(QList<RecMail>*); -protected: +protected: QListViewItem* m_currentItem; QValueList<IMAPviewItem*> imapAccounts; QValueList<MHviewItem*> mhAccounts; }; diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index ac6f380..7e6d383 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp @@ -110,9 +110,9 @@ QString AbstractMail::gen_attachment_id() return "{" + stream.read().stripWhiteSpace() + "}"; } -int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) +int AbstractMail::createMbox(const QString&,const FolderP&,const QString& delemiter,bool) { return 0; } @@ -132,9 +132,10 @@ QString AbstractMail::draftFolder() void AbstractMail::deleteMails(const QString &,QList<RecMail> &) { } -void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) +void AbstractMail::mvcpAllMails(const FolderP&fromFolder, + const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { QList<RecMail> t; listMessages(fromFolder->getName(),t); encodedString*st = 0; diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index d377452..d911468 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h @@ -2,11 +2,13 @@ #define __abstract_mail_ #include "maildefines.h" -#include <qobject.h> #include "settings.h" +#include <qobject.h> +#include <opie2/osmart_pointer.h> + class RecMail; class RecBody; class RecPart; class IMAPwrapper; @@ -20,9 +22,9 @@ class AbstractMail:public QObject Q_OBJECT public: AbstractMail(){}; virtual ~AbstractMail(){} - virtual QList<Folder>* listFolders()=0; + virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders()=0; virtual void listMessages(const QString & mailbox,QList<RecMail>&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; @@ -31,23 +33,25 @@ public: virtual encodedString* fetchRawBody(const RecMail&mail)=0; virtual void deleteMail(const RecMail&mail)=0; virtual void answeredMail(const RecMail&mail)=0; - virtual int deleteAllMail(const Folder*)=0; + virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&)=0; virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); - virtual int deleteMbox(const Folder*)=0; + virtual int deleteMbox(const Opie::osmart_pointer<Folder>&)=0; virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; - virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); + virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, + const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void cleanMimeCache(){}; /* mail box methods */ /* parameter is the box to create. * if the implementing subclass has prefixes, * them has to be appended automatic. */ - virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); + virtual int createMbox(const QString&,const Opie::osmart_pointer<Folder>&parentfolder=0, + const QString& delemiter="/",bool getsubfolder=false); virtual void logout()=0; static AbstractMail* getWrapper(IMAPaccount *a); static AbstractMail* getWrapper(POP3account *a); diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index b3cd4fe..d0db45a 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h @@ -37,9 +37,9 @@ public: 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 void cleanMimeCache(); - virtual int deleteMbox(const Folder*){return 1;} + virtual int deleteMbox(const Opie::osmart_pointer<Folder>&){return 1;} virtual void logout(){}; virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; protected: diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index e29a0a0..3b3be0f 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp @@ -265,19 +265,18 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) } if (result) mailimap_fetch_list_free(result); } -QList<Folder>* IMAPwrapper::listFolders() +QValueList<Opie::osmart_pointer<Folder> >* IMAPwrapper::listFolders() { const char *path, *mask; int err = MAILIMAP_NO_ERROR; clist *result = 0; clistcell *current = 0; clistcell*cur_flag = 0; mailimap_mbx_list_flags*bflags = 0; - QList<Folder> * folders = new QList<Folder>(); - folders->setAutoDelete( false ); + QValueList<FolderP>* folders = new QValueList<FolderP>(); login(); if (!m_imap) { return folders; } @@ -965,9 +964,9 @@ encodedString* IMAPwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) { return fetchRawPart(mail,part.Positionlist(),false); } -int IMAPwrapper::deleteAllMail(const Folder*folder) +int IMAPwrapper::deleteAllMail(const FolderP&folder) { login(); if (!m_imap) { return 0; @@ -1006,9 +1005,9 @@ int IMAPwrapper::deleteAllMail(const Folder*folder) qDebug("Delete successfull %s",m_imap->imap_response); return 1; } -int IMAPwrapper::createMbox(const QString&folder,const Folder*parentfolder,const QString& delemiter,bool getsubfolder) +int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) { if (folder.length()==0) return 0; login(); if (!m_imap) {return 0;} @@ -1036,9 +1035,9 @@ int IMAPwrapper::createMbox(const QString&folder,const Folder*parentfolder,const } return 1; } -int IMAPwrapper::deleteMbox(const Folder*folder) +int IMAPwrapper::deleteMbox(const FolderP&folder) { if (!folder) return 0; login(); if (!m_imap) {return 0;} @@ -1122,9 +1121,10 @@ encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) QValueList<int> path; return fetchRawPart(mail,path,false); } -void IMAPwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) +void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, + const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { if (targetWrapper != this) { AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); qDebug("Using generic"); diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 2623725..15f049f 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h @@ -22,30 +22,32 @@ class IMAPwrapper : public AbstractMail Q_OBJECT public: IMAPwrapper( IMAPaccount *a ); virtual ~IMAPwrapper(); - virtual QList<Folder>* listFolders(); + virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); virtual void listMessages(const QString & mailbox,QList<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 Folder*folder); + virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&folder); virtual void storeMessage(const char*msg,size_t length, const QString&folder); - virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); + virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, + const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void mvcpMail(const RecMail&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 int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); - virtual int deleteMbox(const Folder*folder); - + virtual int createMbox(const QString&,const Opie::osmart_pointer<Folder>&parentfolder=0, + const QString& delemiter="/",bool getsubfolder=false); + virtual int deleteMbox(const Opie::osmart_pointer<Folder>&folder); + static void imap_progress( size_t current, size_t maximum ); - + virtual void logout(); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; @@ -63,9 +65,9 @@ protected: 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 RecMail&mail,mailimap_body*body,RecBody&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 QStringList address_list_to_stringlist(clist*list); diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index 17c6db9..10d367f 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h @@ -7,9 +7,8 @@ #define FLAG_SEEN 3 #define FLAG_DRAFT 4 #define FLAG_RECENT 5 -#include <qlist.h> #include <qbitarray.h> #include <qstring.h> #include <qstringlist.h> #include <qmap.h> diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index 6bd98f6..c71d69f 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp @@ -34,8 +34,12 @@ Folder::Folder(const QString&tmp_name, const QString&sep ) separator = sep; prefix = ""; } +Folder::~Folder() +{ +} + const QString& Folder::Separator()const { return separator; } @@ -56,8 +60,12 @@ IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no } } } +IMAPFolder::~IMAPFolder() +{ +} + static unsigned char base64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; /** @@ -163,4 +171,8 @@ MHFolder::MHFolder(const QString&disp_name,const QString&mbox) nameDisplay = separator; } prefix = mbox; } + +MHFolder::~MHFolder() +{ +} diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h index c66572c..3b3bb32 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.h +++ b/noncore/net/mail/libmailwrapper/mailwrapper.h @@ -12,17 +12,17 @@ class Attachment { public: - Attachment( DocLnk lnk ); + Attachment( DocLnk lnk ); virtual ~Attachment(){} const QString getFileName()const{ return doc.file(); } const QString getName()const{ return doc.name(); } const QString getMimeType()const{ return doc.type(); } const QPixmap getPixmap()const{ return doc.pixmap(); } const int getSize()const { return size; } DocLnk getDocLnk() { return doc; } - + protected: DocLnk doc; int size; @@ -39,9 +39,9 @@ public: */ virtual ~Mail(){} void addAttachment( Attachment *att ) { attList.append( att ); } const QList<Attachment>& getAttachments()const { return attList; } - void removeAttachment( Attachment *att ) { attList.remove( att ); } + void removeAttachment( Attachment *att ) { attList.remove( att ); } const QString&getName()const { return name; } void setName( QString s ) { name = s; } const QString&getMail()const{ return mail; } void setMail( const QString&s ) { mail = s; } @@ -65,14 +65,13 @@ private: QString name, mail, to, cc, bcc, reply, subject, message; QStringList m_in_reply_to; }; -class Folder : public QObject +class Folder:public Opie::oref_count { - Q_OBJECT - public: Folder( const QString&init_name,const QString&sep ); + virtual ~Folder(); const QString&getDisplayName()const { return nameDisplay; } const QString&getName()const { return name; } const QString&getPrefix()const{return prefix; } virtual bool may_select()const{return true;} @@ -82,19 +81,22 @@ public: protected: QString nameDisplay, name, separator,prefix; }; +typedef Opie::osmart_pointer<Folder> FolderP; + class MHFolder : public Folder { - Q_OBJECT public: MHFolder(const QString&disp_name,const QString&mbox); + virtual ~MHFolder(); }; class IMAPFolder : public Folder { public: IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); + virtual ~IMAPFolder(); virtual bool may_select()const{return m_MaySelect;} virtual bool no_inferior()const{return m_NoInferior;} private: static QString decodeFolderName( const QString &name ); diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index abe4bb6..9ff3de2 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp @@ -13,9 +13,9 @@ MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) if (!dir.exists()) { dir.mkdir(MBOXPath); } } - + MBOXwrapper::~MBOXwrapper() { } @@ -23,39 +23,38 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) { mailstorage*storage = mailstorage_new(NULL); QString p = MBOXPath+"/"; p+=mailbox; - + int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); mailfolder*folder; - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { qDebug("Error initializing mbox"); mailfolder_free(folder); mailstorage_free(storage); return; } - + parseList(target,folder->fld_session,mailbox); - + mailfolder_disconnect(folder); mailfolder_free(folder); mailstorage_free(storage); Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); } -QList<Folder>* MBOXwrapper::listFolders() +QValueList<Opie::osmart_pointer<Folder> >* MBOXwrapper::listFolders() { - QList<Folder> * folders = new QList<Folder>(); - folders->setAutoDelete( false ); + QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); QDir dir(MBOXPath); if (!dir.exists()) return folders; dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable); QStringList entries = dir.entryList(); QStringList::ConstIterator it = entries.begin(); for (;it!=entries.end();++it) { - Folder*inb=new Folder(*it,"/"); + FolderP inb=new Folder(*it,"/"); folders->append(inb); } return folders; } @@ -66,9 +65,9 @@ void MBOXwrapper::deleteMail(const RecMail&mail) QString p = MBOXPath+"/"; p+=mail.getMbox(); int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); mailfolder*folder; - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { qDebug("Error initializing mbox"); mailfolder_free(folder); @@ -98,9 +97,9 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) size_t size; int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); mailfolder*folder; - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { qDebug("Error initializing mbox"); mailfolder_free(folder); @@ -121,22 +120,22 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) mailstorage_free(storage); mailmessage_free(msg); return body; } - body = parseMail(msg); + body = parseMail(msg); mailmessage_fetch_result_free(msg,data); mailfolder_free(folder); mailstorage_free(storage); - + return body; } void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) { qDebug("MBOX %i von %i",current,maximum); } -int MBOXwrapper::createMbox(const QString&folder,const Folder*,const QString&,bool ) +int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) { QString p = MBOXPath+"/"; p+=folder; QFileInfo fi(p); @@ -181,9 +180,9 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail) size_t size; int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); mailfolder*folder; - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error initializing mbox")); mailfolder_free(folder); @@ -242,14 +241,14 @@ void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target) qDebug("error expunge mailbox"); } } -int MBOXwrapper::deleteAllMail(const Folder*tfolder) +int MBOXwrapper::deleteAllMail(const FolderP&tfolder) { if (!tfolder) return 0; QString p = MBOXPath+"/"+tfolder->getDisplayName(); int res = 1; - + mailfolder*folder = 0; mailmessage_list*l=0; mailstorage*storage = mailstorage_new(NULL); int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); @@ -257,9 +256,9 @@ int MBOXwrapper::deleteAllMail(const Folder*tfolder) Global::statusMessage(tr("Error initializing mbox")); res = 0; } if (res) { - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); if (r != MAIL_NO_ERROR) { Global::statusMessage(tr("Error initializing mbox")); res = 0; @@ -285,9 +284,9 @@ int MBOXwrapper::deleteAllMail(const Folder*tfolder) if (storage) mailstorage_free(storage); return res; } -int MBOXwrapper::deleteMbox(const Folder*tfolder) +int MBOXwrapper::deleteMbox(const FolderP&tfolder) { if (!tfolder) return 0; QString p = MBOXPath+"/"+tfolder->getDisplayName(); QFile fi(p); @@ -315,9 +314,9 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) Global::statusMessage(tr("Mailbox doesn't exist.")); return; } int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); r = mailsession_status_folder(folder->fld_session,(char*)mailbox.latin1(),&target_stat.message_count, &target_stat.message_recent,&target_stat.message_unseen); if (folder) mailfolder_free(folder); diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h index 7e7f359..c3d9b50 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.h +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h @@ -15,27 +15,28 @@ class MBOXwrapper : public Genericwrapper public: MBOXwrapper(const QString & dir,const QString&name); virtual ~MBOXwrapper(); - + virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); - virtual QList<Folder>* listFolders(); + virtual QValueList<Opie::osmart_pointer<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 int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); - virtual int deleteMbox(const Folder*); + + virtual int createMbox(const QString&folder,const Opie::osmart_pointer<Folder>&f=0, + const QString&d="",bool s=false); + virtual int deleteMbox(const Opie::osmart_pointer<Folder>&); virtual void storeMessage(const char*msg,size_t length, const QString&folder); virtual RecBody fetchBody( const RecMail &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 Folder*); + virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; protected: diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 560eab0..aaaa20a 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp @@ -75,12 +75,11 @@ void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) parseList(target,m_storage->sto_session,f); Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); } -QList<Folder>* MHwrapper::listFolders() +QValueList<Opie::osmart_pointer<Folder> >* MHwrapper::listFolders() { - QList<Folder> * folders = new QList<Folder>(); - folders->setAutoDelete( false ); + QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); /* this is needed! */ if (m_storage) mailstorage_disconnect(m_storage); init_storage(); if (!m_storage) { @@ -143,9 +142,9 @@ RecBody MHwrapper::fetchBody( const RecMail &mail ) if (r != MAIL_NO_ERROR) { qDebug("Error fetching mail %i",mail.getNumber()); return body; } - body = parseMail(msg); + body = parseMail(msg); mailmessage_fetch_result_free(msg,data); return body; } @@ -168,9 +167,9 @@ QString MHwrapper::buildPath(const QString&p) f+=p; return f; } -int MHwrapper::createMbox(const QString&folder,const Folder*pfolder,const QString&,bool ) +int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) { init_storage(); if (!m_storage) { return 0; @@ -262,9 +261,9 @@ void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) } } } -int MHwrapper::deleteAllMail(const Folder*tfolder) +int MHwrapper::deleteAllMail(const FolderP&tfolder) { init_storage(); if (!m_storage) { return 0; @@ -297,19 +296,19 @@ int MHwrapper::deleteAllMail(const Folder*tfolder) if (l) mailmessage_list_free(l); return res; } -int MHwrapper::deleteMbox(const Folder*tfolder) +int MHwrapper::deleteMbox(const FolderP&tfolder) { init_storage(); if (!m_storage) { return 0; } if (!tfolder) return 0; if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; - + int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); - + if (r != MAIL_NO_ERROR) { qDebug("error deleting mail box"); return 0; } @@ -318,9 +317,9 @@ int MHwrapper::deleteMbox(const Folder*tfolder) command << "/bin/sh"; command << "-c"; command << cmd.latin1(); OProcess *process = new OProcess(); - + connect(process, SIGNAL(processExited(OProcess*)), this, SLOT( processEnded(OProcess*))); connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)), this, SLOT( oprocessStderr(OProcess*,char*,int))); @@ -385,9 +384,9 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM return; } 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"); return; } @@ -400,9 +399,10 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM qDebug("Error copy/moving mail internal (%i)",r); } } -void MHwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) +void MHwrapper::mvcpAllMails(const FolderP&fromFolder, + const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) { init_storage(); if (!m_storage) { return; diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h index b7c23af..c7c8183 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.h +++ b/noncore/net/mail/libmailwrapper/mhwrapper.h @@ -17,29 +17,31 @@ class MHwrapper : public Genericwrapper Q_OBJECT public: MHwrapper(const QString & dir,const QString&name); virtual ~MHwrapper(); - + virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); - virtual QList<Folder>* listFolders(); + virtual QValueList<Opie::osmart_pointer<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(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); - - virtual int createMbox(const QString&folder,const Folder*f=0,const QString&d="",bool s=false); - virtual int deleteMbox(const Folder*); + virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder, + const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); + + virtual int createMbox(const QString&folder,const Opie::osmart_pointer<Folder>&f=0, + const QString&d="",bool s=false); + virtual int deleteMbox(const Opie::osmart_pointer<Folder>&); virtual void storeMessage(const char*msg,size_t length, const QString&folder); virtual RecBody fetchBody( const RecMail &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 Folder*); + virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; public slots: @@ -49,12 +51,12 @@ public slots: protected: QString buildPath(const QString&p); QString MHPath; QString MHName; - + void init_storage(); void clean_storage(); - + bool removeMboxfailed; }; #endif diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index 1956c61..2ec052c 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp @@ -187,12 +187,11 @@ void NNTPwrapper::logout() mailstorage_free(m_nntp); m_nntp = 0; } -QList<Folder>* NNTPwrapper::listFolders() { +QValueList<Opie::osmart_pointer<Folder> >* NNTPwrapper::listFolders() { - QList<Folder> * folders = new QList<Folder>(); - folders->setAutoDelete( false ); + QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >(); QStringList groups; if (account) { groups = account->getGroups(); } @@ -203,9 +202,9 @@ QList<Folder>* NNTPwrapper::listFolders() { } /* we made this method in raw nntp access of etpan and not via generic interface * 'cause in that case there will be doubled copy operations. eg. the etpan would - * copy that stuff into its own structures and we must copy it into useable c++ + * copy that stuff into its own structures and we must copy it into useable c++ * structures for our frontend. this would not make sense, so it is better to reimplement * the stuff from generic interface of etpan but copy it direct to qt classes. */ QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) { @@ -279,6 +278,6 @@ const QString&NNTPwrapper::getName()const{ void NNTPwrapper::deleteMail(const RecMail&) { } -int NNTPwrapper::deleteAllMail(const Folder*) { +int NNTPwrapper::deleteAllMail(const FolderP&) { } diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h index 955b9f1..d3a384a 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.h +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h @@ -21,15 +21,15 @@ public: /* mailbox will be ignored */ virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); /* should only get the subscribed one */ - virtual QList<Folder>* listFolders(); + virtual QValueList<Opie::osmart_pointer<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 Folder*); + virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); virtual RecBody fetchBody( const RecMail &mail ); virtual encodedString* fetchRawBody(const RecMail&mail); virtual void logout(); diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 0939b22..7bf7ed2 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp @@ -176,12 +176,11 @@ void POP3wrapper::logout() m_pop3 = 0; } -QList<Folder>* POP3wrapper::listFolders() { - QList<Folder> * folders = new QList<Folder>(); - folders->setAutoDelete( false ); - Folder*inb=new Folder("INBOX","/"); +QValueList<Opie::osmart_pointer<Folder> >* POP3wrapper::listFolders() { + QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<FolderP>(); + FolderP inb=new Folder("INBOX","/"); folders->append(inb); return folders; } @@ -196,9 +195,9 @@ void POP3wrapper::deleteMail(const RecMail&mail) { } void POP3wrapper::answeredMail(const RecMail&) {} -int POP3wrapper::deleteAllMail(const Folder*) { +int POP3wrapper::deleteAllMail(const FolderP&) { login(); if (!m_pop3) return 0; int res = 1; diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index 391c841..e4afb94 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h @@ -17,15 +17,15 @@ public: POP3wrapper( POP3account *a ); virtual ~POP3wrapper(); /* mailbox will be ignored */ virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); - virtual QList<Folder>* listFolders(); + virtual QValueList<Opie::osmart_pointer<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 Folder*); + virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); virtual RecBody fetchBody( const RecMail &mail ); virtual encodedString* fetchRawBody(const RecMail&mail); virtual void logout(); diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index aa8f37a..78652d7 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -132,8 +132,9 @@ void ViewMail::setBody( RecBody body ) QString filename = ""; 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) { @@ -394,9 +395,9 @@ void ViewMail::slotReply() return; } QString rtext; - rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose + rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose .arg( m_mail[0] ) .arg( m_mail[3] ); QString text = m_mail[2]; @@ -409,9 +410,9 @@ void ViewMail::slotReply() rtext += "\n"; QString prefix; if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; - else prefix = "Re: "; // no i18n on purpose + else prefix = "Re: "; // no i18n on purpose Settings *settings = new Settings(); ComposeMail composer( settings ,this, 0, true); if (m_recMail.Replyto().isEmpty()) { @@ -421,9 +422,9 @@ void ViewMail::slotReply() } composer.setSubject( prefix + m_mail[1] ); composer.setMessage( rtext ); composer.setInReplyTo(m_recMail.Msgid()); - + if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) { m_recMail.Wrapper()->answeredMail(m_recMail); } |