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/mailtypes.cpp | |
parent | 6c89efd80c1e94a0c070025d07c7a4c656f2a81e (diff) | |
download | kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.zip kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.gz kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.bz2 |
mail fixes
Diffstat (limited to 'kmicromail/libmailwrapper/mailtypes.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 17 |
1 files changed, 17 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,128 +1,145 @@ | |||
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 | } |