summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-12 14:12:00 (UTC)
committer alwin <alwin>2004-03-12 14:12:00 (UTC)
commitd1929ef43f0eaaa17aa42196384d1ed925132873 (patch) (side-by-side diff)
treeeff911f93fe7919d7820e5a2e68b72f2f76143da
parentd38384a6edb0110117e0297864f813b379d52789 (diff)
downloadopie-d1929ef43f0eaaa17aa42196384d1ed925132873.zip
opie-d1929ef43f0eaaa17aa42196384d1ed925132873.tar.gz
opie-d1929ef43f0eaaa17aa42196384d1ed925132873.tar.bz2
some pointers embedded into osmart_pointer handling
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp115
-rw-r--r--noncore/net/mail/accountitem.h21
-rw-r--r--noncore/net/mail/accountview.cpp2
-rw-r--r--noncore/net/mail/accountview.h3
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp5
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h16
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp14
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h12
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h1
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp12
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.h10
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp13
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h9
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp14
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.h12
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp7
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.h4
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h4
-rw-r--r--noncore/net/mail/viewmail.cpp1
21 files changed, 152 insertions, 134 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
@@ -58,5 +58,5 @@ void POP3viewItem::refresh()
{
if (account->getOffline()) return;
- QList<Folder> *folders = wrapper->listFolders();
+ QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
@@ -66,13 +66,11 @@ void POP3viewItem::refresh()
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;
}
@@ -142,8 +140,7 @@ 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")
@@ -251,5 +248,6 @@ void NNTPviewItem::refresh()
{
if (account->getOffline()) return;
- QList<Folder> *folders = wrapper->listFolders();
+ QValueList<FolderP> *folders = wrapper->listFolders();
+
QListViewItem *child = firstChild();
while ( child )
@@ -259,13 +257,11 @@ void NNTPviewItem::refresh()
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;
}
@@ -348,8 +344,7 @@ 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")
@@ -451,19 +446,17 @@ void IMAPviewItem::refreshFolders(bool force)
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");
@@ -471,9 +464,9 @@ 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)
{
@@ -484,12 +477,12 @@ 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;
}
else
{
- item = new IMAPfolderItem( it, this , item );
+ item = new IMAPfolderItem( (*it), this , item );
}
}
@@ -579,8 +572,7 @@ 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;
if (folder->getDisplayName().lower()!="inbox")
@@ -595,8 +587,7 @@ 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;
if (folder->getDisplayName().lower()!="inbox")
@@ -769,18 +760,18 @@ void MHviewItem::refresh(bool force)
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;
}
@@ -798,14 +789,12 @@ void MHviewItem::refresh(bool force)
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;
}
@@ -879,14 +868,13 @@ 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;
@@ -922,5 +910,5 @@ void MHfolderItem::initName()
}
-Folder*MHfolderItem::getFolder()
+const FolderP&MHfolderItem::getFolder()const
{
return folder;
@@ -1044,5 +1032,5 @@ AccountViewItem::AccountViewItem( AccountView *parent )
AccountViewItem::AccountViewItem( QListViewItem *parent)
- : QListViewItem( parent)
+ : QListViewItem( parent),folder(0)
{
init();
@@ -1050,5 +1038,11 @@ 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)
{
init();
@@ -1058,10 +1052,9 @@ void AccountViewItem::init()
{
m_Backlink = 0;
- folder = 0;
}
AccountViewItem::~AccountViewItem()
{
- if (folder) delete folder;
+ folder = 0;
}
@@ -1071,5 +1064,5 @@ AccountView*AccountViewItem::accountView()
}
-void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder)
+void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
{
if (!wrapper) return;
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
@@ -4,4 +4,5 @@
#include <qlistview.h>
#include <qlist.h>
+#include <opie2/osmart_pointer.h>
class POP3wrapper;
@@ -24,4 +25,6 @@ public:
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;
@@ -37,8 +40,8 @@ protected:
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;
};
@@ -67,5 +70,5 @@ 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>&);
@@ -105,5 +108,5 @@ 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>&);
@@ -145,6 +148,6 @@ 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>&);
@@ -187,6 +190,6 @@ 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>&);
@@ -194,5 +197,5 @@ public:
virtual QPopupMenu * getContextMenu();
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
@@ -144,5 +144,5 @@ void AccountView::setupFolderselect(Selectstore*sels)
}
-void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper)
+void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper)
{
AbstractMail*targetMail = 0;
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
@@ -4,4 +4,5 @@
#include <qlistview.h>
#include <qlist.h>
+#include <opie2/osmart_pointer.h>
class Selectstore;
@@ -23,5 +24,5 @@ public:
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();
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
@@ -112,5 +112,5 @@ 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)
{
return 0;
@@ -134,5 +134,6 @@ 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;
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
@@ -4,7 +4,9 @@
#include "maildefines.h"
-#include <qobject.h>
#include "settings.h"
+#include <qobject.h>
+#include <opie2/osmart_pointer.h>
+
class RecMail;
class RecBody;
@@ -22,5 +24,5 @@ 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;
@@ -33,10 +35,11 @@ public:
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);
@@ -47,5 +50,6 @@ public:
* 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;
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
@@ -39,5 +39,5 @@ public:
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){};
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
@@ -267,5 +267,5 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
}
-QList<Folder>* IMAPwrapper::listFolders()
+QValueList<Opie::osmart_pointer<Folder> >* IMAPwrapper::listFolders()
{
const char *path, *mask;
@@ -276,6 +276,5 @@ QList<Folder>* IMAPwrapper::listFolders()
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) {
@@ -967,5 +966,5 @@ encodedString* IMAPwrapper::fetchRawPart(const RecMail&mail,const RecPart&part)
}
-int IMAPwrapper::deleteAllMail(const Folder*folder)
+int IMAPwrapper::deleteAllMail(const FolderP&folder)
{
login();
@@ -1008,5 +1007,5 @@ 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)
{
if (folder.length()==0) return 0;
@@ -1038,5 +1037,5 @@ int IMAPwrapper::createMbox(const QString&folder,const Folder*parentfolder,const
}
-int IMAPwrapper::deleteMbox(const Folder*folder)
+int IMAPwrapper::deleteMbox(const FolderP&folder)
{
if (!folder) return 0;
@@ -1124,5 +1123,6 @@ 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)
{
if (targetWrapper != this) {
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
@@ -24,5 +24,5 @@ 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");
@@ -30,7 +30,8 @@ public:
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);
@@ -41,6 +42,7 @@ public:
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 );
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
@@ -9,5 +9,4 @@
#define FLAG_RECENT 5
-#include <qlist.h>
#include <qbitarray.h>
#include <qstring.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
@@ -36,4 +36,8 @@ Folder::Folder(const QString&tmp_name, const QString&sep )
}
+Folder::~Folder()
+{
+}
+
const QString& Folder::Separator()const
{
@@ -58,4 +62,8 @@ IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no
}
+IMAPFolder::~IMAPFolder()
+{
+}
+
static unsigned char base64chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
@@ -165,2 +173,6 @@ MHFolder::MHFolder(const QString&disp_name,const QString&mbox)
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
@@ -67,10 +67,9 @@ 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; }
const QString&getName()const { return name; }
@@ -84,9 +83,11 @@ protected:
};
+typedef Opie::osmart_pointer<Folder> FolderP;
+
class MHFolder : public Folder
{
- Q_OBJECT
public:
MHFolder(const QString&disp_name,const QString&mbox);
+ virtual ~MHFolder();
};
@@ -95,4 +96,5 @@ 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;}
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
@@ -45,8 +45,7 @@ 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);
if (!dir.exists()) return folders;
@@ -55,5 +54,5 @@ QList<Folder>* MBOXwrapper::listFolders()
QStringList::ConstIterator it = entries.begin();
for (;it!=entries.end();++it) {
- Folder*inb=new Folder(*it,"/");
+ FolderP inb=new Folder(*it,"/");
folders->append(inb);
}
@@ -136,5 +135,5 @@ 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 )
{
QString p = MBOXPath+"/";
@@ -244,5 +243,5 @@ void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target)
}
-int MBOXwrapper::deleteAllMail(const Folder*tfolder)
+int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
{
if (!tfolder) return 0;
@@ -287,5 +286,5 @@ int MBOXwrapper::deleteAllMail(const Folder*tfolder)
}
-int MBOXwrapper::deleteMbox(const Folder*tfolder)
+int MBOXwrapper::deleteMbox(const FolderP&tfolder)
{
if (!tfolder) return 0;
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
@@ -19,5 +19,5 @@ public:
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,6 +25,7 @@ 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>&);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
@@ -35,5 +36,5 @@ public:
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;
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
@@ -77,8 +77,7 @@ 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! */
if (m_storage) mailstorage_disconnect(m_storage);
@@ -170,5 +169,5 @@ 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 )
{
init_storage();
@@ -264,5 +263,5 @@ void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target)
}
-int MHwrapper::deleteAllMail(const Folder*tfolder)
+int MHwrapper::deleteAllMail(const FolderP&tfolder)
{
init_storage();
@@ -299,5 +298,5 @@ int MHwrapper::deleteAllMail(const Folder*tfolder)
}
-int MHwrapper::deleteMbox(const Folder*tfolder)
+int MHwrapper::deleteMbox(const FolderP&tfolder)
{
init_storage();
@@ -402,5 +401,6 @@ 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)
{
init_storage();
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
@@ -21,5 +21,5 @@ public:
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");
@@ -27,8 +27,10 @@ public:
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 void mvcpAllMails(const Opie::osmart_pointer<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 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);
@@ -39,5 +41,5 @@ public:
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;
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
@@ -189,8 +189,7 @@ 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;
if (account) {
@@ -281,4 +280,4 @@ 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
@@ -23,5 +23,5 @@ public:
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");
@@ -29,5 +29,5 @@ public:
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 );
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
@@ -178,8 +178,7 @@ 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);
return folders;
@@ -198,5 +197,5 @@ 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)
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
@@ -19,5 +19,5 @@ public:
/* 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");
@@ -25,5 +25,5 @@ public:
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 );
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
@@ -134,4 +134,5 @@ void ViewMail::setBody( RecBody body )
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();