author | zautrix <zautrix> | 2005-01-24 18:05:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-24 18:05:48 (UTC) |
commit | 77f93c632b66b5c8d92e4c63330362272ca1fc40 (patch) (unidiff) | |
tree | 31f28656062c899b5368f13ab594ff6fa5c657fa /kmicromail/libmailwrapper | |
parent | 6c89efd80c1e94a0c070025d07c7a4c656f2a81e (diff) | |
download | kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.zip kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.gz kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.bz2 |
mail fixes
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 17 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index 89150ad..96d55e6 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp | |||
@@ -1,224 +1,241 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | 2 | ||
3 | //#include <opie2/odebug.h> | 3 | //#include <opie2/odebug.h> |
4 | 4 | ||
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | 6 | ||
7 | using namespace Opie::Core; | 7 | using namespace Opie::Core; |
8 | RecMail::RecMail() | 8 | RecMail::RecMail() |
9 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 9 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
10 | { | 10 | { |
11 | init(); | 11 | init(); |
12 | } | 12 | } |
13 | 13 | ||
14 | RecMail::RecMail(const RecMail&old) | 14 | RecMail::RecMail(const RecMail&old) |
15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) |
16 | { | 16 | { |
17 | init(); | 17 | init(); |
18 | copy_old(old); | 18 | copy_old(old); |
19 | // odebug << "Copy constructor RecMail" << oendl; | 19 | // odebug << "Copy constructor RecMail" << oendl; |
20 | } | 20 | } |
21 | 21 | ||
22 | RecMail::~RecMail() | 22 | RecMail::~RecMail() |
23 | { | 23 | { |
24 | wrapper = 0; | 24 | wrapper = 0; |
25 | } | 25 | } |
26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) | 26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) |
27 | { | 27 | { |
28 | if ( s1.isEmpty() && s2.isEmpty() ) | 28 | if ( s1.isEmpty() && s2.isEmpty() ) |
29 | return true; | 29 | return true; |
30 | return s1 == s2; | 30 | return s1 == s2; |
31 | } | 31 | } |
32 | 32 | ||
33 | const QString RecMail::MsgsizeString() const | ||
34 | { | ||
35 | |||
36 | double s = msg_size; | ||
37 | int w = 0; | ||
38 | s/=1024; | ||
39 | if (s>999.0) { | ||
40 | s/=1024.0; | ||
41 | ++w; | ||
42 | } | ||
43 | QString fsize = QString::number( s, 'f', 2 ); | ||
44 | if ( w == 0 ) { | ||
45 | fsize += "kB" ; | ||
46 | } else | ||
47 | fsize += "MB" ; | ||
48 | return fsize; | ||
49 | } | ||
33 | bool RecMail::isEqual( RecMail* r1 ) | 50 | bool RecMail::isEqual( RecMail* r1 ) |
34 | { | 51 | { |
35 | if ( !stringCompareRec( isodate, r1->isodate ) ) { | 52 | if ( !stringCompareRec( isodate, r1->isodate ) ) { |
36 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); | 53 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); |
37 | return false; | 54 | return false; |
38 | } | 55 | } |
39 | if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { | 56 | if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { |
40 | //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); | 57 | //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); |
41 | return false; | 58 | return false; |
42 | } | 59 | } |
43 | 60 | ||
44 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); | 61 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); |
45 | if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { | 62 | if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { |
46 | if ( r1->from.find ( from ) < 0 ) { | 63 | if ( r1->from.find ( from ) < 0 ) { |
47 | if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { | 64 | if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { |
48 | //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); | 65 | //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); |
49 | return false; | 66 | return false; |
50 | } | 67 | } |
51 | } | 68 | } |
52 | } | 69 | } |
53 | 70 | ||
54 | return true; | 71 | return true; |
55 | } | 72 | } |
56 | void RecMail::copy_old(const RecMail&old) | 73 | void RecMail::copy_old(const RecMail&old) |
57 | { | 74 | { |
58 | subject = old.subject; | 75 | subject = old.subject; |
59 | date = old.date; | 76 | date = old.date; |
60 | mbox = old.mbox; | 77 | mbox = old.mbox; |
61 | msg_id = old.msg_id; | 78 | msg_id = old.msg_id; |
62 | msg_size = old.msg_size; | 79 | msg_size = old.msg_size; |
63 | msg_number = old.msg_number; | 80 | msg_number = old.msg_number; |
64 | from = old.from; | 81 | from = old.from; |
65 | msg_flags = old.msg_flags; | 82 | msg_flags = old.msg_flags; |
66 | to = old.to; | 83 | to = old.to; |
67 | cc = old.cc; | 84 | cc = old.cc; |
68 | bcc = old.bcc; | 85 | bcc = old.bcc; |
69 | wrapper = old.wrapper; | 86 | wrapper = old.wrapper; |
70 | in_reply_to = old.in_reply_to; | 87 | in_reply_to = old.in_reply_to; |
71 | references = old.references; | 88 | references = old.references; |
72 | replyto = old.replyto; | 89 | replyto = old.replyto; |
73 | } | 90 | } |
74 | 91 | ||
75 | void RecMail::init() | 92 | void RecMail::init() |
76 | { | 93 | { |
77 | to.clear(); | 94 | to.clear(); |
78 | cc.clear(); | 95 | cc.clear(); |
79 | bcc.clear(); | 96 | bcc.clear(); |
80 | in_reply_to.clear(); | 97 | in_reply_to.clear(); |
81 | references.clear(); | 98 | references.clear(); |
82 | wrapper = 0; | 99 | wrapper = 0; |
83 | } | 100 | } |
84 | 101 | ||
85 | void RecMail::setWrapper(AbstractMail*awrapper) | 102 | void RecMail::setWrapper(AbstractMail*awrapper) |
86 | { | 103 | { |
87 | wrapper = awrapper; | 104 | wrapper = awrapper; |
88 | } | 105 | } |
89 | 106 | ||
90 | AbstractMail* RecMail::Wrapper() | 107 | AbstractMail* RecMail::Wrapper() |
91 | { | 108 | { |
92 | return wrapper; | 109 | return wrapper; |
93 | } | 110 | } |
94 | 111 | ||
95 | void RecMail::setTo(const QStringList&list) | 112 | void RecMail::setTo(const QStringList&list) |
96 | { | 113 | { |
97 | to = list; | 114 | to = list; |
98 | } | 115 | } |
99 | 116 | ||
100 | const QStringList&RecMail::To()const | 117 | const QStringList&RecMail::To()const |
101 | { | 118 | { |
102 | return to; | 119 | return to; |
103 | } | 120 | } |
104 | 121 | ||
105 | void RecMail::setCC(const QStringList&list) | 122 | void RecMail::setCC(const QStringList&list) |
106 | { | 123 | { |
107 | cc = list; | 124 | cc = list; |
108 | } | 125 | } |
109 | 126 | ||
110 | const QStringList&RecMail::CC()const | 127 | const QStringList&RecMail::CC()const |
111 | { | 128 | { |
112 | return cc; | 129 | return cc; |
113 | } | 130 | } |
114 | 131 | ||
115 | void RecMail::setBcc(const QStringList&list) | 132 | void RecMail::setBcc(const QStringList&list) |
116 | { | 133 | { |
117 | bcc = list; | 134 | bcc = list; |
118 | } | 135 | } |
119 | 136 | ||
120 | const QStringList& RecMail::Bcc()const | 137 | const QStringList& RecMail::Bcc()const |
121 | { | 138 | { |
122 | return bcc; | 139 | return bcc; |
123 | } | 140 | } |
124 | 141 | ||
125 | void RecMail::setInreply(const QStringList&list) | 142 | void RecMail::setInreply(const QStringList&list) |
126 | { | 143 | { |
127 | in_reply_to = list; | 144 | in_reply_to = list; |
128 | } | 145 | } |
129 | 146 | ||
130 | const QStringList& RecMail::Inreply()const | 147 | const QStringList& RecMail::Inreply()const |
131 | { | 148 | { |
132 | return in_reply_to; | 149 | return in_reply_to; |
133 | } | 150 | } |
134 | 151 | ||
135 | void RecMail::setReferences(const QStringList&list) | 152 | void RecMail::setReferences(const QStringList&list) |
136 | { | 153 | { |
137 | references = list; | 154 | references = list; |
138 | } | 155 | } |
139 | 156 | ||
140 | const QStringList& RecMail::References()const | 157 | const QStringList& RecMail::References()const |
141 | { | 158 | { |
142 | return references; | 159 | return references; |
143 | } | 160 | } |
144 | 161 | ||
145 | RecPart::RecPart() | 162 | RecPart::RecPart() |
146 | : Opie::Core::ORefCount(), | 163 | : Opie::Core::ORefCount(), |
147 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | 164 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) |
148 | { | 165 | { |
149 | m_Parameters.clear(); | 166 | m_Parameters.clear(); |
150 | m_poslist.clear(); | 167 | m_poslist.clear(); |
151 | } | 168 | } |
152 | 169 | ||
153 | RecPart::RecPart(const RecPart&old) | 170 | RecPart::RecPart(const RecPart&old) |
154 | : Opie::Core::ORefCount(), | 171 | : Opie::Core::ORefCount(), |
155 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | 172 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) |
156 | { | 173 | { |
157 | m_type = old.m_type; | 174 | m_type = old.m_type; |
158 | m_subtype = old.m_subtype; | 175 | m_subtype = old.m_subtype; |
159 | m_identifier = old.m_identifier; | 176 | m_identifier = old.m_identifier; |
160 | m_encoding = old.m_encoding; | 177 | m_encoding = old.m_encoding; |
161 | m_description = old.m_description; | 178 | m_description = old.m_description; |
162 | m_lines = old.m_lines; | 179 | m_lines = old.m_lines; |
163 | m_size = old.m_size; | 180 | m_size = old.m_size; |
164 | m_Parameters = old.m_Parameters; | 181 | m_Parameters = old.m_Parameters; |
165 | m_poslist = old.m_poslist; | 182 | m_poslist = old.m_poslist; |
166 | // odebug << "RecPart copy constructor" << oendl; | 183 | // odebug << "RecPart copy constructor" << oendl; |
167 | } | 184 | } |
168 | 185 | ||
169 | RecPart::~RecPart() | 186 | RecPart::~RecPart() |
170 | { | 187 | { |
171 | } | 188 | } |
172 | 189 | ||
173 | void RecPart::setSize(unsigned int size) | 190 | void RecPart::setSize(unsigned int size) |
174 | { | 191 | { |
175 | m_size = size; | 192 | m_size = size; |
176 | } | 193 | } |
177 | 194 | ||
178 | const unsigned int RecPart::Size()const | 195 | const unsigned int RecPart::Size()const |
179 | { | 196 | { |
180 | return m_size; | 197 | return m_size; |
181 | } | 198 | } |
182 | 199 | ||
183 | void RecPart::setLines(unsigned int lines) | 200 | void RecPart::setLines(unsigned int lines) |
184 | { | 201 | { |
185 | m_lines = lines; | 202 | m_lines = lines; |
186 | } | 203 | } |
187 | 204 | ||
188 | const unsigned int RecPart::Lines()const | 205 | const unsigned int RecPart::Lines()const |
189 | { | 206 | { |
190 | return m_lines; | 207 | return m_lines; |
191 | } | 208 | } |
192 | 209 | ||
193 | const QString& RecPart::Type()const | 210 | const QString& RecPart::Type()const |
194 | { | 211 | { |
195 | return m_type; | 212 | return m_type; |
196 | } | 213 | } |
197 | 214 | ||
198 | void RecPart::setType(const QString&type) | 215 | void RecPart::setType(const QString&type) |
199 | { | 216 | { |
200 | m_type = type; | 217 | m_type = type; |
201 | } | 218 | } |
202 | 219 | ||
203 | const QString& RecPart::Subtype()const | 220 | const QString& RecPart::Subtype()const |
204 | { | 221 | { |
205 | return m_subtype; | 222 | return m_subtype; |
206 | } | 223 | } |
207 | 224 | ||
208 | void RecPart::setSubtype(const QString&subtype) | 225 | void RecPart::setSubtype(const QString&subtype) |
209 | { | 226 | { |
210 | m_subtype = subtype; | 227 | m_subtype = subtype; |
211 | } | 228 | } |
212 | 229 | ||
213 | const QString& RecPart::Identifier()const | 230 | const QString& RecPart::Identifier()const |
214 | { | 231 | { |
215 | return m_identifier; | 232 | return m_identifier; |
216 | } | 233 | } |
217 | 234 | ||
218 | void RecPart::setIdentifier(const QString&identifier) | 235 | void RecPart::setIdentifier(const QString&identifier) |
219 | { | 236 | { |
220 | m_identifier = identifier; | 237 | m_identifier = identifier; |
221 | } | 238 | } |
222 | 239 | ||
223 | const QString& RecPart::Encoding()const | 240 | const QString& RecPart::Encoding()const |
224 | { | 241 | { |
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h index 32d92c0..39c0bac 100644 --- a/kmicromail/libmailwrapper/mailtypes.h +++ b/kmicromail/libmailwrapper/mailtypes.h | |||
@@ -1,214 +1,215 @@ | |||
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 <qvaluelist.h> |
18 | 18 | ||
19 | class AbstractMail; | 19 | class 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 | */ |
32 | class RecMail:public Opie::Core::ORefCount | 32 | class RecMail:public Opie::Core::ORefCount |
33 | { | 33 | { |
34 | public: | 34 | public: |
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 | 59 | ||
59 | 60 | ||
60 | void setTo(const QStringList&list); | 61 | void setTo(const QStringList&list); |
61 | const QStringList&To()const; | 62 | const QStringList&To()const; |
62 | void setCC(const QStringList&list); | 63 | void setCC(const QStringList&list); |
63 | const QStringList&CC()const; | 64 | const QStringList&CC()const; |
64 | void setBcc(const QStringList&list); | 65 | void setBcc(const QStringList&list); |
65 | const QStringList&Bcc()const; | 66 | const QStringList&Bcc()const; |
66 | void setInreply(const QStringList&list); | 67 | void setInreply(const QStringList&list); |
67 | const QStringList&Inreply()const; | 68 | const QStringList&Inreply()const; |
68 | void setReferences(const QStringList&list); | 69 | void setReferences(const QStringList&list); |
69 | const QStringList&References()const; | 70 | const QStringList&References()const; |
70 | 71 | ||
71 | const QBitArray&getFlags()const{return msg_flags;} | 72 | const QBitArray&getFlags()const{return msg_flags;} |
72 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 73 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
73 | 74 | ||
74 | void setWrapper(AbstractMail*wrapper); | 75 | void setWrapper(AbstractMail*wrapper); |
75 | AbstractMail* Wrapper(); | 76 | AbstractMail* Wrapper(); |
76 | // public for debugging | 77 | // public for debugging |
77 | QString subject,date,isodate,from,mbox,msg_id,replyto; | 78 | QString subject,date,isodate,from,mbox,msg_id,replyto; |
78 | 79 | ||
79 | protected: | 80 | protected: |
80 | //QString subject,date,isodate,from,mbox,msg_id,replyto; | 81 | //QString subject,date,isodate,from,mbox,msg_id,replyto; |
81 | unsigned int msg_number,msg_size; | 82 | unsigned int msg_number,msg_size; |
82 | QBitArray msg_flags; | 83 | QBitArray msg_flags; |
83 | QStringList to,cc,bcc,in_reply_to,references; | 84 | QStringList to,cc,bcc,in_reply_to,references; |
84 | AbstractMail*wrapper; | 85 | AbstractMail*wrapper; |
85 | void init(); | 86 | void init(); |
86 | void copy_old(const RecMail&old); | 87 | void copy_old(const RecMail&old); |
87 | }; | 88 | }; |
88 | 89 | ||
89 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; | 90 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
90 | typedef QMap<QString,QString> part_plist_t; | 91 | typedef QMap<QString,QString> part_plist_t; |
91 | 92 | ||
92 | class RecPart:public Opie::Core::ORefCount | 93 | class RecPart:public Opie::Core::ORefCount |
93 | { | 94 | { |
94 | protected: | 95 | protected: |
95 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; | 96 | QString m_type,m_subtype,m_identifier,m_encoding,m_description; |
96 | unsigned int m_lines,m_size; | 97 | unsigned int m_lines,m_size; |
97 | part_plist_t m_Parameters; | 98 | part_plist_t m_Parameters; |
98 | /* describes the position in the mail */ | 99 | /* describes the position in the mail */ |
99 | QValueList<int> m_poslist; | 100 | QValueList<int> m_poslist; |
100 | 101 | ||
101 | public: | 102 | public: |
102 | RecPart(); | 103 | RecPart(); |
103 | RecPart(const RecPart&); | 104 | RecPart(const RecPart&); |
104 | virtual ~RecPart(); | 105 | virtual ~RecPart(); |
105 | 106 | ||
106 | const QString&Type()const; | 107 | const QString&Type()const; |
107 | void setType(const QString&type); | 108 | void setType(const QString&type); |
108 | const QString&Subtype()const; | 109 | const QString&Subtype()const; |
109 | void setSubtype(const QString&subtype); | 110 | void setSubtype(const QString&subtype); |
110 | const QString&Identifier()const; | 111 | const QString&Identifier()const; |
111 | void setIdentifier(const QString&identifier); | 112 | void setIdentifier(const QString&identifier); |
112 | const QString&Encoding()const; | 113 | const QString&Encoding()const; |
113 | void setEncoding(const QString&encoding); | 114 | void setEncoding(const QString&encoding); |
114 | const QString&Description()const; | 115 | const QString&Description()const; |
115 | void setDescription(const QString&desc); | 116 | void setDescription(const QString&desc); |
116 | void setLines(unsigned int lines); | 117 | void setLines(unsigned int lines); |
117 | const unsigned int Lines()const; | 118 | const unsigned int Lines()const; |
118 | void setSize(unsigned int size); | 119 | void setSize(unsigned int size); |
119 | const unsigned int Size()const; | 120 | const unsigned int Size()const; |
120 | 121 | ||
121 | 122 | ||
122 | void setParameters(const part_plist_t&list); | 123 | void setParameters(const part_plist_t&list); |
123 | const part_plist_t&Parameters()const; | 124 | const part_plist_t&Parameters()const; |
124 | void addParameter(const QString&key,const QString&value); | 125 | void addParameter(const QString&key,const QString&value); |
125 | const QString searchParamter(const QString&key)const; | 126 | const QString searchParamter(const QString&key)const; |
126 | void setPositionlist(const QValueList<int>&poslist); | 127 | void setPositionlist(const QValueList<int>&poslist); |
127 | const QValueList<int>& Positionlist()const; | 128 | const QValueList<int>& Positionlist()const; |
128 | }; | 129 | }; |
129 | 130 | ||
130 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; | 131 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; |
131 | 132 | ||
132 | class RecBody:public Opie::Core::ORefCount | 133 | class RecBody:public Opie::Core::ORefCount |
133 | { | 134 | { |
134 | protected: | 135 | protected: |
135 | QString m_BodyText; | 136 | QString m_BodyText; |
136 | QString mCharset; | 137 | QString mCharset; |
137 | QValueList<RecPartP> m_PartsList; | 138 | QValueList<RecPartP> m_PartsList; |
138 | RecPartP m_description; | 139 | RecPartP m_description; |
139 | 140 | ||
140 | public: | 141 | public: |
141 | RecBody(); | 142 | RecBody(); |
142 | RecBody(const RecBody&old); | 143 | RecBody(const RecBody&old); |
143 | virtual ~RecBody(); | 144 | virtual ~RecBody(); |
144 | void setBodytext(const QString&); | 145 | void setBodytext(const QString&); |
145 | const QString& Bodytext()const; | 146 | const QString& Bodytext()const; |
146 | void setCharset(const QString&); | 147 | void setCharset(const QString&); |
147 | QString getCharset()const; | 148 | QString getCharset()const; |
148 | 149 | ||
149 | void setDescription(const RecPartP&des); | 150 | void setDescription(const RecPartP&des); |
150 | const RecPartP& Description()const; | 151 | const RecPartP& Description()const; |
151 | 152 | ||
152 | void setParts(const QValueList<RecPartP>&parts); | 153 | void setParts(const QValueList<RecPartP>&parts); |
153 | const QValueList<RecPartP>& Parts()const; | 154 | const QValueList<RecPartP>& Parts()const; |
154 | void addPart(const RecPartP&part); | 155 | void addPart(const RecPartP&part); |
155 | }; | 156 | }; |
156 | 157 | ||
157 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; | 158 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; |
158 | 159 | ||
159 | class encodedString | 160 | class encodedString |
160 | { | 161 | { |
161 | public: | 162 | public: |
162 | encodedString(); | 163 | encodedString(); |
163 | /* | 164 | /* |
164 | creates an new content string. | 165 | creates an new content string. |
165 | it makes a deep copy of it! | 166 | it makes a deep copy of it! |
166 | */ | 167 | */ |
167 | encodedString(const char*nContent,unsigned int length); | 168 | encodedString(const char*nContent,unsigned int length); |
168 | /* | 169 | /* |
169 | Take over the nContent. Means: it will just copy the pointer, not the content. | 170 | Take over the nContent. Means: it will just copy the pointer, not the content. |
170 | so make sure: No one else frees the string, the string has allocated with | 171 | so make sure: No one else frees the string, the string has allocated with |
171 | malloc for compatibility with c-based libs | 172 | malloc for compatibility with c-based libs |
172 | */ | 173 | */ |
173 | encodedString(char*nContent,unsigned int nSize); | 174 | encodedString(char*nContent,unsigned int nSize); |
174 | /* copy construkor - makes ALWAYS a deep copy!!!! */ | 175 | /* copy construkor - makes ALWAYS a deep copy!!!! */ |
175 | encodedString(const encodedString&old); | 176 | encodedString(const encodedString&old); |
176 | /* assign operator - makes ALWAYS a deep copy!!!! */ | 177 | /* assign operator - makes ALWAYS a deep copy!!!! */ |
177 | encodedString& operator=(const encodedString&old); | 178 | encodedString& operator=(const encodedString&old); |
178 | /* destructor - cleans the content */ | 179 | /* destructor - cleans the content */ |
179 | virtual ~encodedString(); | 180 | virtual ~encodedString(); |
180 | 181 | ||
181 | /* returns a pointer to the content - do not delete yoursel! */ | 182 | /* returns a pointer to the content - do not delete yoursel! */ |
182 | const char*Content()const; | 183 | const char*Content()const; |
183 | /* returns the lengths of the content 'cause it must not be a null-terminated string! */ | 184 | /* returns the lengths of the content 'cause it must not be a null-terminated string! */ |
184 | const int Length()const; | 185 | const int Length()const; |
185 | 186 | ||
186 | /* | 187 | /* |
187 | makes a deep copy of nContent! | 188 | makes a deep copy of nContent! |
188 | */ | 189 | */ |
189 | void setContent(const char*nContent,int nSize); | 190 | void setContent(const char*nContent,int nSize); |
190 | /* | 191 | /* |
191 | Take over the nContent. Means: it will just copy the pointer, not the content. | 192 | Take over the nContent. Means: it will just copy the pointer, not the content. |
192 | so make sure: No one else frees the string, the string has allocated with | 193 | so make sure: No one else frees the string, the string has allocated with |
193 | malloc for compatibility with c-based libs | 194 | malloc for compatibility with c-based libs |
194 | */ | 195 | */ |
195 | void setContent(char*nContent,int nSize); | 196 | void setContent(char*nContent,int nSize); |
196 | 197 | ||
197 | protected: | 198 | protected: |
198 | char * content; | 199 | char * content; |
199 | unsigned int size; | 200 | unsigned int size; |
200 | 201 | ||
201 | void init(); | 202 | void init(); |
202 | void copy_old(const encodedString&old); | 203 | void copy_old(const encodedString&old); |
203 | void clean(); | 204 | void clean(); |
204 | }; | 205 | }; |
205 | 206 | ||
206 | struct folderStat | 207 | struct folderStat |
207 | { | 208 | { |
208 | unsigned int message_count; | 209 | unsigned int message_count; |
209 | unsigned int message_unseen; | 210 | unsigned int message_unseen; |
210 | unsigned int message_recent; | 211 | unsigned int message_recent; |
211 | folderStat&operator=(const folderStat&old); | 212 | folderStat&operator=(const folderStat&old); |
212 | }; | 213 | }; |
213 | 214 | ||
214 | #endif | 215 | #endif |