summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-12 19:24:38 (UTC)
committer alwin <alwin>2004-03-12 19:24:38 (UTC)
commitb600871ce93553a116a66fd80acd6dfc1cc46829 (patch) (side-by-side diff)
treeb361346a49e09d9f0220993583bf183cf29bd974
parent874d5a34eca296263dcd1adf857aebe9981825a1 (diff)
downloadopie-b600871ce93553a116a66fd80acd6dfc1cc46829.zip
opie-b600871ce93553a116a66fd80acd6dfc1cc46829.tar.gz
opie-b600871ce93553a116a66fd80acd6dfc1cc46829.tar.bz2
some more smart-pointers
some bugfixes some renaming of internals
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp34
-rw-r--r--noncore/net/mail/accountitem.h58
-rw-r--r--noncore/net/mail/accountview.cpp12
-rw-r--r--noncore/net/mail/accountview.h11
-rw-r--r--noncore/net/mail/composemail.cpp24
-rw-r--r--noncore/net/mail/composemail.h4
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp16
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h36
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.h6
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.h10
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp49
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h34
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h15
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.h8
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp43
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.h24
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp50
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.h26
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp26
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.h14
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp32
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h14
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h6
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.h2
-rw-r--r--noncore/net/mail/mailistviewitem.cpp20
-rw-r--r--noncore/net/mail/mailistviewitem.h6
-rw-r--r--noncore/net/mail/mainwindow.cpp7
-rw-r--r--noncore/net/mail/mainwindow.h11
-rw-r--r--noncore/net/mail/opiemail.cpp24
-rw-r--r--noncore/net/mail/opiemail.h4
-rw-r--r--noncore/net/mail/viewmail.cpp36
-rw-r--r--noncore/net/mail/viewmail.h34
38 files changed, 369 insertions, 367 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index 3e12563..9a09c18 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -49,7 +49,7 @@ AbstractMail *POP3viewItem::getWrapper()
return wrapper;
}
-void POP3viewItem::refresh( QList<RecMail> & )
+void POP3viewItem::refresh(QValueList<Opie::OSmartPointer<RecMail> > & )
{
refresh();
}
@@ -75,7 +75,7 @@ void POP3viewItem::refresh()
delete folders;
}
-RecBody POP3viewItem::fetchBody( const RecMail &mail )
+RecBody POP3viewItem::fetchBody( const RecMailP &mail )
{
qDebug( "POP3 fetchBody" );
return wrapper->fetchBody( mail );
@@ -154,13 +154,13 @@ POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent ,
setText( 0, folder->getDisplayName() );
}
-void POP3folderItem::refresh(QList<RecMail>&target)
+void POP3folderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
pop3->getWrapper()->listMessages( folder->getName(),target );
}
-RecBody POP3folderItem::fetchBody(const RecMail&aMail)
+RecBody POP3folderItem::fetchBody(const RecMailP&aMail)
{
return pop3->getWrapper()->fetchBody(aMail);
}
@@ -239,7 +239,7 @@ AbstractMail *NNTPviewItem::getWrapper()
return wrapper;
}
-void NNTPviewItem::refresh( QList<RecMail> & )
+void NNTPviewItem::refresh( QValueList<RecMailP> & )
{
refresh();
}
@@ -266,7 +266,7 @@ void NNTPviewItem::refresh()
delete folders;
}
-RecBody NNTPviewItem::fetchBody( const RecMail &mail )
+RecBody NNTPviewItem::fetchBody( const RecMailP &mail )
{
qDebug( "NNTP fetchBody" );
return wrapper->fetchBody( mail );
@@ -358,13 +358,13 @@ NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent
setText( 0, folder->getDisplayName() );
}
-void NNTPfolderItem::refresh(QList<RecMail>&target)
+void NNTPfolderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
nntp->getWrapper()->listMessages( folder->getName(),target );
}
-RecBody NNTPfolderItem::fetchBody(const RecMail&aMail)
+RecBody NNTPfolderItem::fetchBody(const RecMailP&aMail)
{
return nntp->getWrapper()->fetchBody(aMail);
}
@@ -428,7 +428,7 @@ AbstractMail *IMAPviewItem::getWrapper()
return wrapper;
}
-void IMAPviewItem::refresh(QList<RecMail>&)
+void IMAPviewItem::refresh(QValueList<RecMailP>&)
{
refreshFolders(false);
}
@@ -561,7 +561,7 @@ void IMAPviewItem::contextMenuSelected(int id)
}
}
-RecBody IMAPviewItem::fetchBody(const RecMail&)
+RecBody IMAPviewItem::fetchBody(const RecMailP&)
{
return RecBody();
}
@@ -609,7 +609,7 @@ const QString& IMAPfolderItem::Delemiter()const
return folder->Separator();
}
-void IMAPfolderItem::refresh(QList<RecMail>&target)
+void IMAPfolderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
{
@@ -621,7 +621,7 @@ void IMAPfolderItem::refresh(QList<RecMail>&target)
}
}
-RecBody IMAPfolderItem::fetchBody(const RecMail&aMail)
+RecBody IMAPfolderItem::fetchBody(const RecMailP&aMail)
{
return imap->getWrapper()->fetchBody(aMail);
}
@@ -748,7 +748,7 @@ AbstractMail *MHviewItem::getWrapper()
return wrapper;
}
-void MHviewItem::refresh( QList<RecMail> & target)
+void MHviewItem::refresh( QValueList<RecMailP> & target)
{
refresh(false);
getWrapper()->listMessages( "",target );
@@ -799,7 +799,7 @@ void MHviewItem::refresh(bool force)
delete folders;
}
-RecBody MHviewItem::fetchBody( const RecMail &mail )
+RecBody MHviewItem::fetchBody( const RecMailP &mail )
{
qDebug( "MH fetchBody" );
return wrapper->fetchBody( mail );
@@ -914,13 +914,13 @@ const FolderP&MHfolderItem::getFolder()const
return folder;
}
-void MHfolderItem::refresh(QList<RecMail>&target)
+void MHfolderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
mbox->getWrapper()->listMessages( folder->getName(),target );
}
-RecBody MHfolderItem::fetchBody(const RecMail&aMail)
+RecBody MHfolderItem::fetchBody(const RecMailP&aMail)
{
return mbox->getWrapper()->fetchBody(aMail);
}
@@ -1042,7 +1042,7 @@ AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
init();
}
-AccountViewItem::AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
+AccountViewItem::AccountViewItem( const Opie::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
:QListViewItem( parent,after ),folder(folderInit)
{
init();
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h
index 8f712f5..276eae0 100644
--- a/noncore/net/mail/accountitem.h
+++ b/noncore/net/mail/accountitem.h
@@ -3,7 +3,7 @@
#include <qlistview.h>
#include <qlist.h>
-#include <opie2/osmart_pointer.h>
+#include <opie2/osmartpointer.h>
class POP3wrapper;
class RecMail;
@@ -24,11 +24,11 @@ public:
AccountViewItem( AccountView *parent );
AccountViewItem( QListViewItem *parent);
AccountViewItem( QListViewItem *parent , QListViewItem*after );
- AccountViewItem( const Opie::osmart_pointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after );
+ AccountViewItem( const Opie::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after );
virtual ~AccountViewItem();
- virtual void refresh(QList<RecMail>&)=0;
- virtual RecBody fetchBody(const RecMail&)=0;
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&)=0;
+ virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&)=0;
virtual QPopupMenu * getContextMenu(){return 0;};
virtual void contextMenuSelected(int){}
virtual AccountView*accountView();
@@ -39,10 +39,10 @@ protected:
AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0);
virtual void init();
virtual void removeChilds();
- virtual void deleteAllMail(AbstractMail*wrapper,const Opie::osmart_pointer<Folder>&f);
+ virtual void deleteAllMail(AbstractMail*wrapper,const Opie::OSmartPointer<Folder>&f);
static const QString contextName;
AccountView*m_Backlink;
- Opie::osmart_pointer<Folder> folder;
+ Opie::OSmartPointer<Folder> folder;
};
class POP3viewItem : public AccountViewItem
@@ -51,8 +51,8 @@ class POP3viewItem : public AccountViewItem
public:
POP3viewItem( POP3account *a, AccountView *parent );
virtual ~POP3viewItem();
- virtual void refresh( QList<RecMail> &target );
- virtual RecBody fetchBody( const RecMail &mail );
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target );
+ virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail );
AbstractMail *getWrapper();
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
@@ -69,10 +69,10 @@ class POP3folderItem : public AccountViewItem
{
public:
- POP3folderItem( const Opie::osmart_pointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after );
+ POP3folderItem( const Opie::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after );
virtual ~POP3folderItem();
- virtual void refresh(QList<RecMail>&);
- virtual RecBody fetchBody(const RecMail&);
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
+ virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
@@ -88,8 +88,8 @@ class NNTPviewItem : public AccountViewItem
public:
NNTPviewItem( NNTPaccount *a, AccountView *parent );
virtual ~NNTPviewItem();
- virtual void refresh( QList<RecMail> &target );
- virtual RecBody fetchBody( const RecMail &mail );
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target );
+ virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail );
AbstractMail *getWrapper();
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
@@ -107,10 +107,10 @@ class NNTPfolderItem : public AccountViewItem
{
public:
- NNTPfolderItem(const Opie::osmart_pointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after );
+ NNTPfolderItem(const Opie::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after );
virtual ~NNTPfolderItem();
- virtual void refresh(QList<RecMail>&);
- virtual RecBody fetchBody(const RecMail&);
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
+ virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
@@ -127,8 +127,8 @@ class IMAPviewItem : public AccountViewItem
public:
IMAPviewItem( IMAPaccount *a, AccountView *parent );
virtual ~IMAPviewItem();
- virtual void refresh(QList<RecMail>&);
- virtual RecBody fetchBody(const RecMail&);
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
+ virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
AbstractMail *getWrapper();
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
@@ -147,11 +147,11 @@ class IMAPfolderItem : public AccountViewItem
{
public:
- IMAPfolderItem( const Opie::osmart_pointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after );
- IMAPfolderItem( const Opie::osmart_pointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
+ IMAPfolderItem( const Opie::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after );
+ IMAPfolderItem( const Opie::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
virtual ~IMAPfolderItem();
- virtual void refresh(QList<RecMail>&);
- virtual RecBody fetchBody(const RecMail&);
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
+ virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
virtual const QString& Delemiter()const;
@@ -169,8 +169,8 @@ class MHviewItem : public AccountViewItem
public:
MHviewItem( const QString&aMboxPath, AccountView *parent );
virtual ~MHviewItem();
- virtual void refresh( QList<RecMail> &target );
- virtual RecBody fetchBody( const RecMail &mail );
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&target );
+ virtual RecBody fetchBody( const Opie::OSmartPointer<RecMail> &mail );
AbstractMail *getWrapper();
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
@@ -189,14 +189,14 @@ class MHfolderItem : public AccountViewItem
{
public:
- MHfolderItem( const Opie::osmart_pointer<Folder>&folder, MHviewItem *parent , QListViewItem*after );
- MHfolderItem( const Opie::osmart_pointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
+ MHfolderItem( const Opie::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after );
+ MHfolderItem( const Opie::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
virtual ~MHfolderItem();
- virtual void refresh(QList<RecMail>&);
- virtual RecBody fetchBody(const RecMail&);
+ virtual void refresh(QValueList<Opie::OSmartPointer<RecMail> >&);
+ virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&);
virtual QPopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
- virtual const Opie::osmart_pointer<Folder>&getFolder()const;
+ virtual const Opie::OSmartPointer<Folder>&getFolder()const;
virtual bool isDraftfolder();
protected:
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 297f553..26107ff 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -92,11 +92,10 @@ void AccountView::refresh(QListViewItem *item)
if ( item )
{
m_currentItem = item;
- QList<RecMail> headerlist;
- headerlist.setAutoDelete(true);
+ QValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(item);
view->refresh(headerlist);
- emit refreshMailview(&headerlist);
+ emit refreshMailview(headerlist);
}
}
@@ -104,18 +103,17 @@ void AccountView::refreshCurrent()
{
m_currentItem = currentItem();
if ( !m_currentItem ) return;
- QList<RecMail> headerlist;
- headerlist.setAutoDelete(true);
+ QValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
view->refresh(headerlist);
- emit refreshMailview(&headerlist);
+ emit refreshMailview(headerlist);
}
void AccountView::refreshAll()
{
}
-RecBody AccountView::fetchBody(const RecMail&aMail)
+RecBody AccountView::fetchBody(const RecMailP&aMail)
{
QListViewItem*item = selectedItem ();
if (!item) return RecBody();
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 3478c0b..d236058 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -3,11 +3,10 @@
#include <qlistview.h>
#include <qlist.h>
-#include <opie2/osmart_pointer.h>
+#include <opie2/osmartpointer.h>
+#include <libmailwrapper/mailtypes.h>
class Selectstore;
-class RecMail;
-class RecBody;
class Folder;
class AbstractMail;
class Account;
@@ -22,8 +21,8 @@ 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(const Opie::osmart_pointer<Folder>&fromFolder,AbstractMail*fromWrapper);
+ virtual RecBody fetchBody(const Opie::OSmartPointer<RecMail>&aMail);
+ virtual void downloadMails(const Opie::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
virtual bool currentisDraft();
public slots:
@@ -35,7 +34,7 @@ public slots:
void setupFolderselect(Selectstore*sels);
signals:
- void refreshMailview(QList<RecMail>*);
+ void refreshMailview(const QValueList<RecMailP>& );
protected:
QListViewItem* m_currentItem;
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 445cc5e..74ccc7b 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -188,7 +188,7 @@ void ComposeMail::accept()
qDebug( "Sending Mail with " +
smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() );
#endif
- Opie::osmart_pointer<Mail> mail=new Mail;
+ Opie::OSmartPointer<Mail> mail=new Mail;
SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
mail->setMail(fromBox->currentText());
@@ -236,7 +236,7 @@ void ComposeMail::reject()
tr("No"),QString::null,0,1);
if (yesno == 0) {
- Opie::osmart_pointer<Mail> mail=new Mail();
+ Opie::OSmartPointer<Mail> mail=new Mail();
mail->setMail(fromBox->currentText());
mail->setTo( toLine->text() );
mail->setName(senderNameEdit->text());
@@ -256,11 +256,11 @@ void ComposeMail::reject()
}
qDebug(txt);
mail->setMessage( txt );
-
+
/* only use the default drafts folder name! */
Storemail wrapper(AbstractMail::draftFolder());
wrapper.storeMail(mail);
-
+
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
/* attachments we will ignore! */
if ( it != NULL ) {
@@ -275,15 +275,15 @@ ComposeMail::~ComposeMail()
{
}
-void ComposeMail::reEditMail(const RecMail&current)
+void ComposeMail::reEditMail(const RecMailP&current)
{
- RecMail data = current;
- message->setText(data.Wrapper()->fetchBody(current).Bodytext());
- subjectLine->setText( data.getSubject());
- toLine->setText(data.To().join(","));
- ccLine->setText(data.CC().join(","));
- bccLine->setText(data.Bcc().join(","));
- replyLine->setText(data.Replyto());
+ RecMailP data = current;
+ message->setText(data->Wrapper()->fetchBody(current).Bodytext());
+ subjectLine->setText( data->getSubject());
+ toLine->setText(data->To().join(","));
+ ccLine->setText(data->CC().join(","));
+ bccLine->setText(data->Bcc().join(","));
+ replyLine->setText(data->Replyto());
}
AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
diff --git a/noncore/net/mail/composemail.h b/noncore/net/mail/composemail.h
index 1b9fc79..c12eb30 100644
--- a/noncore/net/mail/composemail.h
+++ b/noncore/net/mail/composemail.h
@@ -9,7 +9,9 @@
#include <libmailwrapper/settings.h>
#include <libmailwrapper/mailwrapper.h>
+class RecMail;
+#include <opie2/osmartpointer.h>
class AddressPicker : public AddressPickerUI
{
@@ -35,7 +37,7 @@ public:
ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
virtual ~ComposeMail();
- void reEditMail(const RecMail&current);
+ void reEditMail(const Opie::OSmartPointer<RecMail>&current);
public slots:
void slotAdjustColumns();
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 7e6d383..68a7a4d 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -81,7 +81,7 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin
QString AbstractMail::convert_String(const char*text)
{
- size_t index = 0;
+ //size_t index = 0;
char*res = 0;
int err = MAILIMF_NO_ERROR;
@@ -111,7 +111,7 @@ QString AbstractMail::gen_attachment_id()
return "{" + stream.read().stripWhiteSpace() + "}";
}
-int AbstractMail::createMbox(const QString&,const FolderP&,const QString& delemiter,bool)
+int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
{
return 0;
}
@@ -129,31 +129,31 @@ QString AbstractMail::draftFolder()
}
/* temporary - will be removed when implemented in all classes */
-void AbstractMail::deleteMails(const QString &,QList<RecMail> &)
+void AbstractMail::deleteMails(const QString &,const QValueList<Opie::OSmartPointer<RecMail> > &)
{
}
void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
- QList<RecMail> t;
+ QValueList<RecMailP> t;
listMessages(fromFolder->getName(),t);
encodedString*st = 0;
while (t.count()>0) {
- RecMail*r = t.at(0);
- st = fetchRawBody(*r);
+ RecMailP r = (*t.begin());
+ st = fetchRawBody(r);
if (st) {
targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
delete st;
}
- t.removeFirst();
+ t.remove(t.begin());
}
if (moveit) {
deleteAllMail(fromFolder);
}
}
-void AbstractMail::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
+void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
encodedString*st = 0;
st = fetchRawBody(mail);
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index d911468..b03d757 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -6,11 +6,9 @@
#include "settings.h"
#include <qobject.h>
-#include <opie2/osmart_pointer.h>
+#include <opie2/osmartpointer.h>
+#include "mailtypes.h"
-class RecMail;
-class RecBody;
-class RecPart;
class IMAPwrapper;
class POP3wrapper;
class Folder;
@@ -23,25 +21,25 @@ class AbstractMail:public QObject
public:
AbstractMail(){};
virtual ~AbstractMail(){}
- virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders()=0;
- virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0;
+ virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders()=0;
+ virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target )=0;
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0;
- virtual RecBody fetchBody(const RecMail&mail)=0;
- virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0;
- virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0;
- virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0;
- virtual encodedString* fetchRawBody(const RecMail&mail)=0;
+ virtual RecBody fetchBody(const RecMailP&mail)=0;
+ virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part)=0;
+ virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part)=0;
+ virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part)=0;
+ virtual encodedString* fetchRawBody(const RecMailP&mail)=0;
- virtual void deleteMail(const RecMail&mail)=0;
- virtual void answeredMail(const RecMail&mail)=0;
- virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&)=0;
- virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
- virtual int deleteMbox(const Opie::osmart_pointer<Folder>&)=0;
+ virtual void deleteMail(const RecMailP&mail)=0;
+ virtual void answeredMail(const RecMailP&mail)=0;
+ virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&)=0;
+ virtual void deleteMails(const QString & FolderName,const QValueList<Opie::OSmartPointer<RecMail> >&target);
+ virtual int deleteMbox(const Opie::OSmartPointer<Folder>&)=0;
virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0;
- virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder,
+ virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
- virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
+ virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual void cleanMimeCache(){};
/* mail box methods */
@@ -49,7 +47,7 @@ public:
* if the implementing subclass has prefixes,
* them has to be appended automatic.
*/
- virtual int createMbox(const QString&,const Opie::osmart_pointer<Folder>&parentfolder=0,
+ virtual int createMbox(const QString&,const Opie::OSmartPointer<Folder>&parentfolder=0,
const QString& delemiter="/",bool getsubfolder=false);
virtual void logout()=0;
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp
index 4f7ec0c..cb7ccc0 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.cpp
+++ b/noncore/net/mail/libmailwrapper/generatemail.cpp
@@ -279,7 +279,7 @@ mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail
strdup( mail.latin1() ) );
}
-mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&mail )
+mailimf_fields *Generatemail::createImfFields(const Opie::OSmartPointer<Mail>&mail )
{
mailimf_fields *fields = NULL;
mailimf_field *xmailer = NULL;
@@ -399,7 +399,7 @@ mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&m
return fields;
}
-mailmime *Generatemail::createMimeMail(const Opie::osmart_pointer<Mail> &mail ) {
+mailmime *Generatemail::createMimeMail(const Opie::OSmartPointer<Mail> &mail ) {
mailmime *message, *txtPart;
mailimf_fields *fields;
int err;
diff --git a/noncore/net/mail/libmailwrapper/generatemail.h b/noncore/net/mail/libmailwrapper/generatemail.h
index 409a55e..c246a2a 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.h
+++ b/noncore/net/mail/libmailwrapper/generatemail.h
@@ -6,7 +6,7 @@
#include <qobject.h>
#include <libetpan/clist.h>
-#include <opie2/osmart_pointer.h>
+#include <opie2/osmartpointer.h>
class Mail;
class RecMail;
@@ -36,8 +36,8 @@ protected:
mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
mailmime *buildTxtPart(const QString&str );
mailimf_mailbox *newMailbox(const QString&name,const QString&mail );
- mailimf_fields *createImfFields(const Opie::osmart_pointer<Mail> &mail );
- mailmime *createMimeMail(const Opie::osmart_pointer<Mail>&mail );
+ mailimf_fields *createImfFields(const Opie::OSmartPointer<Mail> &mail );
+ mailmime *createMimeMail(const Opie::OSmartPointer<Mail>&mail );
clist *createRcptList( mailimf_fields *fields );
static const char* USER_AGENT;
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 6c8a5a1..ee2c8cd 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -331,7 +331,7 @@ QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list )
return result;
}
-encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part)
+encodedString* Genericwrapper::fetchDecodedPart(const RecMailP&,const RecPart&part)
{
QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier());
if (it==bodyCache.end()) return new encodedString();
@@ -339,7 +339,7 @@ encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&par
return t;
}
-encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part)
+encodedString* Genericwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part)
{
QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier());
if (it==bodyCache.end()) return new encodedString();
@@ -347,7 +347,7 @@ encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&par
return t;
}
-QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part)
+QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part)
{
encodedString*t = fetchDecodedPart(mail,part);
QString text=t->Content();
@@ -387,7 +387,7 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
return res;
}
-void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to)
+void Genericwrapper::parseList(QValueList<Opie::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to)
{
int r;
mailmessage_list * env_list = 0;
@@ -415,7 +415,7 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const
//qDebug("could not fetch envelope of message %i", i);
continue;
}
- RecMail * mail = new RecMail();
+ RecMailP mail = new RecMail();
mail->setWrapper(this);
mail_flags * flag_result = 0;
r = mailmessage_get_flags(msg,&flag_result);
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h
index d0db45a..f9968d1 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.h
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.h
@@ -34,11 +34,11 @@ public:
Genericwrapper();
virtual ~Genericwrapper();
- virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part);
- virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part);
- virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
+ virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part);
+ virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part);
+ virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part);
virtual void cleanMimeCache();
- virtual int deleteMbox(const Opie::osmart_pointer<Folder>&){return 1;}
+ virtual int deleteMbox(const Opie::OSmartPointer<Folder>&){return 1;}
virtual void logout(){};
virtual void storeMessage(const char*msg,size_t length, const QString&folder){};
@@ -54,7 +54,7 @@ protected:
static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime);
static void fillParameters(RecPart&target,clist*parameters);
static QString getencoding(mailmime_mechanism*aEnc);
- virtual void parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false);
+ virtual void parseList(QValueList<Opie::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false);
QStringList parseInreplies(mailimf_in_reply_to * in_replies);
QString msgTempName;
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 3b3be0f..071e734 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -205,7 +205,7 @@ void IMAPwrapper::logout()
m_Lastmbox = "";
}
-void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
+void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::OSmartPointer<RecMail> > &target )
{
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
@@ -266,7 +266,7 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
if (result) mailimap_fetch_list_free(result);
}
-QValueList<Opie::osmart_pointer<Folder> >* IMAPwrapper::listFolders()
+QValueList<Opie::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
{
const char *path, *mask;
int err = MAILIMAP_NO_ERROR;
@@ -482,7 +482,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
return m;
}
-RecBody IMAPwrapper::fetchBody(const RecMail&mail)
+RecBody IMAPwrapper::fetchBody(const RecMailP&mail)
{
RecBody body;
const char *mb;
@@ -494,19 +494,19 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
mailimap_set *set = 0;
mailimap_body*body_desc = 0;
- mb = mail.getMbox().latin1();
+ mb = mail->getMbox().latin1();
login();
if (!m_imap) {
return body;
}
- err = selectMbox(mail.getMbox());
+ err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return body;
}
/* the range has to start at 1!!! not with 0!!!! */
- set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() );
+ set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() );
fetchAtt = mailimap_fetch_att_new_bodystructure();
fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
err = mailimap_fetch( m_imap, set, fetchType, &result );
@@ -568,7 +568,7 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
return l;
}
-encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call)
+encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call)
{
encodedString*res=new encodedString;
int err;
@@ -585,12 +585,12 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
return res;
}
if (!internal_call) {
- err = selectMbox(mail.getMbox());
+ err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return res;
}
}
- set = mailimap_set_new_single(mail.getNumber());
+ set = mailimap_set_new_single(mail->getNumber());
clist*id_list = 0;
@@ -641,7 +641,7 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>
/* current_recursion is for recursive calls.
current_count means the position inside the internal loop! */
-void IMAPwrapper::traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,
+void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBody&target_body,
int current_recursion,QValueList<int>recList,int current_count)
{
if (!body || current_recursion>=10) {
@@ -869,7 +869,7 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
target_part.setSize(which->bd_size);
}
-void IMAPwrapper::deleteMail(const RecMail&mail)
+void IMAPwrapper::deleteMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
mailimap_set *set;
@@ -879,14 +879,14 @@ void IMAPwrapper::deleteMail(const RecMail&mail)
if (!m_imap) {
return;
}
- err = selectMbox(mail.getMbox());
+ err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
store_flags = mailimap_store_att_flags_new_set_flags(flist);
- set = mailimap_set_new_single(mail.getNumber());
+ set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
@@ -904,7 +904,7 @@ void IMAPwrapper::deleteMail(const RecMail&mail)
qDebug("Delete successfull %s",m_imap->imap_response);
}
-void IMAPwrapper::answeredMail(const RecMail&mail)
+void IMAPwrapper::answeredMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
mailimap_set *set;
@@ -914,14 +914,14 @@ void IMAPwrapper::answeredMail(const RecMail&mail)
if (!m_imap) {
return;
}
- err = selectMbox(mail.getMbox());
+ err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_answered());
store_flags = mailimap_store_att_flags_new_add_flags(flist);
- set = mailimap_set_new_single(mail.getNumber());
+ set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
@@ -932,7 +932,7 @@ void IMAPwrapper::answeredMail(const RecMail&mail)
}
}
-QString IMAPwrapper::fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
+QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
{
QString body("");
encodedString*res = fetchRawPart(mail,path,internal_call);
@@ -947,12 +947,12 @@ QString IMAPwrapper::fetchTextPart(const RecMail&mail,const QValueList<int>&path
return body;
}
-QString IMAPwrapper::fetchTextPart(const RecMail&mail,const RecPart&part)
+QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPart&part)
{
return fetchTextPart(mail,part.Positionlist(),false,part.Encoding());
}
-encodedString* IMAPwrapper::fetchDecodedPart(const RecMail&mail,const RecPart&part)
+encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPart&part)
{
encodedString*res = fetchRawPart(mail,part.Positionlist(),false);
encodedString*r = decode_String(res,part.Encoding());
@@ -960,7 +960,7 @@ encodedString* IMAPwrapper::fetchDecodedPart(const RecMail&mail,const RecPart&pa
return r;
}
-encodedString* IMAPwrapper::fetchRawPart(const RecMail&mail,const RecPart&part)
+encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPart&part)
{
return fetchRawPart(mail,part.Positionlist(),false);
}
@@ -1055,7 +1055,6 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
mailimap_mailbox_data_status * status=0;
clistiter * cur = 0;
int r = 0;
- int res = 0;
target_stat.message_count = 0;
target_stat.message_unseen = 0;
target_stat.message_recent = 0;
@@ -1115,7 +1114,7 @@ const QString&IMAPwrapper::getName()const
return account->getAccountName();
}
-encodedString* IMAPwrapper::fetchRawBody(const RecMail&mail)
+encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
{
// dummy
QValueList<int> path;
@@ -1154,7 +1153,7 @@ void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
}
}
-void IMAPwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
+void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
if (targetWrapper != this) {
qDebug("Using generic");
@@ -1166,11 +1165,11 @@ void IMAPwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,Abstrac
if (!m_imap) {
return;
}
- int err = selectMbox(mail.getMbox());
+ int err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
- set = mailimap_set_new_single(mail.getNumber());
+ set = mailimap_set_new_single(mail->getNumber());
err = mailimap_copy(m_imap,set,targetFolder.latin1());
mailimap_set_free( set );
if ( err != MAILIMAP_NO_ERROR ) {
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index 15f049f..3bd5967 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -23,27 +23,27 @@ class IMAPwrapper : public AbstractMail
public:
IMAPwrapper( IMAPaccount *a );
virtual ~IMAPwrapper();
- virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders();
- virtual void listMessages(const QString & mailbox,QList<RecMail>&target );
+ virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox,QValueList<Opie::OSmartPointer<RecMail> >&target );
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
- virtual void deleteMail(const RecMail&mail);
- virtual void answeredMail(const RecMail&mail);
- virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&folder);
+ virtual void deleteMail(const RecMailP&mail);
+ virtual void answeredMail(const RecMailP&mail);
+ virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&folder);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
- virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder,
+ virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
- virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
+ virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
- virtual RecBody fetchBody(const RecMail&mail);
- virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
- virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part);
- virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part);
- virtual encodedString* fetchRawBody(const RecMail&mail);
+ virtual RecBody fetchBody(const RecMailP&mail);
+ virtual QString fetchTextPart(const RecMailP&mail,const RecPart&part);
+ virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPart&part);
+ virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPart&part);
+ virtual encodedString* fetchRawBody(const RecMailP&mail);
- virtual int createMbox(const QString&,const Opie::osmart_pointer<Folder>&parentfolder=0,
+ virtual int createMbox(const QString&,const Opie::OSmartPointer<Folder>&parentfolder=0,
const QString& delemiter="/",bool getsubfolder=false);
- virtual int deleteMbox(const Opie::osmart_pointer<Folder>&folder);
+ virtual int deleteMbox(const Opie::OSmartPointer<Folder>&folder);
static void imap_progress( size_t current, size_t maximum );
@@ -56,8 +56,8 @@ protected:
void login();
bool start_tls(bool force=true);
- virtual QString fetchTextPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
- virtual encodedString*fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call);
+ virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
+ virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call);
int selectMbox(const QString&mbox);
void fillSinglePart(RecPart&target_part,mailimap_body_type_1part*Description);
@@ -65,7 +65,7 @@ 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);
+ void traverseBody(const RecMailP&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);
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
index 49b3caa..7dd7e58 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.cpp
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -2,13 +2,13 @@
#include <stdlib.h>
RecMail::RecMail()
- :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
+ :Opie::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
{
init();
}
RecMail::RecMail(const RecMail&old)
- :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
+ :Opie::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
{
init();
copy_old(old);
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h
index 10d367f..dc10de6 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.h
+++ b/noncore/net/mail/libmailwrapper/mailtypes.h
@@ -8,6 +8,8 @@
#define FLAG_DRAFT 4
#define FLAG_RECENT 5
+#include <opie2/osmartpointer.h>
+
#include <qbitarray.h>
#include <qstring.h>
#include <qstringlist.h>
@@ -27,15 +29,15 @@ class AbstractMail;
make a request to the mailwrapper with this class as parameter to
get the body. Same words for the attachments.
*/
-class RecMail
+class RecMail:public Opie::ORefCount
{
public:
RecMail();
RecMail(const RecMail&old);
virtual ~RecMail();
- const int getNumber()const{return msg_number;}
- void setNumber(int number){msg_number=number;}
+ const unsigned int getNumber()const{return msg_number;}
+ void setNumber(unsigned int number){msg_number=number;}
const QString&getDate()const{ return date; }
void setDate( const QString&a ) { date = a; }
const QString&getFrom()const{ return from; }
@@ -48,8 +50,8 @@ public:
const QString&Msgid()const{return msg_id;}
void setReplyto(const QString&reply){replyto=reply;}
const QString&Replyto()const{return replyto;}
- void setMsgsize(int size){msg_size = size;}
- const int Msgsize()const{return msg_size;}
+ void setMsgsize(unsigned int size){msg_size = size;}
+ const unsigned int Msgsize()const{return msg_size;}
void setTo(const QStringList&list);
@@ -71,7 +73,7 @@ public:
protected:
QString subject,date,from,mbox,msg_id,replyto;
- int msg_number,msg_size;
+ unsigned int msg_number,msg_size;
QBitArray msg_flags;
QStringList to,cc,bcc,in_reply_to,references;
AbstractMail*wrapper;
@@ -79,6 +81,7 @@ protected:
void copy_old(const RecMail&old);
};
+typedef Opie::OSmartPointer<RecMail> RecMailP;
typedef QMap<QString,QString> part_plist_t;
class RecPart
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index c71d69f..9bf2fd3 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -155,7 +155,7 @@ QString IMAPFolder::decodeFolderName( const QString &name )
}
Mail::Mail()
- :Opie::oref_count(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("")
+ :Opie::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("")
{
}
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h
index 3b3bb32..6bf0078 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.h
@@ -8,7 +8,7 @@
#include "settings.h"
-#include <opie2/osmart_pointer.h>
+#include <opie2/osmartpointer.h>
class Attachment
{
@@ -28,7 +28,7 @@ protected:
};
-class Mail:public Opie::oref_count
+class Mail:public Opie::ORefCount
{
public:
Mail();
@@ -66,7 +66,7 @@ private:
QStringList m_in_reply_to;
};
-class Folder:public Opie::oref_count
+class Folder:public Opie::ORefCount
{
public:
Folder( const QString&init_name,const QString&sep );
@@ -82,7 +82,7 @@ protected:
QString nameDisplay, name, separator,prefix;
};
-typedef Opie::osmart_pointer<Folder> FolderP;
+typedef Opie::OSmartPointer<Folder> FolderP;
class MHFolder : public Folder
{
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
index 9ff3de2..5e6b714 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp
@@ -19,7 +19,7 @@ MBOXwrapper::~MBOXwrapper()
{
}
-void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target )
+void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target )
{
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
@@ -44,9 +44,9 @@ void MBOXwrapper::listMessages(const QString & mailbox, QList<RecMail> &target )
Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
}
-QValueList<Opie::osmart_pointer<Folder> >* MBOXwrapper::listFolders()
+QValueList<Opie::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
{
- QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >();
+ QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >();
QDir dir(MBOXPath);
if (!dir.exists()) return folders;
dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable);
@@ -59,11 +59,11 @@ QValueList<Opie::osmart_pointer<Folder> >* MBOXwrapper::listFolders()
return folders;
}
-void MBOXwrapper::deleteMail(const RecMail&mail)
+void MBOXwrapper::deleteMail(const RecMailP & mail)
{
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
- p+=mail.getMbox();
+ p+=mail->getMbox();
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
@@ -74,7 +74,7 @@ void MBOXwrapper::deleteMail(const RecMail&mail)
mailstorage_free(storage);
return;
}
- r = mailsession_remove_message(folder->fld_session,mail.getNumber());
+ r = mailsession_remove_message(folder->fld_session,mail->getNumber());
if (r != MAIL_NO_ERROR) {
qDebug("error deleting mail");
}
@@ -82,16 +82,16 @@ void MBOXwrapper::deleteMail(const RecMail&mail)
mailstorage_free(storage);
}
-void MBOXwrapper::answeredMail(const RecMail&)
+void MBOXwrapper::answeredMail(const RecMailP&)
{
}
-RecBody MBOXwrapper::fetchBody( const RecMail &mail )
+RecBody MBOXwrapper::fetchBody( const RecMailP &mail )
{
RecBody body;
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
- p+=mail.getMbox();
+ p+=mail->getMbox();
mailmessage * msg;
char*data=0;
size_t size;
@@ -106,16 +106,16 @@ RecBody MBOXwrapper::fetchBody( const RecMail &mail )
mailstorage_free(storage);
return body;
}
- r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg);
+ r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
- qDebug("Error fetching mail %i",mail.getNumber());
+ qDebug("Error fetching mail %i",mail->getNumber());
mailfolder_free(folder);
mailstorage_free(storage);
return body;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
- qDebug("Error fetching mail %i",mail.getNumber());
+ qDebug("Error fetching mail %i",mail->getNumber());
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
@@ -169,12 +169,12 @@ void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folde
mailmbox_done(f);
}
-encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail)
+encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
{
RecBody body;
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
- p+=mail.getMbox();
+ p+=mail->getMbox();
mailmessage * msg;
char*data=0;
size_t size;
@@ -189,16 +189,16 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail)
mailstorage_free(storage);
return 0;
}
- r = mailsession_get_message(folder->fld_session, mail.getNumber(), &msg);
+ r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
- Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber()));
+ Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
mailfolder_free(folder);
mailstorage_free(storage);
return 0;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
- Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber()));
+ Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
@@ -212,7 +212,7 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMail&mail)
return result;
}
-void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target)
+void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
{
QString p = MBOXPath+"/";
p+=mailbox;
@@ -226,12 +226,13 @@ void MBOXwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target)
mailmbox_done(f);
}
-void MBOXwrapper::deleteMails(mailmbox_folder*f,QList<RecMail> &target)
+void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target)
{
if (!f) return;
int r;
- for (unsigned int i=0; i < target.count();++i) {
- r = mailmbox_delete_msg(f,target.at(i)->getNumber());
+ QValueList<RecMailP>::ConstIterator it;
+ for (it=target.begin(); it != target.end();++it) {
+ r = mailmbox_delete_msg(f,(*it)->getNumber());
if (r!=MAILMBOX_NO_ERROR) {
qDebug("error delete mail");
}
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.h b/noncore/net/mail/libmailwrapper/mboxwrapper.h
index c3d9b50..33eeb1e 100644
--- a/noncore/net/mail/libmailwrapper/mboxwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mboxwrapper.h
@@ -4,8 +4,6 @@
#include "genericwrapper.h"
#include <qstring.h>
-class RecMail;
-class RecBody;
class encodedString;
struct mailmbox_folder;
@@ -17,30 +15,30 @@ public:
MBOXwrapper(const QString & dir,const QString&name);
virtual ~MBOXwrapper();
- virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
- virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, QValueList<RecMailP>&target );
+ virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
- virtual void deleteMail(const RecMail&mail);
- virtual void answeredMail(const RecMail&mail);
+ virtual void deleteMail(const RecMailP&mail);
+ virtual void answeredMail(const RecMailP&mail);
- virtual int createMbox(const QString&folder,const Opie::osmart_pointer<Folder>&f=0,
+ virtual int createMbox(const QString&folder,const Opie::OSmartPointer<Folder>&f=0,
const QString&d="",bool s=false);
- virtual int deleteMbox(const Opie::osmart_pointer<Folder>&);
+ virtual int deleteMbox(const Opie::OSmartPointer<Folder>&);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
- virtual RecBody fetchBody( const RecMail &mail );
+ virtual RecBody fetchBody( const RecMailP &mail );
static void mbox_progress( size_t current, size_t maximum );
- virtual encodedString* fetchRawBody(const RecMail&mail);
- virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
- virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&);
+ virtual encodedString* fetchRawBody(const RecMailP&mail);
+ virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target);
+ virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&);
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
protected:
- static void deleteMails(mailmbox_folder*f,QList<RecMail> &target);
+ static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target);
QString MBOXPath;
QString MBOXName;
};
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index aaaa20a..0b00a2e 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
@@ -60,7 +60,7 @@ MHwrapper::~MHwrapper()
clean_storage();
}
-void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target )
+void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target )
{
init_storage();
if (!m_storage) {
@@ -76,9 +76,9 @@ void MHwrapper::listMessages(const QString & mailbox, QList<RecMail> &target )
Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
}
-QValueList<Opie::osmart_pointer<Folder> >* MHwrapper::listFolders()
+QValueList<Opie::OSmartPointer<Folder> >* MHwrapper::listFolders()
{
- QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >();
+ QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >();
/* this is needed! */
if (m_storage) mailstorage_disconnect(m_storage);
init_storage();
@@ -101,28 +101,28 @@ QValueList<Opie::osmart_pointer<Folder> >* MHwrapper::listFolders()
return folders;
}
-void MHwrapper::deleteMail(const RecMail&mail)
+void MHwrapper::deleteMail(const RecMailP&mail)
{
init_storage();
if (!m_storage) {
return;
}
- int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1());
+ int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("error selecting folder!");
return;
}
- r = mailsession_remove_message(m_storage->sto_session,mail.getNumber());
+ r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
if (r != MAIL_NO_ERROR) {
qDebug("error deleting mail");
}
}
-void MHwrapper::answeredMail(const RecMail&)
+void MHwrapper::answeredMail(const RecMailP&)
{
}
-RecBody MHwrapper::fetchBody( const RecMail &mail )
+RecBody MHwrapper::fetchBody( const RecMailP &mail )
{
RecBody body;
init_storage();
@@ -131,16 +131,15 @@ RecBody MHwrapper::fetchBody( const RecMail &mail )
}
mailmessage * msg;
char*data=0;
- size_t size;
/* mail should hold the complete path! */
- int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1());
+ int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r != MAIL_NO_ERROR) {
return body;
}
- r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg);
+ r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
- qDebug("Error fetching mail %i",mail.getNumber());
+ qDebug("Error fetching mail %i",mail->getNumber());
return body;
}
body = parseMail(msg);
@@ -212,7 +211,7 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
return;
}
-encodedString* MHwrapper::fetchRawBody(const RecMail&mail)
+encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
{
encodedString*result = 0;
init_storage();
@@ -222,19 +221,19 @@ encodedString* MHwrapper::fetchRawBody(const RecMail&mail)
mailmessage * msg = 0;
char*data=0;
size_t size;
- int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1());
+ int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("error selecting folder!");
return result;
}
- r = mailsession_get_message(m_storage->sto_session, mail.getNumber(), &msg);
+ r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
- Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber()));
+ Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
return 0;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
- Global::statusMessage(tr("Error fetching mail %i").arg(mail.getNumber()));
+ Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
if (msg) mailmessage_free(msg);
return 0;
}
@@ -243,7 +242,7 @@ encodedString* MHwrapper::fetchRawBody(const RecMail&mail)
return result;
}
-void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target)
+void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
{
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
@@ -251,10 +250,9 @@ void MHwrapper::deleteMails(const QString & mailbox,QList<RecMail> &target)
qDebug("deleteMails: error selecting folder!");
return;
}
- RecMail*c = 0;
- for (unsigned int i=0; i < target.count();++i) {
- c = target.at(i);
- r = mailsession_remove_message(m_storage->sto_session,c->getNumber());
+ QValueList<RecMailP>::ConstIterator it;
+ for (it=target.begin(); it!=target.end();++it) {
+ r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
if (r != MAIL_NO_ERROR) {
qDebug("error deleting mail");
break;
@@ -372,7 +370,7 @@ const QString&MHwrapper::getName()const
{
return MHName;
}
-void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
+void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
init_storage();
if (!m_storage) {
@@ -385,15 +383,15 @@ void MHwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractM
}
qDebug("Using internal routines for move/copy");
QString tf = buildPath(targetFolder);
- int r = mailsession_select_folder(m_storage->sto_session,(char*)mail.getMbox().latin1());
+ int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r != MAIL_NO_ERROR) {
qDebug("Error selecting source mailbox");
return;
}
if (moveit) {
- r = mailsession_move_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1());
+ r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
} else {
- r = mailsession_copy_message(m_storage->sto_session,mail.getNumber(),(char*)tf.latin1());
+ r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
}
if (r != MAIL_NO_ERROR) {
qDebug("Error copy/moving mail internal (%i)",r);
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.h b/noncore/net/mail/libmailwrapper/mhwrapper.h
index c7c8183..208cf2f 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.h
@@ -6,8 +6,6 @@
#include "genericwrapper.h"
#include <qstring.h>
-class RecMail;
-class RecBody;
class encodedString;
struct mailmbox_folder;
class OProcess;
@@ -19,28 +17,28 @@ public:
MHwrapper(const QString & dir,const QString&name);
virtual ~MHwrapper();
- virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
- virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target );
+ virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
- virtual void deleteMail(const RecMail&mail);
- virtual void answeredMail(const RecMail&mail);
- virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
- virtual void mvcpAllMails(const Opie::osmart_pointer<Folder>&fromFolder,
+ virtual void deleteMail(const RecMailP&mail);
+ virtual void answeredMail(const RecMailP&mail);
+ virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
+ virtual void mvcpAllMails(const Opie::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
- virtual int createMbox(const QString&folder,const Opie::osmart_pointer<Folder>&f=0,
+ virtual int createMbox(const QString&folder,const Opie::OSmartPointer<Folder>&f=0,
const QString&d="",bool s=false);
- virtual int deleteMbox(const Opie::osmart_pointer<Folder>&);
+ virtual int deleteMbox(const Opie::OSmartPointer<Folder>&);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
- virtual RecBody fetchBody( const RecMail &mail );
+ virtual RecBody fetchBody( const RecMailP &mail );
static void mbox_progress( size_t current, size_t maximum );
- virtual encodedString* fetchRawBody(const RecMail&mail);
- virtual void deleteMails(const QString & FolderName,QList<RecMail> &target);
- virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&);
+ virtual encodedString* fetchRawBody(const RecMailP&mail);
+ virtual void deleteMails(const QString & FolderName,const QValueList<Opie::OSmartPointer<RecMail> > &target);
+ virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&);
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
index 2ec052c..c0b3eec 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp
@@ -32,7 +32,7 @@ void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) {
}
-RecBody NNTPwrapper::fetchBody( const RecMail &mail ) {
+RecBody NNTPwrapper::fetchBody( const RecMailP &mail ) {
int err = NEWSNNTP_NO_ERROR;
char *message = 0;
size_t length = 0;
@@ -44,8 +44,8 @@ RecBody NNTPwrapper::fetchBody( const RecMail &mail ) {
RecBody body;
mailmessage * mailmsg;
- if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) {
- qDebug("Message to large: %i",mail.Msgsize());
+ if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
+ qDebug("Message to large: %i",mail->Msgsize());
return body;
}
@@ -53,13 +53,13 @@ RecBody NNTPwrapper::fetchBody( const RecMail &mail ) {
cleanMimeCache();
- if (mail.getNumber()!=last_msg_id) {
+ if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
msg_cache.open(IO_ReadWrite|IO_Truncate);
- last_msg_id = mail.getNumber();
- err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg);
+ last_msg_id = mail->getNumber();
+ err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
@@ -96,7 +96,7 @@ RecBody NNTPwrapper::fetchBody( const RecMail &mail ) {
}
-void NNTPwrapper::listMessages(const QString & which, QList<RecMail> &target )
+void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::OSmartPointer<RecMail> > &target )
{
login();
if (!m_nntp)
@@ -188,9 +188,9 @@ void NNTPwrapper::logout()
m_nntp = 0;
}
-QValueList<Opie::osmart_pointer<Folder> >* NNTPwrapper::listFolders() {
+QValueList<Opie::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
- QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<Opie::osmart_pointer<Folder> >();
+ QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<Opie::OSmartPointer<Folder> >();
QStringList groups;
if (account) {
groups = account->getGroups();
@@ -239,7 +239,7 @@ QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) {
return res;
}
-void NNTPwrapper::answeredMail(const RecMail&) {}
+void NNTPwrapper::answeredMail(const RecMailP&) {}
void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) {
login();
@@ -253,12 +253,12 @@ void NNTPwrapper::statusFolder(folderStat&target_stat,const QString&) {
}
-encodedString* NNTPwrapper::fetchRawBody(const RecMail&mail) {
+encodedString* NNTPwrapper::fetchRawBody(const RecMailP&mail) {
char*target=0;
size_t length=0;
encodedString*res = 0;
mailmessage * mailmsg = 0;
- int err = mailsession_get_message(m_nntp->sto_session, mail.getNumber(), &mailmsg);
+ int err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&target,&length);
if (mailmsg)
mailmessage_free(mailmsg);
@@ -276,7 +276,7 @@ const QString&NNTPwrapper::getName()const{
return account->getAccountName();
}
-void NNTPwrapper::deleteMail(const RecMail&) {
+void NNTPwrapper::deleteMail(const RecMailP&) {
}
int NNTPwrapper::deleteAllMail(const FolderP&) {
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.h b/noncore/net/mail/libmailwrapper/nntpwrapper.h
index d3a384a..a7e4b95 100644
--- a/noncore/net/mail/libmailwrapper/nntpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/nntpwrapper.h
@@ -20,18 +20,18 @@ public:
virtual ~NNTPwrapper();
/* mailbox will be ignored */
- virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
+ virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target );
/* should only get the subscribed one */
- virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders();
+ virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
QStringList listAllNewsgroups(const QString&mask = QString::null);
- virtual void deleteMail(const RecMail&mail);
- virtual void answeredMail(const RecMail&mail);
- virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&);
+ virtual void deleteMail(const RecMailP&mail);
+ virtual void answeredMail(const RecMailP&mail);
+ virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&);
- virtual RecBody fetchBody( const RecMail &mail );
- virtual encodedString* fetchRawBody(const RecMail&mail);
+ virtual RecBody fetchBody( const RecMailP &mail );
+ virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 7bf7ed2..6737d6c 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -30,7 +30,7 @@ void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
qDebug( "POP3: %i of %i", current, maximum );
}
-RecBody POP3wrapper::fetchBody( const RecMail &mail ) {
+RecBody POP3wrapper::fetchBody( const RecMailP &mail ) {
int err = MAILPOP3_NO_ERROR;
char *message = 0;
size_t length = 0;
@@ -42,8 +42,8 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) {
RecBody body;
mailmessage * mailmsg;
- if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) {
- qDebug("Message to large: %i",mail.Msgsize());
+ if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
+ qDebug("Message to large: %i",mail->Msgsize());
return body;
}
@@ -51,13 +51,13 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) {
cleanMimeCache();
- if (mail.getNumber()!=last_msg_id) {
+ if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
msg_cache.open(IO_ReadWrite|IO_Truncate);
- last_msg_id = mail.getNumber();
- err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg);
+ last_msg_id = mail->getNumber();
+ err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
@@ -93,7 +93,7 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) {
return body;
}
-void POP3wrapper::listMessages(const QString &, QList<RecMail> &target )
+void POP3wrapper::listMessages(const QString &, QValueList<Opie::OSmartPointer<RecMail> > &target )
{
login();
if (!m_pop3)
@@ -169,7 +169,6 @@ void POP3wrapper::login()
void POP3wrapper::logout()
{
- int err = MAILPOP3_NO_ERROR;
if ( m_pop3 == NULL )
return;
mailstorage_free(m_pop3);
@@ -177,24 +176,24 @@ void POP3wrapper::logout()
}
-QValueList<Opie::osmart_pointer<Folder> >* POP3wrapper::listFolders() {
- QValueList<Opie::osmart_pointer<Folder> >* folders = new QValueList<FolderP>();
+QValueList<Opie::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
+ QValueList<Opie::OSmartPointer<Folder> >* folders = new QValueList<FolderP>();
FolderP inb=new Folder("INBOX","/");
folders->append(inb);
return folders;
}
-void POP3wrapper::deleteMail(const RecMail&mail) {
+void POP3wrapper::deleteMail(const RecMailP&mail) {
login();
if (!m_pop3)
return;
- int err = mailsession_remove_message(m_pop3->sto_session,mail.getNumber());
+ int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
if (err != MAIL_NO_ERROR) {
Global::statusMessage(tr("error deleting mail"));
}
}
-void POP3wrapper::answeredMail(const RecMail&) {}
+void POP3wrapper::answeredMail(const RecMailP&) {}
int POP3wrapper::deleteAllMail(const FolderP&) {
login();
@@ -228,14 +227,17 @@ void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
return;
int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
+ if (r != MAIL_NO_ERROR) {
+ qDebug("error getting folter status.");
+ }
}
-encodedString* POP3wrapper::fetchRawBody(const RecMail&mail) {
+encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) {
char*target=0;
size_t length=0;
encodedString*res = 0;
mailmessage * mailmsg = 0;
- int err = mailsession_get_message(m_pop3->sto_session, mail.getNumber(), &mailmsg);
+ int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&target,&length);
if (mailmsg)
mailmessage_free(mailmsg);
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index e4afb94..31eb6f1 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -17,17 +17,17 @@ public:
POP3wrapper( POP3account *a );
virtual ~POP3wrapper();
/* mailbox will be ignored */
- virtual void listMessages(const QString & mailbox, QList<RecMail> &target );
- virtual QValueList<Opie::osmart_pointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, QValueList<Opie::OSmartPointer<RecMail> > &target );
+ virtual QValueList<Opie::OSmartPointer<Folder> >* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
- virtual void deleteMail(const RecMail&mail);
- virtual void answeredMail(const RecMail&mail);
- virtual int deleteAllMail(const Opie::osmart_pointer<Folder>&);
+ virtual void deleteMail(const RecMailP&mail);
+ virtual void answeredMail(const RecMailP&mail);
+ virtual int deleteAllMail(const Opie::OSmartPointer<Folder>&);
- virtual RecBody fetchBody( const RecMail &mail );
- virtual encodedString* fetchRawBody(const RecMail&mail);
+ virtual RecBody fetchBody( const RecMailP &mail );
+ virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index afc5618..86673aa 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -312,7 +312,7 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
return result;
}
-void SMTPwrapper::sendMail(const Opie::osmart_pointer<Mail>&mail,bool later )
+void SMTPwrapper::sendMail(const Opie::OSmartPointer<Mail>&mail,bool later )
{
mailmime * mimeMail;
@@ -332,7 +332,7 @@ void SMTPwrapper::sendMail(const Opie::osmart_pointer<Mail>&mail,bool later )
}
}
-int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,RecMail*which) {
+int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
size_t curTok = 0;
mailimf_fields *fields = 0;
mailimf_field*ffrom = 0;
@@ -340,7 +340,7 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,RecMail*which) {
char*from = 0;
int res = 0;
- encodedString * data = wrap->fetchRawBody(*which);
+ encodedString * data = wrap->fetchRawBody(which);
if (!data)
return 0;
int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
@@ -391,8 +391,8 @@ bool SMTPwrapper::flushOutbox() {
return false;
}
QString oldPw, oldUser;
- QList<RecMail> mailsToSend;
- QList<RecMail> mailsToRemove;
+ QValueList<RecMailP> mailsToSend;
+ QValueList<RecMailP> mailsToRemove;
QString mbox("Outgoing");
wrap->listMessages(mbox,mailsToSend);
if (mailsToSend.count()==0) {
@@ -421,20 +421,19 @@ bool SMTPwrapper::flushOutbox() {
}
- mailsToSend.setAutoDelete(false);
sendProgress = new progressMailSend();
sendProgress->show();
sendProgress->setMaxMails(mailsToSend.count());
while (mailsToSend.count()>0) {
- if (sendQueuedMail(wrap,mailsToSend.at(0))==0) {
+ if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
QMessageBox::critical(0,tr("Error sending mail"),
tr("Error sending queued mail - breaking"));
returnValue = false;
break;
}
- mailsToRemove.append(mailsToSend.at(0));
- mailsToSend.removeFirst();
+ mailsToRemove.append((*mailsToSend.begin()));
+ mailsToSend.remove(mailsToSend.begin());
sendProgress->setCurrentMails(mailsToRemove.count());
}
if (reset_user_value) {
@@ -450,7 +449,6 @@ bool SMTPwrapper::flushOutbox() {
delete sendProgress;
sendProgress = 0;
wrap->deleteMails(mbox,mailsToRemove);
- mailsToSend.setAutoDelete(true);
delete wrap;
return returnValue;
}
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index 08bde74..71ae35c 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -11,7 +11,7 @@
#include "settings.h"
#include "generatemail.h"
-#include <opie2/osmart_pointer.h>
+#include <opie2/osmartpointer.h>
class SMTPaccount;
class AbstractMail;
@@ -23,7 +23,7 @@ class SMTPwrapper : public Generatemail
public:
SMTPwrapper(SMTPaccount * aSmtp);
virtual ~SMTPwrapper();
- void sendMail(const Opie::osmart_pointer<Mail>& mail,bool later=false );
+ void sendMail(const Opie::OSmartPointer<Mail>& mail,bool later=false );
bool flushOutbox();
static progressMailSend*sendProgress;
@@ -50,7 +50,7 @@ protected:
void storeMail(mailmime*mail, const QString&box);
- int sendQueuedMail(AbstractMail*wrap,RecMail*which);
+ int sendQueuedMail(AbstractMail*wrap,const Opie::OSmartPointer<RecMail>&which);
void storeFailedMail(const char*data,unsigned int size, const char*failuremessage);
int m_queuedMail;
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp
index 052e0f1..595e7fc 100644
--- a/noncore/net/mail/libmailwrapper/storemail.cpp
+++ b/noncore/net/mail/libmailwrapper/storemail.cpp
@@ -49,7 +49,7 @@ Storemail::~Storemail()
{
}
-int Storemail::storeMail(const Opie::osmart_pointer<Mail>&mail)
+int Storemail::storeMail(const Opie::OSmartPointer<Mail>&mail)
{
if (!wrapper) return 0;
int ret = 1;
diff --git a/noncore/net/mail/libmailwrapper/storemail.h b/noncore/net/mail/libmailwrapper/storemail.h
index 7d8ea3d..80c7431 100644
--- a/noncore/net/mail/libmailwrapper/storemail.h
+++ b/noncore/net/mail/libmailwrapper/storemail.h
@@ -18,7 +18,7 @@ public:
Storemail(const QString&aFolder);
virtual ~Storemail();
- int storeMail(const Opie::osmart_pointer<Mail>&mail);
+ int storeMail(const Opie::OSmartPointer<Mail>&mail);
protected:
Account* m_Account;
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp
index 75633ef..0b926da 100644
--- a/noncore/net/mail/mailistviewitem.cpp
+++ b/noncore/net/mail/mailistviewitem.cpp
@@ -10,16 +10,16 @@ MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
void MailListViewItem::showEntry()
{
- if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) {
+ if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") );
- } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
+ } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
/* I think it looks nicer if there are not such a log of icons but only on mails
replied or new - Alwin*/
//setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
} else {
setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") );
}
- double s = mail_data.Msgsize();
+ double s = mail_data->Msgsize();
int w;
w=0;
@@ -49,24 +49,24 @@ void MailListViewItem::showEntry()
o << s << " " << q << "Byte";
}
- setText(1,mail_data.getSubject());
- setText(2,mail_data.getFrom());
+ setText(1,mail_data->getSubject());
+ setText(2,mail_data->getFrom());
setText(3,fsize);
- setText(4,mail_data.getDate());
+ setText(4,mail_data->getDate());
}
-void MailListViewItem::storeData(const RecMail&data)
+void MailListViewItem::storeData(const RecMailP&data)
{
mail_data = data;
}
-const RecMail& MailListViewItem::data()const
+const RecMailP& MailListViewItem::data()const
{
return mail_data;
}
MAILLIB::ATYPE MailListViewItem::wrapperType()
{
- if (!mail_data.Wrapper()) return MAILLIB::A_UNDEFINED;
- return mail_data.Wrapper()->getType();
+ if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
+ return mail_data->Wrapper()->getType();
}
diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h
index f736de0..d953d83 100644
--- a/noncore/net/mail/mailistviewitem.h
+++ b/noncore/net/mail/mailistviewitem.h
@@ -11,13 +11,13 @@ public:
MailListViewItem(QListView * parent, MailListViewItem * after );
virtual ~MailListViewItem(){}
- void storeData(const RecMail&data);
- const RecMail&data()const;
+ void storeData(const RecMailP&data);
+ const RecMailP&data()const;
void showEntry();
MAILLIB::ATYPE wrapperType();
protected:
- RecMail mail_data;
+ RecMailP mail_data;
};
#endif
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index bcf0866..c23ad3f 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -119,7 +119,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
- connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
+ connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
+ this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
@@ -177,7 +178,7 @@ void MainWindow::slotShowFolders( bool )
qDebug( "slotShowFolders not reached" );
}
-void MainWindow::refreshMailView(QList<RecMail>*)
+void MainWindow::refreshMailView(const QValueList<RecMailP>&)
{
qDebug( "refreshMailView not reached" );
}
@@ -205,7 +206,7 @@ void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
void MainWindow::slotSendQueued()
{
}
-
+
void MainWindow::slotEditAccounts()
{
}
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 1ba6299..8d004c6 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -11,6 +11,9 @@
#include "accountview.h"
#include "statuswidget.h"
+#include <libmailwrapper/mailtypes.h>
+#include <opie2/osmartpointer.h>
+
class RecMail;
class MainWindow : public QMainWindow
@@ -25,25 +28,25 @@ public slots:
virtual void slotAdjustColumns();
virtual void appMessage(const QCString &msg, const QByteArray &data);
virtual void slotComposeMail();
-
+
protected slots:
virtual void slotSendQueued();
virtual void slotEditAccounts();
virtual void slotShowFolders( bool show );
- virtual void refreshMailView(QList<RecMail>*);
+ virtual void refreshMailView(const QValueList<RecMailP>&);
virtual void displayMail();
virtual void slotDeleteMail();
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotAdjustLayout();
virtual void slotEditSettings();
virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
-
+
protected:
QToolBar *toolBar;
StatusWidget *statusWidget;
QMenuBar *menuBar;
QPopupMenu *mailMenu, *settingsMenu;
- QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
+ QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
*editSettings, *editAccounts, *syncFolders;
AccountView *folderView;
QListView *mailView;
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index d95b3c9..dd305df 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -145,7 +145,7 @@ void OpieMail::displayMail()
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
- RecMail mail = ((MailListViewItem*)item)->data();
+ RecMailP mail = ((MailListViewItem*)item)->data();
RecBody body = folderView->fetchBody(mail);
ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
readMail.setBody( body );
@@ -166,10 +166,10 @@ void OpieMail::displayMail()
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
- RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
- if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
+ RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
+ if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
- mail.Wrapper()->deleteMail( mail );
+ mail->Wrapper()->deleteMail( mail );
folderView->refreshCurrent();
}
}
@@ -217,14 +217,16 @@ void OpieMail::slotShowFolders( bool show )
}
}
-void OpieMail::refreshMailView(QList<RecMail>*list)
+void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
{
MailListViewItem*item = 0;
mailView->clear();
- for (unsigned int i = 0; i < list->count();++i)
+
+ QValueList<RecMailP>::ConstIterator it;
+ for (it = list.begin(); it != list.end();++it)
{
item = new MailListViewItem(mailView,item);
- item->storeData(*(list->at(i)));
+ item->storeData((*it));
item->showEntry();
}
}
@@ -244,7 +246,7 @@ void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int
void OpieMail::slotMoveCopyMail()
{
if (!mailView->currentItem()) return;
- RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
+ RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
@@ -252,7 +254,7 @@ void OpieMail::slotMoveCopyMail()
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
- if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) ||
+ if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
targetFolder.isEmpty())
{
return;
@@ -263,14 +265,14 @@ void OpieMail::slotMoveCopyMail()
tr("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
- mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
+ mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
folderView->refreshCurrent();
}
void OpieMail::reEditMail()
{
if (!mailView->currentItem()) return;
-
+
ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
compose.slotAdjustColumns();
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index 88c7ea1..b93bd60 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -4,6 +4,8 @@
#include "mainwindow.h"
#include <libmailwrapper/settings.h>
+#include <opie2/osmartpointer.h>
+#include <libmailwrapper/mailtypes.h>
class OpieMail : public MainWindow
{
@@ -27,7 +29,7 @@ protected slots:
virtual void slotDeleteMail();
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotShowFolders( bool show );
- virtual void refreshMailView(QList<RecMail>*);
+ virtual void refreshMailView(const QValueList<RecMailP>&);
virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
virtual void slotMoveCopyMail();
virtual void reEditMail();
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 78652d7..894a386 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -225,7 +225,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
if( !str.isEmpty() )
{
- encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
+ encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
if (content)
{
QFile output(str);
@@ -245,9 +245,9 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
}
else
{
- if ( m_recMail.Wrapper() != 0l )
+ if ( m_recMail->Wrapper() != 0l )
{ // make sure that there is a wrapper , even after delete or simular actions
- browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
+ browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
}
}
break;
@@ -256,19 +256,19 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
}
-void ViewMail::setMail( RecMail mail )
+void ViewMail::setMail( RecMailP mail )
{
m_recMail = mail;
- m_mail[0] = mail.getFrom();
- m_mail[1] = mail.getSubject();
- m_mail[3] = mail.getDate();
- m_mail[4] = mail.Msgid();
+ m_mail[0] = mail->getFrom();
+ m_mail[1] = mail->getSubject();
+ m_mail[3] = mail->getDate();
+ m_mail[4] = mail->Msgid();
- m_mail2[0] = mail.To();
- m_mail2[1] = mail.CC();
- m_mail2[2] = mail.Bcc();
+ m_mail2[0] = mail->To();
+ m_mail2[1] = mail->CC();
+ m_mail2[2] = mail->Bcc();
setText();
}
@@ -348,7 +348,7 @@ void ViewMail::setText()
ViewMail::~ViewMail()
{
- m_recMail.Wrapper()->cleanMimeCache();
+ m_recMail->Wrapper()->cleanMimeCache();
hide();
}
@@ -415,18 +415,18 @@ void ViewMail::slotReply()
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
- if (m_recMail.Replyto().isEmpty()) {
- composer.setTo( m_recMail.getFrom());
+ if (m_recMail->Replyto().isEmpty()) {
+ composer.setTo( m_recMail->getFrom());
} else {
- composer.setTo( m_recMail.Replyto());
+ composer.setTo( m_recMail->Replyto());
}
composer.setSubject( prefix + m_mail[1] );
composer.setMessage( rtext );
- composer.setInReplyTo(m_recMail.Msgid());
+ composer.setInReplyTo(m_recMail->Msgid());
if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) )
{
- m_recMail.Wrapper()->answeredMail(m_recMail);
+ m_recMail->Wrapper()->answeredMail(m_recMail);
}
}
@@ -469,7 +469,7 @@ void ViewMail::slotDeleteMail( )
{
if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
- m_recMail.Wrapper()->deleteMail( m_recMail );
+ m_recMail->Wrapper()->deleteMail( m_recMail );
hide();
deleted = true;
}
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index abbd5b3..6875e3c 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -28,40 +28,40 @@ private:
class ViewMail : public ViewMailBase
{
- Q_OBJECT
+ Q_OBJECT
public:
- ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
- ~ViewMail();
+ ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
+ ~ViewMail();
- void hide();
- void exec();
- void setMail( RecMail mail );
+ void hide();
+ void exec();
+ void setMail( RecMailP mail );
void setBody( RecBody body );
bool deleted;
protected:
- QString deHtml(const QString &string);
+ QString deHtml(const QString &string);
AttachItem* searchParent(const QValueList<int>&path);
AttachItem* lastChild(AttachItem*parent);
protected slots:
- void slotReply();
- void slotForward();
+ void slotReply();
+ void slotForward();
void setText();
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
void slotDeleteMail( );
- void slotShowHtml( bool );
+ void slotShowHtml( bool );
private:
- void readConfig();
-
- bool _inLoop;
- QString m_mailHtml;
- bool m_gotBody;
+ void readConfig();
+
+ bool _inLoop;
+ QString m_mailHtml;
+ bool m_gotBody;
RecBody m_body;
- RecMail m_recMail;
- bool m_showHtml;
+ RecMailP m_recMail;
+ bool m_showHtml;
// 0 from 1 subject 2 bodytext 3 date
QMap <int,QString> m_mail;