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 @@ -59,3 +59,3 @@ void POP3viewItem::refresh() if (account->getOffline()) return; - QList<Folder> *folders = wrapper->listFolders(); + QValueList<FolderP> *folders = wrapper->listFolders(); QListViewItem *child = firstChild(); @@ -67,11 +67,9 @@ void POP3viewItem::refresh() } - 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; @@ -143,6 +141,5 @@ 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; @@ -252,3 +249,4 @@ void NNTPviewItem::refresh() if (account->getOffline()) return; - QList<Folder> *folders = wrapper->listFolders(); + QValueList<FolderP> *folders = wrapper->listFolders(); + QListViewItem *child = firstChild(); @@ -260,11 +258,9 @@ void NNTPviewItem::refresh() } - 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; @@ -349,6 +345,5 @@ 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; @@ -452,5 +447,5 @@ void IMAPviewItem::refreshFolders(bool force) currentFolders.clear(); - QList<Folder> *folders = wrapper->listFolders(); + QValueList<FolderP> * folders = wrapper->listFolders(); - Folder *it; + QValueList<FolderP>::Iterator it; QListViewItem*item = 0; @@ -459,10 +454,8 @@ void IMAPviewItem::refreshFolders(bool force) 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); @@ -472,7 +465,7 @@ void IMAPviewItem::refreshFolders(bool force) } - 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) @@ -485,5 +478,5 @@ void IMAPviewItem::refreshFolders(bool force) 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; @@ -492,3 +485,3 @@ void IMAPviewItem::refreshFolders(bool force) { - item = new IMAPfolderItem( it, this , item ); + item = new IMAPfolderItem( (*it), this , item ); } @@ -580,6 +573,5 @@ bool IMAPviewItem::offline() -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; @@ -596,6 +588,5 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList -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; @@ -770,4 +761,4 @@ void MHviewItem::refresh(bool force) currentFolders.clear(); - QList<Folder> *folders = wrapper->listFolders(); - Folder *it; + QValueList<FolderP> *folders = wrapper->listFolders(); + QValueList<FolderP>::ConstIterator it; MHfolderItem*item = 0; @@ -776,5 +767,5 @@ void MHviewItem::refresh(bool force) 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 */ @@ -783,3 +774,3 @@ void MHviewItem::refresh(bool force) currentFolders.append(fname); - folder = it; + folder = (*it); continue; @@ -799,3 +790,3 @@ void MHviewItem::refresh(bool force) { - item = new MHfolderItem( it, pmaster, item, this ); + item = new MHfolderItem( (*it), pmaster, item, this ); } @@ -803,8 +794,6 @@ void MHviewItem::refresh(bool force) { - 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; @@ -880,6 +869,5 @@ 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; @@ -888,4 +876,4 @@ MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewIt -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 ) { @@ -923,3 +911,3 @@ void MHfolderItem::initName() -Folder*MHfolderItem::getFolder() +const FolderP&MHfolderItem::getFolder()const { @@ -1045,3 +1033,3 @@ AccountViewItem::AccountViewItem( AccountView *parent ) AccountViewItem::AccountViewItem( QListViewItem *parent) - : QListViewItem( parent) + : QListViewItem( parent),folder(0) { @@ -1051,3 +1039,9 @@ AccountViewItem::AccountViewItem( QListViewItem *parent) 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) { @@ -1059,3 +1053,2 @@ void AccountViewItem::init() m_Backlink = 0; - folder = 0; } @@ -1064,3 +1057,3 @@ AccountViewItem::~AccountViewItem() { - if (folder) delete folder; + folder = 0; } @@ -1072,3 +1065,3 @@ AccountView*AccountViewItem::accountView() -void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) +void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) { 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 @@ -5,2 +5,3 @@ #include <qlist.h> +#include <opie2/osmart_pointer.h> @@ -20,3 +21,3 @@ class AccountViewItem : public QListViewItem { - + public: @@ -25,2 +26,4 @@ public: AccountViewItem( QListViewItem *parent , QListViewItem*after ); + AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); + virtual ~AccountViewItem(); @@ -38,6 +41,6 @@ protected: 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; }; @@ -68,3 +71,3 @@ 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(); @@ -106,3 +109,3 @@ 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(); @@ -146,4 +149,4 @@ 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(); @@ -188,4 +191,4 @@ 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(); @@ -195,3 +198,3 @@ public: virtual void contextMenuSelected(int); - virtual Folder*getFolder(); + virtual const Opie::osmart_pointer<Folder>&getFolder()const; virtual bool isDraftfolder(); 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 @@ -145,3 +145,3 @@ void AccountView::setupFolderselect(Selectstore*sels) -void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) +void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) { 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 @@ -5,2 +5,3 @@ #include <qlist.h> +#include <opie2/osmart_pointer.h> @@ -24,3 +25,3 @@ public: 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(); @@ -36,5 +37,5 @@ public slots: signals: - void refreshMailview(QList<RecMail>*); + void refreshMailview(QList<RecMail>*); -protected: +protected: QListViewItem* m_currentItem; 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 @@ -113,3 +113,3 @@ QString AbstractMail::gen_attachment_id() -int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) +int AbstractMail::createMbox(const QString&,const FolderP&,const QString& delemiter,bool) { @@ -135,3 +135,4 @@ 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) { 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 @@ -5,5 +5,7 @@ -#include <qobject.h> #include "settings.h" +#include <qobject.h> +#include <opie2/osmart_pointer.h> + class RecMail; @@ -23,3 +25,3 @@ public: 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; @@ -34,8 +36,9 @@ public: 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); @@ -48,3 +51,4 @@ public: */ - 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; 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 @@ -40,3 +40,3 @@ public: virtual void cleanMimeCache(); - virtual int deleteMbox(const Folder*){return 1;} + virtual int deleteMbox(const Opie::osmart_pointer<Folder>&){return 1;} virtual void logout(){}; 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 @@ -268,3 +268,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) -QList<Folder>* IMAPwrapper::listFolders() +QValueList<Opie::osmart_pointer<Folder> >* IMAPwrapper::listFolders() { @@ -277,4 +277,3 @@ QList<Folder>* IMAPwrapper::listFolders() - QList<Folder> * folders = new QList<Folder>(); - folders->setAutoDelete( false ); + QValueList<FolderP>* folders = new QValueList<FolderP>(); login(); @@ -968,3 +967,3 @@ encodedString* IMAPwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) -int IMAPwrapper::deleteAllMail(const Folder*folder) +int IMAPwrapper::deleteAllMail(const FolderP&folder) { @@ -1009,3 +1008,3 @@ int IMAPwrapper::deleteAllMail(const Folder*folder) -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) { @@ -1039,3 +1038,3 @@ int IMAPwrapper::createMbox(const QString&folder,const Folder*parentfolder,const -int IMAPwrapper::deleteMbox(const Folder*folder) +int IMAPwrapper::deleteMbox(const FolderP&folder) { @@ -1125,3 +1124,4 @@ encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail) -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) { 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 @@ -25,11 +25,12 @@ public: 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); @@ -42,7 +43,8 @@ public: - 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(); @@ -66,3 +68,3 @@ protected: void traverseBody(const RecMail&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.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 @@ -10,3 +10,2 @@ -#include <qlist.h> #include <qbitarray.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 @@ -37,2 +37,6 @@ Folder::Folder(const QString&tmp_name, const QString&sep ) +Folder::~Folder() +{ +} + const QString& Folder::Separator()const @@ -59,2 +63,6 @@ IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no +IMAPFolder::~IMAPFolder() +{ +} + static unsigned char base64chars[] = @@ -166 +174,5 @@ MHFolder::MHFolder(const QString&disp_name,const QString&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 @@ -15,3 +15,3 @@ class Attachment public: - Attachment( DocLnk lnk ); + Attachment( DocLnk lnk ); virtual ~Attachment(){} @@ -23,3 +23,3 @@ public: DocLnk getDocLnk() { return doc; } - + protected: @@ -42,3 +42,3 @@ public: 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; } @@ -68,8 +68,7 @@ private: -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; } @@ -85,7 +84,9 @@ protected: +typedef Opie::osmart_pointer<Folder> FolderP; + class MHFolder : public Folder { - Q_OBJECT public: MHFolder(const QString&disp_name,const QString&mbox); + virtual ~MHFolder(); }; @@ -96,2 +97,3 @@ class IMAPFolder : public Folder 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;} 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 @@ -16,3 +16,3 @@ MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name) } - + MBOXwrapper::~MBOXwrapper() @@ -26,6 +26,6 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) 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); @@ -37,5 +37,5 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) } - + parseList(target,folder->fld_session,mailbox); - + mailfolder_disconnect(folder); @@ -46,6 +46,5 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) -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); @@ -56,3 +55,3 @@ QList<Folder>* MBOXwrapper::listFolders() for (;it!=entries.end();++it) { - Folder*inb=new Folder(*it,"/"); + FolderP inb=new Folder(*it,"/"); folders->append(inb); @@ -69,3 +68,3 @@ void MBOXwrapper::deleteMail(const RecMail&mail) mailfolder*folder; - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); @@ -101,3 +100,3 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) mailfolder*folder; - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); @@ -124,3 +123,3 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) } - body = parseMail(msg); + body = parseMail(msg); mailmessage_fetch_result_free(msg,data); @@ -128,3 +127,3 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail ) mailstorage_free(storage); - + return body; @@ -137,3 +136,3 @@ void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) -int MBOXwrapper::createMbox(const QString&folder,const Folder*,const QString&,bool ) +int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) { @@ -184,3 +183,3 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail) mailfolder*folder; - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); @@ -245,3 +244,3 @@ void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target) -int MBOXwrapper::deleteAllMail(const Folder*tfolder) +int MBOXwrapper::deleteAllMail(const FolderP&tfolder) { @@ -250,3 +249,3 @@ int MBOXwrapper::deleteAllMail(const Folder*tfolder) int res = 1; - + mailfolder*folder = 0; @@ -260,3 +259,3 @@ int MBOXwrapper::deleteAllMail(const Folder*tfolder) if (res) { - folder = mailfolder_new( storage,(char*)p.latin1(),NULL); + folder = mailfolder_new( storage,(char*)p.latin1(),NULL); r = mailfolder_connect(folder); @@ -288,3 +287,3 @@ int MBOXwrapper::deleteAllMail(const Folder*tfolder) -int MBOXwrapper::deleteMbox(const Folder*tfolder) +int MBOXwrapper::deleteMbox(const FolderP&tfolder) { @@ -318,3 +317,3 @@ void MBOXwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) 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); 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 @@ -18,5 +18,5 @@ public: 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"); @@ -25,5 +25,6 @@ public: 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>&); @@ -36,3 +37,3 @@ public: 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; 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 @@ -78,6 +78,5 @@ void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target ) -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! */ @@ -146,3 +145,3 @@ RecBody MHwrapper::fetchBody( const RecMail &mail ) } - body = parseMail(msg); + body = parseMail(msg); mailmessage_fetch_result_free(msg,data); @@ -171,3 +170,3 @@ QString MHwrapper::buildPath(const QString&p) -int MHwrapper::createMbox(const QString&folder,const Folder*pfolder,const QString&,bool ) +int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool ) { @@ -265,3 +264,3 @@ void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target) -int MHwrapper::deleteAllMail(const Folder*tfolder) +int MHwrapper::deleteAllMail(const FolderP&tfolder) { @@ -300,3 +299,3 @@ int MHwrapper::deleteAllMail(const Folder*tfolder) -int MHwrapper::deleteMbox(const Folder*tfolder) +int MHwrapper::deleteMbox(const FolderP&tfolder) { @@ -308,5 +307,5 @@ int MHwrapper::deleteMbox(const Folder*tfolder) 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) { @@ -321,3 +320,3 @@ int MHwrapper::deleteMbox(const Folder*tfolder) OProcess *process = new OProcess(); - + connect(process, SIGNAL(processExited(OProcess*)), @@ -388,3 +387,3 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM 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) { @@ -403,3 +402,4 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM -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) { 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 @@ -20,5 +20,5 @@ public: 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"); @@ -28,6 +28,8 @@ public: 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>&); @@ -40,3 +42,3 @@ public: 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; @@ -52,6 +54,6 @@ protected: QString MHName; - + void init_storage(); void clean_storage(); - + bool removeMboxfailed; 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 @@ -190,6 +190,5 @@ void NNTPwrapper::logout() -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; @@ -206,3 +205,3 @@ QList<Folder>* NNTPwrapper::listFolders() { * '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 @@ -282,3 +281,3 @@ 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 @@ -24,3 +24,3 @@ public: /* should only get the subscribed one */ - virtual QList<Folder>* listFolders(); + virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); /* mailbox will be ignored */ @@ -30,3 +30,3 @@ public: virtual void answeredMail(const RecMail&mail); - virtual int deleteAllMail(const Folder*); + virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); 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 @@ -179,6 +179,5 @@ void POP3wrapper::logout() -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); @@ -199,3 +198,3 @@ void POP3wrapper::answeredMail(const RecMail&) {} -int POP3wrapper::deleteAllMail(const Folder*) { +int POP3wrapper::deleteAllMail(const FolderP&) { login(); 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 @@ -20,3 +20,3 @@ public: virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); - virtual QList<Folder>* listFolders(); + virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders(); /* mailbox will be ignored */ @@ -26,3 +26,3 @@ public: virtual void answeredMail(const RecMail&mail); - virtual int deleteAllMail(const Folder*); + virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&); 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 @@ -135,2 +135,3 @@ void ViewMail::setBody( RecBody body ) { + filename = ""; type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); @@ -397,3 +398,3 @@ void ViewMail::slotReply() 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] ) @@ -412,3 +413,3 @@ void ViewMail::slotReply() if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; - else prefix = "Re: "; // no i18n on purpose + else prefix = "Re: "; // no i18n on purpose @@ -424,3 +425,3 @@ void ViewMail::slotReply() composer.setInReplyTo(m_recMail.Msgid()); - + if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) |