summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp18
-rw-r--r--noncore/net/mail/accountview.h19
-rw-r--r--noncore/net/mail/imapwrapper.cpp12
-rw-r--r--noncore/net/mail/imapwrapper.h7
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp12
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h7
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp129
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h98
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp12
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.h54
-rw-r--r--noncore/net/mail/mail.pro7
-rw-r--r--noncore/net/mail/mailistviewitem.h21
-rw-r--r--noncore/net/mail/mailtypes.cpp129
-rw-r--r--noncore/net/mail/mailtypes.h98
-rw-r--r--noncore/net/mail/mailwrapper.cpp12
-rw-r--r--noncore/net/mail/mailwrapper.h54
-rw-r--r--noncore/net/mail/mainwindow.cpp34
-rw-r--r--noncore/net/mail/mainwindow.h19
18 files changed, 551 insertions, 191 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 1bde886..df9fc11 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -2,2 +2,3 @@
#include "imapwrapper.h"
+#include "mailtypes.h"
#include "defines.h"
@@ -24,3 +25,3 @@ IMAPwrapper *IMAPviewItem::getWrapper()
-void IMAPviewItem::refresh(Maillist&)
+void IMAPviewItem::refresh(QList<RecMail>&)
{
@@ -41,2 +42,6 @@ void IMAPviewItem::refresh(Maillist&)
+RecBody IMAPviewItem::fetchBody(const RecMail&)
+{
+ return RecBody();
+}
@@ -56,3 +61,3 @@ IMAPfolderItem::IMAPfolderItem( IMAPFolder *folderInit, IMAPviewItem *parent )
-void IMAPfolderItem::refresh(Maillist&target)
+void IMAPfolderItem::refresh(QList<RecMail>&target)
{
@@ -61,3 +66,3 @@ void IMAPfolderItem::refresh(Maillist&target)
-QString IMAPfolderItem::fetchBody(const RecMail&aMail)
+RecBody IMAPfolderItem::fetchBody(const RecMail&aMail)
{
@@ -90,3 +95,3 @@ void AccountView::refresh(QListViewItem *item) {
if ( item ) {
- Maillist headerlist;
+ QList<RecMail> headerlist;
headerlist.setAutoDelete(true);
@@ -103,7 +108,6 @@ void AccountView::refreshAll()
-QString AccountView::fetchBody(const RecMail&aMail)
+RecBody AccountView::fetchBody(const RecMail&aMail)
{
- QString Body;
QListViewItem*item = selectedItem ();
- if (!item) return Body;
+ if (!item) return RecBody();
AccountViewItem *view = static_cast<AccountViewItem *>(item);
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 2bc8023..805c2b3 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -4,2 +4,3 @@
#include <qlistview.h>
+#include <qlist.h>
@@ -9,2 +10,4 @@
class IMAPwrapper;
+class RecMail;
+class RecBody;
@@ -16,4 +19,4 @@ public:
AccountViewItem( QListViewItem *parent ) : QListViewItem( parent ) {}
- virtual void refresh(Maillist&)=0;
- virtual QString fetchBody(const RecMail&)=0;
+ virtual void refresh(QList<RecMail>&)=0;
+ virtual RecBody fetchBody(const RecMail&)=0;
};
@@ -26,4 +29,4 @@ public:
~IMAPviewItem();
- virtual void refresh(Maillist&);
- virtual QString fetchBody(const RecMail&){return "";}
+ virtual void refresh(QList<RecMail>&);
+ virtual RecBody fetchBody(const RecMail&);
IMAPwrapper *getWrapper();
@@ -42,4 +45,4 @@ public:
~IMAPfolderItem();
- virtual void refresh(Maillist&);
- virtual QString fetchBody(const RecMail&);
+ virtual void refresh(QList<RecMail>&);
+ virtual RecBody fetchBody(const RecMail&);
@@ -58,3 +61,3 @@ public:
void populate( QList<Account> list );
- QString fetchBody(const RecMail&aMail);
+ RecBody fetchBody(const RecMail&aMail);
@@ -65,3 +68,3 @@ public slots:
signals:
- void refreshMailview(Maillist*);
+ void refreshMailview(QList<RecMail>*);
};
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index 1acc036..725dcc9 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -4,2 +4,3 @@
#include "imapwrapper.h"
+#include "mailtypes.h"
#include <libetpan/mailimap.h>
@@ -66,3 +67,3 @@ void IMAPwrapper::logout()
-void IMAPwrapper::listMessages(const QString&mailbox,Maillist&target )
+void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
{
@@ -331,5 +332,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
#if 1
-QString IMAPwrapper::fetchBody(const RecMail&mail)
+RecBody IMAPwrapper::fetchBody(const RecMail&mail)
{
- QString body = "";
+ RecBody body;
+ QString body_text;
+
const char *mb;
@@ -370,3 +373,4 @@ QString IMAPwrapper::fetchBody(const RecMail&mail)
if (item->msg_att_static && item->msg_att_static->rfc822_text) {
- body = item->msg_att_static->rfc822_text;
+ body_text = item->msg_att_static->rfc822_text;
+ body.setBodytext(body_text);
}
diff --git a/noncore/net/mail/imapwrapper.h b/noncore/net/mail/imapwrapper.h
index b02d26d..1423faf 100644
--- a/noncore/net/mail/imapwrapper.h
+++ b/noncore/net/mail/imapwrapper.h
@@ -3,2 +3,3 @@
+#include <qlist.h>
#include "mailwrapper.h"
@@ -7,2 +8,4 @@ struct mailimap;
struct mailimap_body_type_1part;
+class RecMail;
+class RecBody;
@@ -16,4 +19,4 @@ public:
QList<IMAPFolder>* listFolders();
- void listMessages(const QString & mailbox,Maillist&target );
- QString fetchBody(const RecMail&mail);
+ void listMessages(const QString & mailbox,QList<RecMail>&target );
+ RecBody fetchBody(const RecMail&mail);
static void imap_progress( size_t current, size_t maximum );
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 1acc036..725dcc9 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -4,2 +4,3 @@
#include "imapwrapper.h"
+#include "mailtypes.h"
#include <libetpan/mailimap.h>
@@ -66,3 +67,3 @@ void IMAPwrapper::logout()
-void IMAPwrapper::listMessages(const QString&mailbox,Maillist&target )
+void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
{
@@ -331,5 +332,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
#if 1
-QString IMAPwrapper::fetchBody(const RecMail&mail)
+RecBody IMAPwrapper::fetchBody(const RecMail&mail)
{
- QString body = "";
+ RecBody body;
+ QString body_text;
+
const char *mb;
@@ -370,3 +373,4 @@ QString IMAPwrapper::fetchBody(const RecMail&mail)
if (item->msg_att_static && item->msg_att_static->rfc822_text) {
- body = item->msg_att_static->rfc822_text;
+ body_text = item->msg_att_static->rfc822_text;
+ body.setBodytext(body_text);
}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index b02d26d..1423faf 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -3,2 +3,3 @@
+#include <qlist.h>
#include "mailwrapper.h"
@@ -7,2 +8,4 @@ struct mailimap;
struct mailimap_body_type_1part;
+class RecMail;
+class RecBody;
@@ -16,4 +19,4 @@ public:
QList<IMAPFolder>* listFolders();
- void listMessages(const QString & mailbox,Maillist&target );
- QString fetchBody(const RecMail&mail);
+ void listMessages(const QString & mailbox,QList<RecMail>&target );
+ RecBody fetchBody(const RecMail&mail);
static void imap_progress( size_t current, size_t maximum );
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
new file mode 100644
index 0000000..9f2c9e3
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -0,0 +1,129 @@
+#include "mailtypes.h"
+
+
+RecMail::RecMail()
+ :subject(""),date(""),mbox(""),msg_number(0),msg_flags(7)
+{
+}
+
+void RecMail::setTo(const QStringList&list)
+{
+ to = list;
+}
+
+const QStringList&RecMail::To()const
+{
+ return to;
+}
+
+void RecMail::setCC(const QStringList&list)
+{
+ cc = list;
+}
+
+const QStringList&RecMail::CC()const
+{
+ return cc;
+}
+
+void RecMail::setBcc(const QStringList&list)
+{
+ bcc = list;
+}
+
+const QStringList& RecMail::Bcc()const
+{
+ return bcc;
+}
+
+
+RecPart::RecPart()
+ : m_type(""),m_subtype(""),m_identifier(""),m_encoding("")
+{
+}
+
+RecPart::RecPart(const QString&identifier,const QString&type,const QString&subtype,const QString&encoding)
+ : m_type(type),m_subtype(subtype),m_identifier(identifier),m_encoding(encoding)
+{
+}
+
+RecPart::~RecPart()
+{
+}
+
+const QString& RecPart::Type()const
+{
+ return m_type;
+}
+
+void RecPart::setType(const QString&type)
+{
+ m_type = type;
+}
+
+const QString& RecPart::Subtype()const
+{
+ return m_subtype;
+}
+
+void RecPart::setSubtype(const QString&subtype)
+{
+ m_subtype = subtype;
+}
+
+const QString& RecPart::Identifier()const
+{
+ return m_identifier;
+}
+
+void RecPart::setIdentifier(const QString&identifier)
+{
+ m_identifier = identifier;
+}
+
+const QString& RecPart::Encoding()const
+{
+ return m_encoding;
+}
+
+void RecPart::setEncoding(const QString&encoding)
+{
+ m_encoding = encoding;
+}
+
+RecBody::RecBody()
+ : m_BodyText(""),m_PartsList()
+{
+ m_PartsList.setAutoDelete(true);
+}
+
+RecBody::~RecBody()
+{
+}
+
+void RecBody::setBodytext(const QString&bodyText)
+{
+ m_BodyText = bodyText;
+}
+
+const QString& RecBody::Bodytext()const
+{
+ return m_BodyText;
+}
+
+void RecBody::setParts(const QList<RecPart>&parts)
+{
+ m_PartsList = parts;
+ m_PartsList.setAutoDelete(true);
+}
+
+const QList<RecPart>& RecBody::Parts()const
+{
+ return m_PartsList;
+}
+
+void RecBody::addPart(const RecPart& part)
+{
+ RecPart*p = new RecPart(part);
+ m_PartsList.append(p);
+}
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h
new file mode 100644
index 0000000..bb6a483
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/mailtypes.h
@@ -0,0 +1,98 @@
+#ifndef __MAIL_TYPES_H
+#define __MAIL_TYPES_H
+
+#define FLAG_ANSWERED 0
+#define FLAG_FLAGGED 1
+#define FLAG_DELETED 2
+#define FLAG_SEEN 3
+#define FLAG_DRAFT 4
+#define FLAG_RECENT 5
+
+#include <qlist.h>
+#include <qbitarray.h>
+#include <qstring.h>
+#include <qstringlist.h>
+
+/* 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?)
+ So there is no interface "const QString&body()" but you should
+ make a request to the mailwrapper with this class as parameter to
+ get the body. Same words for the attachments.
+*/
+class RecMail
+{
+public:
+ 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; }
+ void setSubject( const QString&s ) { subject = s; }
+ const QString&getMbox()const{return mbox;}
+ void setMbox(const QString&box){mbox = box;}
+
+ 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;}
+
+protected:
+ QString subject,date,from,mbox;
+ int msg_number;
+ QBitArray msg_flags;
+ QStringList to,cc,bcc;
+};
+
+class RecPart
+{
+protected:
+ QString m_type,m_subtype,m_identifier,m_encoding;
+public:
+ RecPart();
+ RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64");
+ virtual ~RecPart();
+
+ const QString&Type()const;
+ void setType(const QString&type);
+ const QString&Subtype()const;
+ void setSubtype(const QString&subtype);
+ const QString&Identifier()const;
+ void setIdentifier(const QString&identifier);
+ const QString&Encoding()const;
+ void setEncoding(const QString&encoding);
+};
+
+class RecBody
+{
+protected:
+ QString m_BodyText;
+ QList<RecPart> m_PartsList;
+
+public:
+ RecBody();
+ virtual ~RecBody();
+ void setBodytext(const QString&);
+ const QString& Bodytext()const;
+
+ void setParts(const QList<RecPart>&parts);
+ const QList<RecPart>& Parts()const;
+ void addPart(const RecPart&part);
+};
+
+#endif
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
index 7f67cd8..898e9d6 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp
@@ -629,13 +629 @@ Mail::Mail()
}
-
-RecMail::RecMail()
- :subject(""),date(""),mbox(""),msg_number(0),msg_flags(7)
-{
-}
-
-#if 0
-void RecMail::setDate(const QString&aDate)
-{
- mDate = QDateTime::fromString(aDate);
-}
-#endif
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h
index 332034f..34fd5c5 100644
--- a/noncore/net/mail/libmailwrapper/mailwrapper.h
+++ b/noncore/net/mail/libmailwrapper/mailwrapper.h
@@ -33,56 +33,2 @@ protected:
-#define FLAG_ANSWERED 0
-#define FLAG_FLAGGED 1
-#define FLAG_DELETED 2
-#define FLAG_SEEN 3
-#define FLAG_DRAFT 4
-#define FLAG_RECENT 5
-
-/* 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?)
- So there is no interface "const QString&body()" but you should
- make a request to the mailwrapper with this class as parameter to
- get the body. Same words for the attachments.
-*/
-class RecMail
-{
-public:
- 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; }
- void setSubject( const QString&s ) { subject = s; }
- const QString&getMbox()const{return mbox;}
- void setMbox(const QString&box){mbox = box;}
- const QBitArray&getFlags()const{return msg_flags;}
- void setFlags(const QBitArray&flags){msg_flags = flags;}
-
-#if 0
- void setDate(const QString&dstring);
- void setDate(const QDateTime&date){mDate = date;}
- QString getDate()const{return mDate.toString();}
-#endif
-protected:
- QString subject,date,from,mbox;
- int msg_number;
- QBitArray msg_flags;
-#if 0
- QDateTime mDate;
-#endif
-};
-
-typedef QList<RecMail> Maillist;
-
class Mail
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index 3ae1ddc..55d95ba 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -13,3 +13,5 @@ HEADERS = defines.h \
opiemail.h \
- imapwrapper.h
+ imapwrapper.h \
+ mailtypes.h \
+ mailistviewitem.h
@@ -27,3 +29,4 @@ SOURCES = main.cpp \
viewmailbase.cpp \
- settings.cpp
+ settings.cpp \
+ mailtypes.cpp
diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h
new file mode 100644
index 0000000..60bfdda
--- a/dev/null
+++ b/noncore/net/mail/mailistviewitem.h
@@ -0,0 +1,21 @@
+#ifndef __MAILLISTVIEWITEM_H
+#define __MAILLISTVIEWITEM_H
+
+#include <qlistview.h>
+#include "mailtypes.h"
+
+class MailListViewItem:public QListViewItem
+{
+public:
+ MailListViewItem(QListView * parent, MailListViewItem * after );
+ virtual ~MailListViewItem(){}
+
+ void storeData(const RecMail&data);
+ const RecMail&data()const;
+ void showEntry();
+
+protected:
+ RecMail mail_data;
+};
+
+#endif
diff --git a/noncore/net/mail/mailtypes.cpp b/noncore/net/mail/mailtypes.cpp
new file mode 100644
index 0000000..9f2c9e3
--- a/dev/null
+++ b/noncore/net/mail/mailtypes.cpp
@@ -0,0 +1,129 @@
+#include "mailtypes.h"
+
+
+RecMail::RecMail()
+ :subject(""),date(""),mbox(""),msg_number(0),msg_flags(7)
+{
+}
+
+void RecMail::setTo(const QStringList&list)
+{
+ to = list;
+}
+
+const QStringList&RecMail::To()const
+{
+ return to;
+}
+
+void RecMail::setCC(const QStringList&list)
+{
+ cc = list;
+}
+
+const QStringList&RecMail::CC()const
+{
+ return cc;
+}
+
+void RecMail::setBcc(const QStringList&list)
+{
+ bcc = list;
+}
+
+const QStringList& RecMail::Bcc()const
+{
+ return bcc;
+}
+
+
+RecPart::RecPart()
+ : m_type(""),m_subtype(""),m_identifier(""),m_encoding("")
+{
+}
+
+RecPart::RecPart(const QString&identifier,const QString&type,const QString&subtype,const QString&encoding)
+ : m_type(type),m_subtype(subtype),m_identifier(identifier),m_encoding(encoding)
+{
+}
+
+RecPart::~RecPart()
+{
+}
+
+const QString& RecPart::Type()const
+{
+ return m_type;
+}
+
+void RecPart::setType(const QString&type)
+{
+ m_type = type;
+}
+
+const QString& RecPart::Subtype()const
+{
+ return m_subtype;
+}
+
+void RecPart::setSubtype(const QString&subtype)
+{
+ m_subtype = subtype;
+}
+
+const QString& RecPart::Identifier()const
+{
+ return m_identifier;
+}
+
+void RecPart::setIdentifier(const QString&identifier)
+{
+ m_identifier = identifier;
+}
+
+const QString& RecPart::Encoding()const
+{
+ return m_encoding;
+}
+
+void RecPart::setEncoding(const QString&encoding)
+{
+ m_encoding = encoding;
+}
+
+RecBody::RecBody()
+ : m_BodyText(""),m_PartsList()
+{
+ m_PartsList.setAutoDelete(true);
+}
+
+RecBody::~RecBody()
+{
+}
+
+void RecBody::setBodytext(const QString&bodyText)
+{
+ m_BodyText = bodyText;
+}
+
+const QString& RecBody::Bodytext()const
+{
+ return m_BodyText;
+}
+
+void RecBody::setParts(const QList<RecPart>&parts)
+{
+ m_PartsList = parts;
+ m_PartsList.setAutoDelete(true);
+}
+
+const QList<RecPart>& RecBody::Parts()const
+{
+ return m_PartsList;
+}
+
+void RecBody::addPart(const RecPart& part)
+{
+ RecPart*p = new RecPart(part);
+ m_PartsList.append(p);
+}
diff --git a/noncore/net/mail/mailtypes.h b/noncore/net/mail/mailtypes.h
new file mode 100644
index 0000000..bb6a483
--- a/dev/null
+++ b/noncore/net/mail/mailtypes.h
@@ -0,0 +1,98 @@
+#ifndef __MAIL_TYPES_H
+#define __MAIL_TYPES_H
+
+#define FLAG_ANSWERED 0
+#define FLAG_FLAGGED 1
+#define FLAG_DELETED 2
+#define FLAG_SEEN 3
+#define FLAG_DRAFT 4
+#define FLAG_RECENT 5
+
+#include <qlist.h>
+#include <qbitarray.h>
+#include <qstring.h>
+#include <qstringlist.h>
+
+/* 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?)
+ So there is no interface "const QString&body()" but you should
+ make a request to the mailwrapper with this class as parameter to
+ get the body. Same words for the attachments.
+*/
+class RecMail
+{
+public:
+ 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; }
+ void setSubject( const QString&s ) { subject = s; }
+ const QString&getMbox()const{return mbox;}
+ void setMbox(const QString&box){mbox = box;}
+
+ 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;}
+
+protected:
+ QString subject,date,from,mbox;
+ int msg_number;
+ QBitArray msg_flags;
+ QStringList to,cc,bcc;
+};
+
+class RecPart
+{
+protected:
+ QString m_type,m_subtype,m_identifier,m_encoding;
+public:
+ RecPart();
+ RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64");
+ virtual ~RecPart();
+
+ const QString&Type()const;
+ void setType(const QString&type);
+ const QString&Subtype()const;
+ void setSubtype(const QString&subtype);
+ const QString&Identifier()const;
+ void setIdentifier(const QString&identifier);
+ const QString&Encoding()const;
+ void setEncoding(const QString&encoding);
+};
+
+class RecBody
+{
+protected:
+ QString m_BodyText;
+ QList<RecPart> m_PartsList;
+
+public:
+ RecBody();
+ virtual ~RecBody();
+ void setBodytext(const QString&);
+ const QString& Bodytext()const;
+
+ void setParts(const QList<RecPart>&parts);
+ const QList<RecPart>& Parts()const;
+ void addPart(const RecPart&part);
+};
+
+#endif
diff --git a/noncore/net/mail/mailwrapper.cpp b/noncore/net/mail/mailwrapper.cpp
index 7f67cd8..898e9d6 100644
--- a/noncore/net/mail/mailwrapper.cpp
+++ b/noncore/net/mail/mailwrapper.cpp
@@ -629,13 +629 @@ Mail::Mail()
}
-
-RecMail::RecMail()
- :subject(""),date(""),mbox(""),msg_number(0),msg_flags(7)
-{
-}
-
-#if 0
-void RecMail::setDate(const QString&aDate)
-{
- mDate = QDateTime::fromString(aDate);
-}
-#endif
diff --git a/noncore/net/mail/mailwrapper.h b/noncore/net/mail/mailwrapper.h
index 332034f..34fd5c5 100644
--- a/noncore/net/mail/mailwrapper.h
+++ b/noncore/net/mail/mailwrapper.h
@@ -33,56 +33,2 @@ protected:
-#define FLAG_ANSWERED 0
-#define FLAG_FLAGGED 1
-#define FLAG_DELETED 2
-#define FLAG_SEEN 3
-#define FLAG_DRAFT 4
-#define FLAG_RECENT 5
-
-/* 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?)
- So there is no interface "const QString&body()" but you should
- make a request to the mailwrapper with this class as parameter to
- get the body. Same words for the attachments.
-*/
-class RecMail
-{
-public:
- 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; }
- void setSubject( const QString&s ) { subject = s; }
- const QString&getMbox()const{return mbox;}
- void setMbox(const QString&box){mbox = box;}
- const QBitArray&getFlags()const{return msg_flags;}
- void setFlags(const QBitArray&flags){msg_flags = flags;}
-
-#if 0
- void setDate(const QString&dstring);
- void setDate(const QDateTime&date){mDate = date;}
- QString getDate()const{return mDate.toString();}
-#endif
-protected:
- QString subject,date,from,mbox;
- int msg_number;
- QBitArray msg_flags;
-#if 0
- QDateTime mDate;
-#endif
-};
-
-typedef QList<RecMail> Maillist;
-
class Mail
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 7af7d83..b25db97 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -11,2 +11,4 @@
#include "viewmail.h"
+#include "mailtypes.h"
+#include "mailistviewitem.h"
@@ -102,3 +104,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
- connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*)));
+ connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
@@ -131,3 +133,3 @@ void MainWindow::slotShowFolders( bool show )
-void MainWindow::refreshMailView(Maillist*list)
+void MainWindow::refreshMailView(QList<RecMail>*list)
{
@@ -135,6 +137,2 @@ void MainWindow::refreshMailView(Maillist*list)
mailView->clear();
-#if 0
- QFont f = mailView->getFont();
- QFont bf = f;
-#endif
for (unsigned int i = 0; i < list->count();++i) {
@@ -143,7 +141,2 @@ void MainWindow::refreshMailView(Maillist*list)
item->showEntry();
-#if 0
- if (!list->at(i)->getFlags().testBit(FLAG_SEEN)) {
- item->setFont(bf);
- }
-#endif
}
@@ -155,10 +148,13 @@ void MainWindow::displayMail(QListViewItem*item)
RecMail mail = ((MailListViewItem*)item)->data();
- QString body = folderView->fetchBody(mail);
+ RecBody body = folderView->fetchBody(mail);
ViewMail readMail( this );
- readMail.setMailInfo( mail.getFrom(), "", mail.getSubject(), "", "", body );
+ readMail.setMailInfo( mail.getFrom(), "", mail.getSubject(), "", "", body.Bodytext() );
readMail.showMaximized();
readMail.exec();
+}
- qDebug(body );
+MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * after )
+ :QListViewItem(parent,after),mail_data()
+{
}
@@ -171 +167,11 @@ void MailListViewItem::showEntry()
}
+
+void MailListViewItem::storeData(const RecMail&data)
+{
+ mail_data = data;
+}
+
+const RecMail& MailListViewItem::data()const
+{
+ return mail_data;
+}
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index a5142ab..6c87261 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -12,2 +12,4 @@
+class RecMail;
+
class MainWindow : public QMainWindow
@@ -24,3 +26,3 @@ protected slots:
virtual void slotShowFolders( bool show );
- virtual void refreshMailView(Maillist*);
+ virtual void refreshMailView(QList<RecMail>*);
virtual void displayMail(QListViewItem*);
@@ -38,17 +40,2 @@ protected:
-class MailListViewItem:public QListViewItem
-{
-public:
- MailListViewItem(QListView * parent, MailListViewItem * after )
- :QListViewItem(parent,after),mail_data(){}
- virtual ~MailListViewItem(){}
-
- void storeData(const RecMail&data){mail_data = data;}
- const RecMail&data()const{return mail_data;}
- void showEntry();
-
-protected:
- RecMail mail_data;
-};
-
#endif