summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-09 16:59:57 (UTC)
committer alwin <alwin>2003-12-09 16:59:57 (UTC)
commit1999708f1480dbdd19e73671fbd9e422883839b6 (patch) (unidiff)
tree633887e98f12d63455faa5065c0f6a3cc0fb290d
parentc6b105a7bf2bfffa847fd84c422ae9a3850c682f (diff)
downloadopie-1999708f1480dbdd19e73671fbd9e422883839b6.zip
opie-1999708f1480dbdd19e73671fbd9e422883839b6.tar.gz
opie-1999708f1480dbdd19e73671fbd9e422883839b6.tar.bz2
some interface changes
split class defines into more files
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 @@
2#include "imapwrapper.h" 2#include "imapwrapper.h"
3#include "mailtypes.h"
3#include "defines.h" 4#include "defines.h"
@@ -24,3 +25,3 @@ IMAPwrapper *IMAPviewItem::getWrapper()
24 25
25void IMAPviewItem::refresh(Maillist&) 26void IMAPviewItem::refresh(QList<RecMail>&)
26{ 27{
@@ -41,2 +42,6 @@ void IMAPviewItem::refresh(Maillist&)
41 42
43RecBody IMAPviewItem::fetchBody(const RecMail&)
44{
45 return RecBody();
46}
42 47
@@ -56,3 +61,3 @@ IMAPfolderItem::IMAPfolderItem( IMAPFolder *folderInit, IMAPviewItem *parent )
56 61
57void IMAPfolderItem::refresh(Maillist&target) 62void IMAPfolderItem::refresh(QList<RecMail>&target)
58{ 63{
@@ -61,3 +66,3 @@ void IMAPfolderItem::refresh(Maillist&target)
61 66
62QString IMAPfolderItem::fetchBody(const RecMail&aMail) 67RecBody IMAPfolderItem::fetchBody(const RecMail&aMail)
63{ 68{
@@ -90,3 +95,3 @@ void AccountView::refresh(QListViewItem *item) {
90 if ( item ) { 95 if ( item ) {
91 Maillist headerlist; 96 QList<RecMail> headerlist;
92 headerlist.setAutoDelete(true); 97 headerlist.setAutoDelete(true);
@@ -103,7 +108,6 @@ void AccountView::refreshAll()
103 108
104QString AccountView::fetchBody(const RecMail&aMail) 109RecBody AccountView::fetchBody(const RecMail&aMail)
105{ 110{
106 QString Body;
107 QListViewItem*item = selectedItem (); 111 QListViewItem*item = selectedItem ();
108 if (!item) return Body; 112 if (!item) return RecBody();
109 AccountViewItem *view = static_cast<AccountViewItem *>(item); 113 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 @@
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qlist.h>
5 6
@@ -9,2 +10,4 @@
9class IMAPwrapper; 10class IMAPwrapper;
11class RecMail;
12class RecBody;
10 13
@@ -16,4 +19,4 @@ public:
16 AccountViewItem( QListViewItem *parent ) : QListViewItem( parent ) {} 19 AccountViewItem( QListViewItem *parent ) : QListViewItem( parent ) {}
17 virtual void refresh(Maillist&)=0; 20 virtual void refresh(QList<RecMail>&)=0;
18 virtual QString fetchBody(const RecMail&)=0; 21 virtual RecBody fetchBody(const RecMail&)=0;
19}; 22};
@@ -26,4 +29,4 @@ public:
26 ~IMAPviewItem(); 29 ~IMAPviewItem();
27 virtual void refresh(Maillist&); 30 virtual void refresh(QList<RecMail>&);
28 virtual QString fetchBody(const RecMail&){return "";} 31 virtual RecBody fetchBody(const RecMail&);
29 IMAPwrapper *getWrapper(); 32 IMAPwrapper *getWrapper();
@@ -42,4 +45,4 @@ public:
42 ~IMAPfolderItem(); 45 ~IMAPfolderItem();
43 virtual void refresh(Maillist&); 46 virtual void refresh(QList<RecMail>&);
44 virtual QString fetchBody(const RecMail&); 47 virtual RecBody fetchBody(const RecMail&);
45 48
@@ -58,3 +61,3 @@ public:
58 void populate( QList<Account> list ); 61 void populate( QList<Account> list );
59 QString fetchBody(const RecMail&aMail); 62 RecBody fetchBody(const RecMail&aMail);
60 63
@@ -65,3 +68,3 @@ public slots:
65signals: 68signals:
66 void refreshMailview(Maillist*); 69 void refreshMailview(QList<RecMail>*);
67}; 70};
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 @@
4#include "imapwrapper.h" 4#include "imapwrapper.h"
5#include "mailtypes.h"
5#include <libetpan/mailimap.h> 6#include <libetpan/mailimap.h>
@@ -66,3 +67,3 @@ void IMAPwrapper::logout()
66 67
67void IMAPwrapper::listMessages(const QString&mailbox,Maillist&target ) 68void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
68{ 69{
@@ -331,5 +332,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
331#if 1 332#if 1
332QString IMAPwrapper::fetchBody(const RecMail&mail) 333RecBody IMAPwrapper::fetchBody(const RecMail&mail)
333{ 334{
334 QString body = ""; 335 RecBody body;
336 QString body_text;
337
335 const char *mb; 338 const char *mb;
@@ -370,3 +373,4 @@ QString IMAPwrapper::fetchBody(const RecMail&mail)
370 if (item->msg_att_static && item->msg_att_static->rfc822_text) { 373 if (item->msg_att_static && item->msg_att_static->rfc822_text) {
371 body = item->msg_att_static->rfc822_text; 374 body_text = item->msg_att_static->rfc822_text;
375 body.setBodytext(body_text);
372 } 376 }
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 @@
3 3
4#include <qlist.h>
4#include "mailwrapper.h" 5#include "mailwrapper.h"
@@ -7,2 +8,4 @@ struct mailimap;
7struct mailimap_body_type_1part; 8struct mailimap_body_type_1part;
9class RecMail;
10class RecBody;
8 11
@@ -16,4 +19,4 @@ public:
16 QList<IMAPFolder>* listFolders(); 19 QList<IMAPFolder>* listFolders();
17 void listMessages(const QString & mailbox,Maillist&target ); 20 void listMessages(const QString & mailbox,QList<RecMail>&target );
18 QString fetchBody(const RecMail&mail); 21 RecBody fetchBody(const RecMail&mail);
19 static void imap_progress( size_t current, size_t maximum ); 22 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 @@
4#include "imapwrapper.h" 4#include "imapwrapper.h"
5#include "mailtypes.h"
5#include <libetpan/mailimap.h> 6#include <libetpan/mailimap.h>
@@ -66,3 +67,3 @@ void IMAPwrapper::logout()
66 67
67void IMAPwrapper::listMessages(const QString&mailbox,Maillist&target ) 68void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
68{ 69{
@@ -331,5 +332,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
331#if 1 332#if 1
332QString IMAPwrapper::fetchBody(const RecMail&mail) 333RecBody IMAPwrapper::fetchBody(const RecMail&mail)
333{ 334{
334 QString body = ""; 335 RecBody body;
336 QString body_text;
337
335 const char *mb; 338 const char *mb;
@@ -370,3 +373,4 @@ QString IMAPwrapper::fetchBody(const RecMail&mail)
370 if (item->msg_att_static && item->msg_att_static->rfc822_text) { 373 if (item->msg_att_static && item->msg_att_static->rfc822_text) {
371 body = item->msg_att_static->rfc822_text; 374 body_text = item->msg_att_static->rfc822_text;
375 body.setBodytext(body_text);
372 } 376 }
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 @@
3 3
4#include <qlist.h>
4#include "mailwrapper.h" 5#include "mailwrapper.h"
@@ -7,2 +8,4 @@ struct mailimap;
7struct mailimap_body_type_1part; 8struct mailimap_body_type_1part;
9class RecMail;
10class RecBody;
8 11
@@ -16,4 +19,4 @@ public:
16 QList<IMAPFolder>* listFolders(); 19 QList<IMAPFolder>* listFolders();
17 void listMessages(const QString & mailbox,Maillist&target ); 20 void listMessages(const QString & mailbox,QList<RecMail>&target );
18 QString fetchBody(const RecMail&mail); 21 RecBody fetchBody(const RecMail&mail);
19 static void imap_progress( size_t current, size_t maximum ); 22 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 @@
1#include "mailtypes.h"
2
3
4RecMail::RecMail()
5 :subject(""),date(""),mbox(""),msg_number(0),msg_flags(7)
6{
7}
8
9void RecMail::setTo(const QStringList&list)
10{
11 to = list;
12}
13
14const QStringList&RecMail::To()const
15{
16 return to;
17}
18
19void RecMail::setCC(const QStringList&list)
20{
21 cc = list;
22}
23
24const QStringList&RecMail::CC()const
25{
26 return cc;
27}
28
29void RecMail::setBcc(const QStringList&list)
30{
31 bcc = list;
32}
33
34const QStringList& RecMail::Bcc()const
35{
36 return bcc;
37}
38
39
40RecPart::RecPart()
41 : m_type(""),m_subtype(""),m_identifier(""),m_encoding("")
42{
43}
44
45RecPart::RecPart(const QString&identifier,const QString&type,const QString&subtype,const QString&encoding)
46 : m_type(type),m_subtype(subtype),m_identifier(identifier),m_encoding(encoding)
47{
48}
49
50RecPart::~RecPart()
51{
52}
53
54const QString& RecPart::Type()const
55{
56 return m_type;
57}
58
59void RecPart::setType(const QString&type)
60{
61 m_type = type;
62}
63
64const QString& RecPart::Subtype()const
65{
66 return m_subtype;
67}
68
69void RecPart::setSubtype(const QString&subtype)
70{
71 m_subtype = subtype;
72}
73
74const QString& RecPart::Identifier()const
75{
76 return m_identifier;
77}
78
79void RecPart::setIdentifier(const QString&identifier)
80{
81 m_identifier = identifier;
82}
83
84const QString& RecPart::Encoding()const
85{
86 return m_encoding;
87}
88
89void RecPart::setEncoding(const QString&encoding)
90{
91 m_encoding = encoding;
92}
93
94RecBody::RecBody()
95 : m_BodyText(""),m_PartsList()
96{
97 m_PartsList.setAutoDelete(true);
98}
99
100RecBody::~RecBody()
101{
102}
103
104void RecBody::setBodytext(const QString&bodyText)
105{
106 m_BodyText = bodyText;
107}
108
109const QString& RecBody::Bodytext()const
110{
111 return m_BodyText;
112}
113
114void RecBody::setParts(const QList<RecPart>&parts)
115{
116 m_PartsList = parts;
117 m_PartsList.setAutoDelete(true);
118}
119
120const QList<RecPart>& RecBody::Parts()const
121{
122 return m_PartsList;
123}
124
125void RecBody::addPart(const RecPart& part)
126{
127 RecPart*p = new RecPart(part);
128 m_PartsList.append(p);
129}
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 @@
1#ifndef __MAIL_TYPES_H
2#define __MAIL_TYPES_H
3
4#define FLAG_ANSWERED 0
5#define FLAG_FLAGGED 1
6#define FLAG_DELETED 2
7#define FLAG_SEEN 3
8#define FLAG_DRAFT 4
9#define FLAG_RECENT 5
10
11#include <qlist.h>
12#include <qbitarray.h>
13#include <qstring.h>
14#include <qstringlist.h>
15
16/* a class to describe mails in a mailbox */
17/* Attention!
18 From programmers point of view it would make sense to
19 store the mail body into this class, too.
20 But: not from the point of view of the device.
21 Mailbodies can be real large. So we request them when
22 needed from the mail-wrapper class direct from the server itself
23 (imap) or from a file-based cache (pop3?)
24 So there is no interface "const QString&body()" but you should
25 make a request to the mailwrapper with this class as parameter to
26 get the body. Same words for the attachments.
27*/
28class RecMail
29{
30public:
31 RecMail();
32 virtual ~RecMail(){}
33
34 const int getNumber()const{return msg_number;}
35 void setNumber(int number){msg_number=number;}
36 const QString&getDate()const{ return date; }
37 void setDate( const QString&a ) { date = a; }
38 const QString&getFrom()const{ return from; }
39 void setFrom( const QString&a ) { from = a; }
40 const QString&getSubject()const { return subject; }
41 void setSubject( const QString&s ) { subject = s; }
42 const QString&getMbox()const{return mbox;}
43 void setMbox(const QString&box){mbox = box;}
44
45 void setTo(const QStringList&list);
46 const QStringList&To()const;
47 void setCC(const QStringList&list);
48 const QStringList&CC()const;
49 void setBcc(const QStringList&list);
50 const QStringList&Bcc()const;
51
52 const QBitArray&getFlags()const{return msg_flags;}
53 void setFlags(const QBitArray&flags){msg_flags = flags;}
54
55protected:
56 QString subject,date,from,mbox;
57 int msg_number;
58 QBitArray msg_flags;
59 QStringList to,cc,bcc;
60};
61
62class RecPart
63{
64protected:
65 QString m_type,m_subtype,m_identifier,m_encoding;
66public:
67 RecPart();
68 RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64");
69 virtual ~RecPart();
70
71 const QString&Type()const;
72 void setType(const QString&type);
73 const QString&Subtype()const;
74 void setSubtype(const QString&subtype);
75 const QString&Identifier()const;
76 void setIdentifier(const QString&identifier);
77 const QString&Encoding()const;
78 void setEncoding(const QString&encoding);
79};
80
81class RecBody
82{
83protected:
84 QString m_BodyText;
85 QList<RecPart> m_PartsList;
86
87public:
88 RecBody();
89 virtual ~RecBody();
90 void setBodytext(const QString&);
91 const QString& Bodytext()const;
92
93 void setParts(const QList<RecPart>&parts);
94 const QList<RecPart>& Parts()const;
95 void addPart(const RecPart&part);
96};
97
98#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()
629} }
630
631RecMail::RecMail()
632 :subject(""),date(""),mbox(""),msg_number(0),msg_flags(7)
633{
634}
635
636#if 0
637void RecMail::setDate(const QString&aDate)
638{
639 mDate = QDateTime::fromString(aDate);
640}
641#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:
33 33
34#define FLAG_ANSWERED 0
35#define FLAG_FLAGGED 1
36#define FLAG_DELETED 2
37#define FLAG_SEEN 3
38#define FLAG_DRAFT 4
39#define FLAG_RECENT 5
40
41/* a class to describe mails in a mailbox */
42/* Attention!
43 From programmers point of view it would make sense to
44 store the mail body into this class, too.
45 But: not from the point of view of the device.
46 Mailbodies can be real large. So we request them when
47 needed from the mail-wrapper class direct from the server itself
48 (imap) or from a file-based cache (pop3?)
49 So there is no interface "const QString&body()" but you should
50 make a request to the mailwrapper with this class as parameter to
51 get the body. Same words for the attachments.
52*/
53class RecMail
54{
55public:
56 RecMail();
57 virtual ~RecMail(){}
58
59 const int getNumber()const{return msg_number;}
60 void setNumber(int number){msg_number=number;}
61 const QString&getDate()const{ return date; }
62 void setDate( const QString&a ) { date = a; }
63 const QString&getFrom()const{ return from; }
64 void setFrom( const QString&a ) { from = a; }
65 const QString&getSubject()const { return subject; }
66 void setSubject( const QString&s ) { subject = s; }
67 const QString&getMbox()const{return mbox;}
68 void setMbox(const QString&box){mbox = box;}
69 const QBitArray&getFlags()const{return msg_flags;}
70 void setFlags(const QBitArray&flags){msg_flags = flags;}
71
72#if 0
73 void setDate(const QString&dstring);
74 void setDate(const QDateTime&date){mDate = date;}
75 QString getDate()const{return mDate.toString();}
76#endif
77protected:
78 QString subject,date,from,mbox;
79 int msg_number;
80 QBitArray msg_flags;
81#if 0
82 QDateTime mDate;
83#endif
84};
85
86typedef QList<RecMail> Maillist;
87
88class Mail 34class 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 \
13 opiemail.h \ 13 opiemail.h \
14 imapwrapper.h 14 imapwrapper.h \
15 mailtypes.h \
16 mailistviewitem.h
15 17
@@ -27,3 +29,4 @@ SOURCES = main.cpp \
27 viewmailbase.cpp \ 29 viewmailbase.cpp \
28 settings.cpp 30 settings.cpp \
31 mailtypes.cpp
29 32
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 @@
1#ifndef __MAILLISTVIEWITEM_H
2#define __MAILLISTVIEWITEM_H
3
4#include <qlistview.h>
5#include "mailtypes.h"
6
7class MailListViewItem:public QListViewItem
8{
9public:
10 MailListViewItem(QListView * parent, MailListViewItem * after );
11 virtual ~MailListViewItem(){}
12
13 void storeData(const RecMail&data);
14 const RecMail&data()const;
15 void showEntry();
16
17protected:
18 RecMail mail_data;
19};
20
21#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 @@
1#include "mailtypes.h"
2
3
4RecMail::RecMail()
5 :subject(""),date(""),mbox(""),msg_number(0),msg_flags(7)
6{
7}
8
9void RecMail::setTo(const QStringList&list)
10{
11 to = list;
12}
13
14const QStringList&RecMail::To()const
15{
16 return to;
17}
18
19void RecMail::setCC(const QStringList&list)
20{
21 cc = list;
22}
23
24const QStringList&RecMail::CC()const
25{
26 return cc;
27}
28
29void RecMail::setBcc(const QStringList&list)
30{
31 bcc = list;
32}
33
34const QStringList& RecMail::Bcc()const
35{
36 return bcc;
37}
38
39
40RecPart::RecPart()
41 : m_type(""),m_subtype(""),m_identifier(""),m_encoding("")
42{
43}
44
45RecPart::RecPart(const QString&identifier,const QString&type,const QString&subtype,const QString&encoding)
46 : m_type(type),m_subtype(subtype),m_identifier(identifier),m_encoding(encoding)
47{
48}
49
50RecPart::~RecPart()
51{
52}
53
54const QString& RecPart::Type()const
55{
56 return m_type;
57}
58
59void RecPart::setType(const QString&type)
60{
61 m_type = type;
62}
63
64const QString& RecPart::Subtype()const
65{
66 return m_subtype;
67}
68
69void RecPart::setSubtype(const QString&subtype)
70{
71 m_subtype = subtype;
72}
73
74const QString& RecPart::Identifier()const
75{
76 return m_identifier;
77}
78
79void RecPart::setIdentifier(const QString&identifier)
80{
81 m_identifier = identifier;
82}
83
84const QString& RecPart::Encoding()const
85{
86 return m_encoding;
87}
88
89void RecPart::setEncoding(const QString&encoding)
90{
91 m_encoding = encoding;
92}
93
94RecBody::RecBody()
95 : m_BodyText(""),m_PartsList()
96{
97 m_PartsList.setAutoDelete(true);
98}
99
100RecBody::~RecBody()
101{
102}
103
104void RecBody::setBodytext(const QString&bodyText)
105{
106 m_BodyText = bodyText;
107}
108
109const QString& RecBody::Bodytext()const
110{
111 return m_BodyText;
112}
113
114void RecBody::setParts(const QList<RecPart>&parts)
115{
116 m_PartsList = parts;
117 m_PartsList.setAutoDelete(true);
118}
119
120const QList<RecPart>& RecBody::Parts()const
121{
122 return m_PartsList;
123}
124
125void RecBody::addPart(const RecPart& part)
126{
127 RecPart*p = new RecPart(part);
128 m_PartsList.append(p);
129}
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 @@
1#ifndef __MAIL_TYPES_H
2#define __MAIL_TYPES_H
3
4#define FLAG_ANSWERED 0
5#define FLAG_FLAGGED 1
6#define FLAG_DELETED 2
7#define FLAG_SEEN 3
8#define FLAG_DRAFT 4
9#define FLAG_RECENT 5
10
11#include <qlist.h>
12#include <qbitarray.h>
13#include <qstring.h>
14#include <qstringlist.h>
15
16/* a class to describe mails in a mailbox */
17/* Attention!
18 From programmers point of view it would make sense to
19 store the mail body into this class, too.
20 But: not from the point of view of the device.
21 Mailbodies can be real large. So we request them when
22 needed from the mail-wrapper class direct from the server itself
23 (imap) or from a file-based cache (pop3?)
24 So there is no interface "const QString&body()" but you should
25 make a request to the mailwrapper with this class as parameter to
26 get the body. Same words for the attachments.
27*/
28class RecMail
29{
30public:
31 RecMail();
32 virtual ~RecMail(){}
33
34 const int getNumber()const{return msg_number;}
35 void setNumber(int number){msg_number=number;}
36 const QString&getDate()const{ return date; }
37 void setDate( const QString&a ) { date = a; }
38 const QString&getFrom()const{ return from; }
39 void setFrom( const QString&a ) { from = a; }
40 const QString&getSubject()const { return subject; }
41 void setSubject( const QString&s ) { subject = s; }
42 const QString&getMbox()const{return mbox;}
43 void setMbox(const QString&box){mbox = box;}
44
45 void setTo(const QStringList&list);
46 const QStringList&To()const;
47 void setCC(const QStringList&list);
48 const QStringList&CC()const;
49 void setBcc(const QStringList&list);
50 const QStringList&Bcc()const;
51
52 const QBitArray&getFlags()const{return msg_flags;}
53 void setFlags(const QBitArray&flags){msg_flags = flags;}
54
55protected:
56 QString subject,date,from,mbox;
57 int msg_number;
58 QBitArray msg_flags;
59 QStringList to,cc,bcc;
60};
61
62class RecPart
63{
64protected:
65 QString m_type,m_subtype,m_identifier,m_encoding;
66public:
67 RecPart();
68 RecPart(const QString&identifier,const QString&type="",const QString&subtype="",const QString&encoding="BASE64");
69 virtual ~RecPart();
70
71 const QString&Type()const;
72 void setType(const QString&type);
73 const QString&Subtype()const;
74 void setSubtype(const QString&subtype);
75 const QString&Identifier()const;
76 void setIdentifier(const QString&identifier);
77 const QString&Encoding()const;
78 void setEncoding(const QString&encoding);
79};
80
81class RecBody
82{
83protected:
84 QString m_BodyText;
85 QList<RecPart> m_PartsList;
86
87public:
88 RecBody();
89 virtual ~RecBody();
90 void setBodytext(const QString&);
91 const QString& Bodytext()const;
92
93 void setParts(const QList<RecPart>&parts);
94 const QList<RecPart>& Parts()const;
95 void addPart(const RecPart&part);
96};
97
98#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()
629} }
630
631RecMail::RecMail()
632 :subject(""),date(""),mbox(""),msg_number(0),msg_flags(7)
633{
634}
635
636#if 0
637void RecMail::setDate(const QString&aDate)
638{
639 mDate = QDateTime::fromString(aDate);
640}
641#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:
33 33
34#define FLAG_ANSWERED 0
35#define FLAG_FLAGGED 1
36#define FLAG_DELETED 2
37#define FLAG_SEEN 3
38#define FLAG_DRAFT 4
39#define FLAG_RECENT 5
40
41/* a class to describe mails in a mailbox */
42/* Attention!
43 From programmers point of view it would make sense to
44 store the mail body into this class, too.
45 But: not from the point of view of the device.
46 Mailbodies can be real large. So we request them when
47 needed from the mail-wrapper class direct from the server itself
48 (imap) or from a file-based cache (pop3?)
49 So there is no interface "const QString&body()" but you should
50 make a request to the mailwrapper with this class as parameter to
51 get the body. Same words for the attachments.
52*/
53class RecMail
54{
55public:
56 RecMail();
57 virtual ~RecMail(){}
58
59 const int getNumber()const{return msg_number;}
60 void setNumber(int number){msg_number=number;}
61 const QString&getDate()const{ return date; }
62 void setDate( const QString&a ) { date = a; }
63 const QString&getFrom()const{ return from; }
64 void setFrom( const QString&a ) { from = a; }
65 const QString&getSubject()const { return subject; }
66 void setSubject( const QString&s ) { subject = s; }
67 const QString&getMbox()const{return mbox;}
68 void setMbox(const QString&box){mbox = box;}
69 const QBitArray&getFlags()const{return msg_flags;}
70 void setFlags(const QBitArray&flags){msg_flags = flags;}
71
72#if 0
73 void setDate(const QString&dstring);
74 void setDate(const QDateTime&date){mDate = date;}
75 QString getDate()const{return mDate.toString();}
76#endif
77protected:
78 QString subject,date,from,mbox;
79 int msg_number;
80 QBitArray msg_flags;
81#if 0
82 QDateTime mDate;
83#endif
84};
85
86typedef QList<RecMail> Maillist;
87
88class Mail 34class 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 @@
11#include "viewmail.h" 11#include "viewmail.h"
12#include "mailtypes.h"
13#include "mailistviewitem.h"
12 14
@@ -102,3 +104,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
102 104
103 connect(folderView,SIGNAL(refreshMailview(Maillist*)),this,SLOT(refreshMailView(Maillist*))); 105 connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
104 106
@@ -131,3 +133,3 @@ void MainWindow::slotShowFolders( bool show )
131 133
132void MainWindow::refreshMailView(Maillist*list) 134void MainWindow::refreshMailView(QList<RecMail>*list)
133{ 135{
@@ -135,6 +137,2 @@ void MainWindow::refreshMailView(Maillist*list)
135 mailView->clear(); 137 mailView->clear();
136#if 0
137 QFont f = mailView->getFont();
138 QFont bf = f;
139#endif
140 for (unsigned int i = 0; i < list->count();++i) { 138 for (unsigned int i = 0; i < list->count();++i) {
@@ -143,7 +141,2 @@ void MainWindow::refreshMailView(Maillist*list)
143 item->showEntry(); 141 item->showEntry();
144#if 0
145 if (!list->at(i)->getFlags().testBit(FLAG_SEEN)) {
146 item->setFont(bf);
147 }
148#endif
149 } 142 }
@@ -155,10 +148,13 @@ void MainWindow::displayMail(QListViewItem*item)
155 RecMail mail = ((MailListViewItem*)item)->data(); 148 RecMail mail = ((MailListViewItem*)item)->data();
156 QString body = folderView->fetchBody(mail); 149 RecBody body = folderView->fetchBody(mail);
157 150
158 ViewMail readMail( this ); 151 ViewMail readMail( this );
159 readMail.setMailInfo( mail.getFrom(), "", mail.getSubject(), "", "", body ); 152 readMail.setMailInfo( mail.getFrom(), "", mail.getSubject(), "", "", body.Bodytext() );
160 readMail.showMaximized(); 153 readMail.showMaximized();
161 readMail.exec(); 154 readMail.exec();
155}
162 156
163 qDebug(body ); 157MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * after )
158 :QListViewItem(parent,after),mail_data()
159{
164} 160}
@@ -171 +167,11 @@ void MailListViewItem::showEntry()
171} 167}
168
169void MailListViewItem::storeData(const RecMail&data)
170{
171 mail_data = data;
172}
173
174const RecMail& MailListViewItem::data()const
175{
176 return mail_data;
177}
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 @@
12 12
13class RecMail;
14
13class MainWindow : public QMainWindow 15class MainWindow : public QMainWindow
@@ -24,3 +26,3 @@ protected slots:
24 virtual void slotShowFolders( bool show ); 26 virtual void slotShowFolders( bool show );
25 virtual void refreshMailView(Maillist*); 27 virtual void refreshMailView(QList<RecMail>*);
26 virtual void displayMail(QListViewItem*); 28 virtual void displayMail(QListViewItem*);
@@ -38,17 +40,2 @@ protected:
38 40
39class MailListViewItem:public QListViewItem
40{
41public:
42 MailListViewItem(QListView * parent, MailListViewItem * after )
43 :QListViewItem(parent,after),mail_data(){}
44 virtual ~MailListViewItem(){}
45
46 void storeData(const RecMail&data){mail_data = data;}
47 const RecMail&data()const{return mail_data;}
48 void showEntry();
49
50protected:
51 RecMail mail_data;
52};
53
54#endif 41#endif