Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 156e11d..a574ea1 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -94,97 +94,97 @@ void ViewMail::setBody(const RecBodyP&body ) | |||
94 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); | 94 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); |
95 | QString desc,fsize; | 95 | QString desc,fsize; |
96 | double s = body->Description()->Size(); | 96 | double s = body->Description()->Size(); |
97 | int w; | 97 | int w; |
98 | w=0; | 98 | w=0; |
99 | 99 | ||
100 | while (s>1024) | 100 | while (s>1024) |
101 | { | 101 | { |
102 | s/=1024; | 102 | s/=1024; |
103 | ++w; | 103 | ++w; |
104 | if (w>=2) break; | 104 | if (w>=2) break; |
105 | } | 105 | } |
106 | 106 | ||
107 | QString q=""; | 107 | QString q=""; |
108 | switch(w) | 108 | switch(w) |
109 | { | 109 | { |
110 | case 1: | 110 | case 1: |
111 | q="k"; | 111 | q="k"; |
112 | break; | 112 | break; |
113 | case 2: | 113 | case 2: |
114 | q="M"; | 114 | q="M"; |
115 | break; | 115 | break; |
116 | default: | 116 | default: |
117 | break; | 117 | break; |
118 | } | 118 | } |
119 | 119 | ||
120 | { | 120 | { |
121 | /* I did not found a method to make a CONTENT reset on a QTextStream | 121 | /* I did not found a method to make a CONTENT reset on a QTextStream |
122 | so I use this construct that the stream will re-constructed in each | 122 | so I use this construct that the stream will re-constructed in each |
123 | loop. To let it work, the textstream is packed into a own area of | 123 | loop. To let it work, the textstream is packed into a own area of |
124 | code is it will be destructed after finishing its small job. | 124 | code is it will be destructed after finishing its small job. |
125 | */ | 125 | */ |
126 | QTextOStream o(&fsize); | 126 | QTextOStream o(&fsize); |
127 | if (w>0) o.precision(2); else o.precision(0); | 127 | if (w>0) o.precision(2); else o.precision(0); |
128 | o.setf(QTextStream::fixed); | 128 | o.setf(QTextStream::fixed); |
129 | o << s << " " << q << "Byte"; | 129 | o << s << " " << q << "Byte"; |
130 | } | 130 | } |
131 | 131 | ||
132 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 132 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
133 | QString filename = ""; | 133 | QString filename = ""; |
134 | 134 | ||
135 | for (unsigned int i = 0; i < body->Parts().count();++i) | 135 | for (unsigned int i = 0; i < body->Parts().count();++i) |
136 | { | 136 | { |
137 | filename = ""; | 137 | filename = ""; |
138 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 138 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
139 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 139 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
140 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 140 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
141 | { | 141 | { |
142 | qDebug(it.key()); | 142 | odebug << it.key() << oendl; |
143 | if (it.key().lower()=="name") | 143 | if (it.key().lower()=="name") |
144 | { | 144 | { |
145 | filename=it.data(); | 145 | filename=it.data(); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | s = body->Parts()[i]->Size(); | 148 | s = body->Parts()[i]->Size(); |
149 | w = 0; | 149 | w = 0; |
150 | while (s>1024) | 150 | while (s>1024) |
151 | { | 151 | { |
152 | s/=1024; | 152 | s/=1024; |
153 | ++w; | 153 | ++w; |
154 | if (w>=2) break; | 154 | if (w>=2) break; |
155 | } | 155 | } |
156 | switch(w) | 156 | switch(w) |
157 | { | 157 | { |
158 | case 1: | 158 | case 1: |
159 | q="k"; | 159 | q="k"; |
160 | break; | 160 | break; |
161 | case 2: | 161 | case 2: |
162 | q="M"; | 162 | q="M"; |
163 | break; | 163 | break; |
164 | default: | 164 | default: |
165 | q=""; | 165 | q=""; |
166 | break; | 166 | break; |
167 | } | 167 | } |
168 | QTextOStream o(&fsize); | 168 | QTextOStream o(&fsize); |
169 | if (w>0) o.precision(2); else o.precision(0); | 169 | if (w>0) o.precision(2); else o.precision(0); |
170 | o.setf(QTextStream::fixed); | 170 | o.setf(QTextStream::fixed); |
171 | o << s << " " << q << "Byte"; | 171 | o << s << " " << q << "Byte"; |
172 | desc = body->Parts()[i]->Description(); | 172 | desc = body->Parts()[i]->Description(); |
173 | parentItem = searchParent(body->Parts()[i]->Positionlist()); | 173 | parentItem = searchParent(body->Parts()[i]->Positionlist()); |
174 | if (parentItem) | 174 | if (parentItem) |
175 | { | 175 | { |
176 | AttachItem*temp = lastChild(parentItem); | 176 | AttachItem*temp = lastChild(parentItem); |
177 | if (temp) curItem = temp; | 177 | if (temp) curItem = temp; |
178 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 178 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
179 | attachments->setRootIsDecorated(true); | 179 | attachments->setRootIsDecorated(true); |
180 | curItem = parentItem; | 180 | curItem = parentItem; |
181 | } | 181 | } |
182 | else | 182 | else |
183 | { | 183 | { |
184 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 184 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | void ViewMail::slotShowHtml( bool state ) | 190 | void ViewMail::slotShowHtml( bool state ) |