-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 17 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.cpp | 17 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.h | 7 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 1 |
8 files changed, 50 insertions, 2 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index e5eb335..3222c7e 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp @@ -126,16 +126,17 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) int i = 0; for (current = clist_begin(result); current != 0; current=clist_next(current)) { ++i; msg_att = (mailimap_msg_att*)current->data; RecMail*m = parse_list_result(msg_att); if (m) { m->setNumber(i); m->setMbox(mailbox); + m->setWrapper(this); target.append(m); } } } else { qDebug("Error fetching headers: %s",m_imap->imap_response); } mailimap_fetch_list_free(result); } diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index e5eb335..3222c7e 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp @@ -126,16 +126,17 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) int i = 0; for (current = clist_begin(result); current != 0; current=clist_next(current)) { ++i; msg_att = (mailimap_msg_att*)current->data; RecMail*m = parse_list_result(msg_att); if (m) { m->setNumber(i); m->setMbox(mailbox); + m->setWrapper(this); target.append(m); } } } else { qDebug("Error fetching headers: %s",m_imap->imap_response); } mailimap_fetch_list_free(result); } diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index 5cd45ed..94f5d6f 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp @@ -10,36 +10,53 @@ RecMail::RecMail() RecMail::RecMail(const RecMail&old) :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) { init(); copy_old(old); qDebug("Copy constructor RecMail"); } +RecMail::~RecMail() +{ + wrapper = 0; +} + void RecMail::copy_old(const RecMail&old) { subject = old.subject; date = old.date; mbox = old.mbox; msg_id = old.msg_id; msg_size = old.msg_size; msg_number = old.msg_number; from = old.from; msg_flags = old.msg_flags; to = old.to; cc = old.cc; bcc = old.bcc; + wrapper = old.wrapper; } void RecMail::init() { to.clear(); cc.clear(); bcc.clear(); + wrapper = 0; +} + +void RecMail::setWrapper(AbstractMail*awrapper) +{ + wrapper = awrapper; +} + +AbstractMail* RecMail::Wrapper() +{ + return wrapper; } void RecMail::setTo(const QStringList&list) { to = list; } const QStringList&RecMail::To()const diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index 24518cf..9ef762d 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h @@ -10,16 +10,17 @@ #include <qlist.h> #include <qbitarray.h> #include <qstring.h> #include <qstringlist.h> #include <qmap.h> #include <qvaluelist.h> +class AbstractMail; /* a class to describe mails in a mailbox */ /* Attention! From programmers point of view it would make sense to store the mail body into this class, too. But: not from the point of view of the device. Mailbodies can be real large. So we request them when needed from the mail-wrapper class direct from the server itself (imap) or from a file-based cache (pop3?) @@ -27,17 +28,17 @@ make a request to the mailwrapper with this class as parameter to get the body. Same words for the attachments. */ class RecMail { public: RecMail(); RecMail(const RecMail&old); - virtual ~RecMail(){} + virtual ~RecMail(); const int getNumber()const{return msg_number;} void setNumber(int number){msg_number=number;} const QString&getDate()const{ return date; } void setDate( const QString&a ) { date = a; } const QString&getFrom()const{ return from; } void setFrom( const QString&a ) { from = a; } const QString&getSubject()const { return subject; } @@ -55,22 +56,26 @@ public: void setTo(const QStringList&list); const QStringList&To()const; void setCC(const QStringList&list); const QStringList&CC()const; void setBcc(const QStringList&list); const QStringList&Bcc()const; const QBitArray&getFlags()const{return msg_flags;} void setFlags(const QBitArray&flags){msg_flags = flags;} + + void setWrapper(AbstractMail*wrapper); + AbstractMail* Wrapper(); protected: QString subject,date,from,mbox,msg_id,replyto; int msg_number,msg_size; QBitArray msg_flags; QStringList to,cc,bcc; + AbstractMail*wrapper; void init(); void copy_old(const RecMail&old); }; typedef QMap<QString,QString> part_plist_t; class RecPart { diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 49c3b7a..903ef4d 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp @@ -76,16 +76,17 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) err = mailpop3_header( m_pop3, info->msg_index, &header, &length ); if ( err != MAILPOP3_NO_ERROR ) { qDebug( "POP3: error retrieving header msgid: %i", info->msg_index ); logout(); return; } RecMail *mail = parseHeader( header ); mail->setNumber( info->msg_index ); + mail->setWrapper(this); target.append( mail ); } logout(); } RecMail *POP3wrapper::parseHeader( const char *header ) { diff --git a/noncore/net/mail/mailtypes.cpp b/noncore/net/mail/mailtypes.cpp index 5cd45ed..94f5d6f 100644 --- a/noncore/net/mail/mailtypes.cpp +++ b/noncore/net/mail/mailtypes.cpp @@ -10,36 +10,53 @@ RecMail::RecMail() RecMail::RecMail(const RecMail&old) :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) { init(); copy_old(old); qDebug("Copy constructor RecMail"); } +RecMail::~RecMail() +{ + wrapper = 0; +} + void RecMail::copy_old(const RecMail&old) { subject = old.subject; date = old.date; mbox = old.mbox; msg_id = old.msg_id; msg_size = old.msg_size; msg_number = old.msg_number; from = old.from; msg_flags = old.msg_flags; to = old.to; cc = old.cc; bcc = old.bcc; + wrapper = old.wrapper; } void RecMail::init() { to.clear(); cc.clear(); bcc.clear(); + wrapper = 0; +} + +void RecMail::setWrapper(AbstractMail*awrapper) +{ + wrapper = awrapper; +} + +AbstractMail* RecMail::Wrapper() +{ + return wrapper; } void RecMail::setTo(const QStringList&list) { to = list; } const QStringList&RecMail::To()const diff --git a/noncore/net/mail/mailtypes.h b/noncore/net/mail/mailtypes.h index 24518cf..9ef762d 100644 --- a/noncore/net/mail/mailtypes.h +++ b/noncore/net/mail/mailtypes.h @@ -10,16 +10,17 @@ #include <qlist.h> #include <qbitarray.h> #include <qstring.h> #include <qstringlist.h> #include <qmap.h> #include <qvaluelist.h> +class AbstractMail; /* a class to describe mails in a mailbox */ /* Attention! From programmers point of view it would make sense to store the mail body into this class, too. But: not from the point of view of the device. Mailbodies can be real large. So we request them when needed from the mail-wrapper class direct from the server itself (imap) or from a file-based cache (pop3?) @@ -27,17 +28,17 @@ make a request to the mailwrapper with this class as parameter to get the body. Same words for the attachments. */ class RecMail { public: RecMail(); RecMail(const RecMail&old); - virtual ~RecMail(){} + virtual ~RecMail(); const int getNumber()const{return msg_number;} void setNumber(int number){msg_number=number;} const QString&getDate()const{ return date; } void setDate( const QString&a ) { date = a; } const QString&getFrom()const{ return from; } void setFrom( const QString&a ) { from = a; } const QString&getSubject()const { return subject; } @@ -55,22 +56,26 @@ public: void setTo(const QStringList&list); const QStringList&To()const; void setCC(const QStringList&list); const QStringList&CC()const; void setBcc(const QStringList&list); const QStringList&Bcc()const; const QBitArray&getFlags()const{return msg_flags;} void setFlags(const QBitArray&flags){msg_flags = flags;} + + void setWrapper(AbstractMail*wrapper); + AbstractMail* Wrapper(); protected: QString subject,date,from,mbox,msg_id,replyto; int msg_number,msg_size; QBitArray msg_flags; QStringList to,cc,bcc; + AbstractMail*wrapper; void init(); void copy_old(const RecMail&old); }; typedef QMap<QString,QString> part_plist_t; class RecPart { diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index 49c3b7a..903ef4d 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp @@ -76,16 +76,17 @@ void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) err = mailpop3_header( m_pop3, info->msg_index, &header, &length ); if ( err != MAILPOP3_NO_ERROR ) { qDebug( "POP3: error retrieving header msgid: %i", info->msg_index ); logout(); return; } RecMail *mail = parseHeader( header ); mail->setNumber( info->msg_index ); + mail->setWrapper(this); target.append( mail ); } logout(); } RecMail *POP3wrapper::parseHeader( const char *header ) { |