summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/mailtypes.h
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/mailtypes.h') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index 97f10d7..ac7f8da 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -1,214 +1,214 @@
1#ifndef __MAIL_TYPES_H 1#ifndef __MAIL_TYPES_H
2#define __MAIL_TYPES_H 2#define __MAIL_TYPES_H
3 3
4#define FLAG_ANSWERED 0 4#define FLAG_ANSWERED 0
5#define FLAG_FLAGGED 1 5#define FLAG_FLAGGED 1
6#define FLAG_DELETED 2 6#define FLAG_DELETED 2
7#define FLAG_SEEN 3 7#define FLAG_SEEN 3
8#define FLAG_DRAFT 4 8#define FLAG_DRAFT 4
9#define FLAG_RECENT 5 9#define FLAG_RECENT 5
10 10
11#include <opie2/osmartpointer.h> 11#include <opie2/osmartpointer.h>
12 12
13#include <qbitarray.h> 13#include <qbitarray.h>
14#include <qstring.h> 14#include <qstring.h>
15#include <qstringlist.h> 15#include <qstringlist.h>
16#include <qmap.h> 16#include <qmap.h>
17#include <qvaluelist.h> 17#include <q3valuelist.h>
18 18
19class AbstractMail; 19class AbstractMail;
20/* a class to describe mails in a mailbox */ 20/* a class to describe mails in a mailbox */
21/* Attention! 21/* Attention!
22 From programmers point of view it would make sense to 22 From programmers point of view it would make sense to
23 store the mail body into this class, too. 23 store the mail body into this class, too.
24 But: not from the point of view of the device. 24 But: not from the point of view of the device.
25 Mailbodies can be real large. So we request them when 25 Mailbodies can be real large. So we request them when
26 needed from the mail-wrapper class direct from the server itself 26 needed from the mail-wrapper class direct from the server itself
27 (imap) or from a file-based cache (pop3?) 27 (imap) or from a file-based cache (pop3?)
28 So there is no interface "const QString&body()" but you should 28 So there is no interface "const QString&body()" but you should
29 make a request to the mailwrapper with this class as parameter to 29 make a request to the mailwrapper with this class as parameter to
30 get the body. Same words for the attachments. 30 get the body. Same words for the attachments.
31*/ 31*/
32class RecMail:public Opie::Core::ORefCount 32class RecMail:public Opie::Core::ORefCount
33{ 33{
34public: 34public:
35 RecMail(); 35 RecMail();
36 RecMail(const RecMail&old); 36 RecMail(const RecMail&old);
37 virtual ~RecMail(); 37 virtual ~RecMail();
38 bool isEqual( RecMail* r1 ); 38 bool isEqual( RecMail* r1 );
39 39
40 const unsigned int getNumber()const{return msg_number;} 40 const unsigned int getNumber()const{return msg_number;}
41 void setNumber(unsigned int number){msg_number=number;} 41 void setNumber(unsigned int number){msg_number=number;}
42 const QString&getDate()const{ return date; } 42 const QString&getDate()const{ return date; }
43 void setDate( const QString&a ) { date = a; } 43 void setDate( const QString&a ) { date = a; }
44 const QString&getIsoDate()const{ return isodate; } 44 const QString&getIsoDate()const{ return isodate; }
45 void setIsoDate( const QString&a ) { isodate = a; } 45 void setIsoDate( const QString&a ) { isodate = a; }
46 const QString&getFrom()const{ return from; } 46 const QString&getFrom()const{ return from; }
47 void setFrom( const QString&a ) { from = a; } 47 void setFrom( const QString&a ) { from = a; }
48 const QString&getSubject()const { return subject; } 48 const QString&getSubject()const { return subject; }
49 void setSubject( const QString&s ) { subject = s; } 49 void setSubject( const QString&s ) { subject = s; }
50 const QString&getMbox()const{return mbox;} 50 const QString&getMbox()const{return mbox;}
51 void setMbox(const QString&box){mbox = box;} 51 void setMbox(const QString&box){mbox = box;}
52 void setMsgid(const QString&id){msg_id=id;} 52 void setMsgid(const QString&id){msg_id=id;}
53 const QString&Msgid()const{return msg_id;} 53 const QString&Msgid()const{return msg_id;}
54 void setReplyto(const QString&reply){replyto=reply;} 54 void setReplyto(const QString&reply){replyto=reply;}
55 const QString&Replyto()const{return replyto;} 55 const QString&Replyto()const{return replyto;}
56 void setMsgsize(unsigned int size){msg_size = size;} 56 void setMsgsize(unsigned int size){msg_size = size;}
57 const unsigned int Msgsize()const{return msg_size;} 57 const unsigned int Msgsize()const{return msg_size;}
58 const QString MsgsizeString()const { 58 const QString MsgsizeString()const {
59 double s = msg_size; 59 double s = msg_size;
60 int w = 0; 60 int w = 0;
61 s/=1024; 61 s/=1024;
62 if (s>999.0) { 62 if (s>999.0) {
63 s/=1024.0; 63 s/=1024.0;
64 ++w; 64 ++w;
65 } 65 }
66 QString fsize = QString::number( s, 'f', 2 ); 66 QString fsize = QString::number( s, 'f', 2 );
67 if ( w == 0 ) { 67 if ( w == 0 ) {
68 fsize += "kB" ; 68 fsize += "kB" ;
69 } else 69 } else
70 fsize += "MB" ; 70 fsize += "MB" ;
71 return fsize; 71 return fsize;
72 }; 72 };
73 void setTo(const QStringList&list); 73 void setTo(const QStringList&list);
74 const QStringList&To()const; 74 const QStringList&To()const;
75 void setCC(const QStringList&list); 75 void setCC(const QStringList&list);
76 const QStringList&CC()const; 76 const QStringList&CC()const;
77 void setBcc(const QStringList&list); 77 void setBcc(const QStringList&list);
78 const QStringList&Bcc()const; 78 const QStringList&Bcc()const;
79 void setInreply(const QStringList&list); 79 void setInreply(const QStringList&list);
80 const QStringList&Inreply()const; 80 const QStringList&Inreply()const;
81 void setReferences(const QStringList&list); 81 void setReferences(const QStringList&list);
82 const QStringList&References()const; 82 const QStringList&References()const;
83 83
84 const QBitArray&getFlags()const{return msg_flags;} 84 const QBitArray&getFlags()const{return msg_flags;}
85 void setFlags(const QBitArray&flags){msg_flags = flags;} 85 void setFlags(const QBitArray&flags){msg_flags = flags;}
86 86
87 void setWrapper(AbstractMail*wrapper); 87 void setWrapper(AbstractMail*wrapper);
88 AbstractMail* Wrapper(); 88 AbstractMail* Wrapper();
89 // public for debugging 89 // public for debugging
90 QString subject,date,isodate,from,mbox,msg_id,replyto; 90 QString subject,date,isodate,from,mbox,msg_id,replyto;
91 91
92protected: 92protected:
93 //QString subject,date,isodate,from,mbox,msg_id,replyto; 93 //QString subject,date,isodate,from,mbox,msg_id,replyto;
94 unsigned int msg_number,msg_size; 94 unsigned int msg_number,msg_size;
95 QBitArray msg_flags; 95 QBitArray msg_flags;
96 QStringList to,cc,bcc,in_reply_to,references; 96 QStringList to,cc,bcc,in_reply_to,references;
97 AbstractMail*wrapper; 97 AbstractMail*wrapper;
98 void init(); 98 void init();
99 void copy_old(const RecMail&old); 99 void copy_old(const RecMail&old);
100}; 100};
101 101
102typedef Opie::Core::OSmartPointer<RecMail> RecMailP; 102typedef Opie::Core::OSmartPointer<RecMail> RecMailP;
103typedef QMap<QString,QString> part_plist_t; 103typedef QMap<QString,QString> part_plist_t;
104 104
105class RecPart:public Opie::Core::ORefCount 105class RecPart:public Opie::Core::ORefCount
106{ 106{
107protected: 107protected:
108 QString m_type,m_subtype,m_identifier,m_encoding,m_description; 108 QString m_type,m_subtype,m_identifier,m_encoding,m_description;
109 unsigned int m_lines,m_size; 109 unsigned int m_lines,m_size;
110 part_plist_t m_Parameters; 110 part_plist_t m_Parameters;
111 /* describes the position in the mail */ 111 /* describes the position in the mail */
112 QValueList<int> m_poslist; 112 Q3ValueList<int> m_poslist;
113 113
114public: 114public:
115 RecPart(); 115 RecPart();
116 RecPart(const RecPart&); 116 RecPart(const RecPart&);
117 virtual ~RecPart(); 117 virtual ~RecPart();
118 118
119 const QString&Type()const; 119 const QString&Type()const;
120 void setType(const QString&type); 120 void setType(const QString&type);
121 const QString&Subtype()const; 121 const QString&Subtype()const;
122 void setSubtype(const QString&subtype); 122 void setSubtype(const QString&subtype);
123 const QString&Identifier()const; 123 const QString&Identifier()const;
124 void setIdentifier(const QString&identifier); 124 void setIdentifier(const QString&identifier);
125 const QString&Encoding()const; 125 const QString&Encoding()const;
126 void setEncoding(const QString&encoding); 126 void setEncoding(const QString&encoding);
127 const QString&Description()const; 127 const QString&Description()const;
128 void setDescription(const QString&desc); 128 void setDescription(const QString&desc);
129 void setLines(unsigned int lines); 129 void setLines(unsigned int lines);
130 const unsigned int Lines()const; 130 const unsigned int Lines()const;
131 void setSize(unsigned int size); 131 void setSize(unsigned int size);
132 const unsigned int Size()const; 132 const unsigned int Size()const;
133 133
134 134
135 void setParameters(const part_plist_t&list); 135 void setParameters(const part_plist_t&list);
136 const part_plist_t&Parameters()const; 136 const part_plist_t&Parameters()const;
137 void addParameter(const QString&key,const QString&value); 137 void addParameter(const QString&key,const QString&value);
138 const QString searchParamter(const QString&key)const; 138 const QString searchParamter(const QString&key)const;
139 void setPositionlist(const QValueList<int>&poslist); 139 void setPositionlist(const Q3ValueList<int>&poslist);
140 const QValueList<int>& Positionlist()const; 140 const Q3ValueList<int>& Positionlist()const;
141}; 141};
142 142
143typedef Opie::Core::OSmartPointer<RecPart> RecPartP; 143typedef Opie::Core::OSmartPointer<RecPart> RecPartP;
144 144
145class RecBody:public Opie::Core::ORefCount 145class RecBody:public Opie::Core::ORefCount
146{ 146{
147protected: 147protected:
148 QString m_BodyText; 148 QString m_BodyText;
149 QString mCharset; 149 QString mCharset;
150 QValueList<RecPartP> m_PartsList; 150 Q3ValueList<RecPartP> m_PartsList;
151 RecPartP m_description; 151 RecPartP m_description;
152 152
153public: 153public:
154 RecBody(); 154 RecBody();
155 RecBody(const RecBody&old); 155 RecBody(const RecBody&old);
156 virtual ~RecBody(); 156 virtual ~RecBody();
157 void setBodytext(const QString&); 157 void setBodytext(const QString&);
158 const QString& Bodytext()const; 158 const QString& Bodytext()const;
159 void setCharset(const QString&); 159 void setCharset(const QString&);
160 QString getCharset()const; 160 QString getCharset()const;
161 161
162 void setDescription(const RecPartP&des); 162 void setDescription(const RecPartP&des);
163 const RecPartP& Description()const; 163 const RecPartP& Description()const;
164 164
165 void setParts(const QValueList<RecPartP>&parts); 165 void setParts(const Q3ValueList<RecPartP>&parts);
166 const QValueList<RecPartP>& Parts()const; 166 const Q3ValueList<RecPartP>& Parts()const;
167 void addPart(const RecPartP&part); 167 void addPart(const RecPartP&part);
168}; 168};
169 169
170typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; 170typedef Opie::Core::OSmartPointer<RecBody> RecBodyP;
171 171
172class encodedString 172class encodedString
173{ 173{
174public: 174public:
175 encodedString(); 175 encodedString();
176 /* 176 /*
177 creates an new content string. 177 creates an new content string.
178 it makes a deep copy of it! 178 it makes a deep copy of it!
179 */ 179 */
180 encodedString(const char*nContent,unsigned int length); 180 encodedString(const char*nContent,unsigned int length);
181 /* 181 /*
182 Take over the nContent. Means: it will just copy the pointer, not the content. 182 Take over the nContent. Means: it will just copy the pointer, not the content.
183 so make sure: No one else frees the string, the string has allocated with 183 so make sure: No one else frees the string, the string has allocated with
184 malloc for compatibility with c-based libs 184 malloc for compatibility with c-based libs
185 */ 185 */
186 encodedString(char*nContent,unsigned int nSize); 186 encodedString(char*nContent,unsigned int nSize);
187 /* copy construkor - makes ALWAYS a deep copy!!!! */ 187 /* copy construkor - makes ALWAYS a deep copy!!!! */
188 encodedString(const encodedString&old); 188 encodedString(const encodedString&old);
189 /* assign operator - makes ALWAYS a deep copy!!!! */ 189 /* assign operator - makes ALWAYS a deep copy!!!! */
190 encodedString& operator=(const encodedString&old); 190 encodedString& operator=(const encodedString&old);
191 /* destructor - cleans the content */ 191 /* destructor - cleans the content */
192 virtual ~encodedString(); 192 virtual ~encodedString();
193 193
194 /* returns a pointer to the content - do not delete yoursel! */ 194 /* returns a pointer to the content - do not delete yoursel! */
195 const char*Content()const; 195 const char*Content()const;
196 /* returns the lengths of the content 'cause it must not be a null-terminated string! */ 196 /* returns the lengths of the content 'cause it must not be a null-terminated string! */
197 const int Length()const; 197 const int Length()const;
198 198
199 /* 199 /*
200 makes a deep copy of nContent! 200 makes a deep copy of nContent!
201 */ 201 */
202 void setContent(const char*nContent,int nSize); 202 void setContent(const char*nContent,int nSize);
203 /* 203 /*
204 Take over the nContent. Means: it will just copy the pointer, not the content. 204 Take over the nContent. Means: it will just copy the pointer, not the content.
205 so make sure: No one else frees the string, the string has allocated with 205 so make sure: No one else frees the string, the string has allocated with
206 malloc for compatibility with c-based libs 206 malloc for compatibility with c-based libs
207 */ 207 */
208 void setContent(char*nContent,int nSize); 208 void setContent(char*nContent,int nSize);
209 209
210protected: 210protected:
211 char * content; 211 char * content;
212 unsigned int size; 212 unsigned int size;
213 213
214 void init(); 214 void init();