Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index f015228..8636957 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -96,377 +96,377 @@ void ViewMail::setBody( RecBody body ) | |||
96 | QString type=body.Description().Type()+"/"+body.Description().Subtype(); | 96 | QString type=body.Description().Type()+"/"+body.Description().Subtype(); |
97 | QString desc,fsize; | 97 | QString desc,fsize; |
98 | double s = body.Description().Size(); | 98 | double s = body.Description().Size(); |
99 | int w; | 99 | int w; |
100 | w=0; | 100 | w=0; |
101 | 101 | ||
102 | while (s>1024) | 102 | while (s>1024) |
103 | { | 103 | { |
104 | s/=1024; | 104 | s/=1024; |
105 | ++w; | 105 | ++w; |
106 | if (w>=2) break; | 106 | if (w>=2) break; |
107 | } | 107 | } |
108 | 108 | ||
109 | QString q=""; | 109 | QString q=""; |
110 | switch(w) | 110 | switch(w) |
111 | { | 111 | { |
112 | case 1: | 112 | case 1: |
113 | q="k"; | 113 | q="k"; |
114 | break; | 114 | break; |
115 | case 2: | 115 | case 2: |
116 | q="M"; | 116 | q="M"; |
117 | break; | 117 | break; |
118 | default: | 118 | default: |
119 | break; | 119 | break; |
120 | } | 120 | } |
121 | 121 | ||
122 | { | 122 | { |
123 | /* I did not found a method to make a CONTENT reset on a QTextStream | 123 | /* I did not found a method to make a CONTENT reset on a QTextStream |
124 | so I use this construct that the stream will re-constructed in each | 124 | so I use this construct that the stream will re-constructed in each |
125 | loop. To let it work, the textstream is packed into a own area of | 125 | loop. To let it work, the textstream is packed into a own area of |
126 | code is it will be destructed after finishing its small job. | 126 | code is it will be destructed after finishing its small job. |
127 | */ | 127 | */ |
128 | QTextOStream o(&fsize); | 128 | QTextOStream o(&fsize); |
129 | if (w>0) o.precision(2); else o.precision(0); | 129 | if (w>0) o.precision(2); else o.precision(0); |
130 | o.setf(QTextStream::fixed); | 130 | o.setf(QTextStream::fixed); |
131 | o << s << " " << q << "Byte"; | 131 | o << s << " " << q << "Byte"; |
132 | } | 132 | } |
133 | 133 | ||
134 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body.Description().Positionlist()); | 134 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body.Description().Positionlist()); |
135 | QString filename = ""; | 135 | QString filename = ""; |
136 | 136 | ||
137 | for (unsigned int i = 0; i < body.Parts().count();++i) | 137 | for (unsigned int i = 0; i < body.Parts().count();++i) |
138 | { | 138 | { |
139 | type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); | 139 | type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); |
140 | part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); | 140 | part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); |
141 | for (;it!=body.Parts()[i].Parameters().end();++it) | 141 | for (;it!=body.Parts()[i].Parameters().end();++it) |
142 | { | 142 | { |
143 | qDebug(it.key()); | 143 | qDebug(it.key()); |
144 | if (it.key().lower()=="name") | 144 | if (it.key().lower()=="name") |
145 | { | 145 | { |
146 | filename=it.data(); | 146 | filename=it.data(); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | s = body.Parts()[i].Size(); | 149 | s = body.Parts()[i].Size(); |
150 | w = 0; | 150 | w = 0; |
151 | while (s>1024) | 151 | while (s>1024) |
152 | { | 152 | { |
153 | s/=1024; | 153 | s/=1024; |
154 | ++w; | 154 | ++w; |
155 | if (w>=2) break; | 155 | if (w>=2) break; |
156 | } | 156 | } |
157 | switch(w) | 157 | switch(w) |
158 | { | 158 | { |
159 | case 1: | 159 | case 1: |
160 | q="k"; | 160 | q="k"; |
161 | break; | 161 | break; |
162 | case 2: | 162 | case 2: |
163 | q="M"; | 163 | q="M"; |
164 | break; | 164 | break; |
165 | default: | 165 | default: |
166 | q=""; | 166 | q=""; |
167 | break; | 167 | break; |
168 | } | 168 | } |
169 | QTextOStream o(&fsize); | 169 | QTextOStream o(&fsize); |
170 | if (w>0) o.precision(2); else o.precision(0); | 170 | if (w>0) o.precision(2); else o.precision(0); |
171 | o.setf(QTextStream::fixed); | 171 | o.setf(QTextStream::fixed); |
172 | o << s << " " << q << "Byte"; | 172 | o << s << " " << q << "Byte"; |
173 | desc = body.Parts()[i].Description(); | 173 | desc = body.Parts()[i].Description(); |
174 | parentItem = searchParent(body.Parts()[i].Positionlist()); | 174 | parentItem = searchParent(body.Parts()[i].Positionlist()); |
175 | if (parentItem) | 175 | if (parentItem) |
176 | { | 176 | { |
177 | AttachItem*temp = lastChild(parentItem); | 177 | AttachItem*temp = lastChild(parentItem); |
178 | if (temp) curItem = temp; | 178 | if (temp) curItem = temp; |
179 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); | 179 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); |
180 | attachments->setRootIsDecorated(true); | 180 | attachments->setRootIsDecorated(true); |
181 | curItem = parentItem; | 181 | curItem = parentItem; |
182 | } | 182 | } |
183 | else | 183 | else |
184 | { | 184 | { |
185 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); | 185 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body.Parts()[i].Positionlist()); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | 190 | ||
191 | void ViewMail::slotShowHtml( bool state ) | 191 | void ViewMail::slotShowHtml( bool state ) |
192 | { | 192 | { |
193 | m_showHtml = state; | 193 | m_showHtml = state; |
194 | setText(); | 194 | setText(); |
195 | } | 195 | } |
196 | 196 | ||
197 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 197 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) |
198 | { | 198 | { |
199 | if (!item ) | 199 | if (!item ) |
200 | return; | 200 | return; |
201 | 201 | ||
202 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 202 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
203 | { | 203 | { |
204 | setText(); | 204 | setText(); |
205 | return; | 205 | return; |
206 | } | 206 | } |
207 | QPopupMenu *menu = new QPopupMenu(); | 207 | QPopupMenu *menu = new QPopupMenu(); |
208 | int ret=0; | 208 | int ret=0; |
209 | 209 | ||
210 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 210 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
211 | { | 211 | { |
212 | menu->insertItem( tr( "Show Text" ), 1 ); | 212 | menu->insertItem( tr( "Show Text" ), 1 ); |
213 | } | 213 | } |
214 | menu->insertItem( tr( "Save Attachment" ), 0 ); | 214 | menu->insertItem( tr( "Save Attachment" ), 0 ); |
215 | menu->insertSeparator(1); | 215 | menu->insertSeparator(1); |
216 | 216 | ||
217 | ret = menu->exec( point, 0 ); | 217 | ret = menu->exec( point, 0 ); |
218 | 218 | ||
219 | switch(ret) | 219 | switch(ret) |
220 | { | 220 | { |
221 | case 0: | 221 | case 0: |
222 | { | 222 | { |
223 | MimeTypes types; | 223 | MimeTypes types; |
224 | types.insert( "all", "*" ); | 224 | types.insert( "all", "*" ); |
225 | QString str = Opie::OFileDialog::getSaveFileName( 1, | 225 | QString str = Opie::OFileDialog::getSaveFileName( 1, |
226 | "/", item->text( 2 ) , types, 0 ); | 226 | "/", item->text( 2 ) , types, 0 ); |
227 | 227 | ||
228 | if( !str.isEmpty() ) | 228 | if( !str.isEmpty() ) |
229 | { | 229 | { |
230 | encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 230 | encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
231 | if (content) | 231 | if (content) |
232 | { | 232 | { |
233 | QFile output(str); | 233 | QFile output(str); |
234 | output.open(IO_WriteOnly); | 234 | output.open(IO_WriteOnly); |
235 | output.writeBlock(content->Content(),content->Length()); | 235 | output.writeBlock(content->Content(),content->Length()); |
236 | output.close(); | 236 | output.close(); |
237 | delete content; | 237 | delete content; |
238 | } | 238 | } |
239 | } | 239 | } |
240 | } | 240 | } |
241 | break ; | 241 | break ; |
242 | 242 | ||
243 | case 1: | 243 | case 1: |
244 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 244 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
245 | { | 245 | { |
246 | setText(); | 246 | setText(); |
247 | } | 247 | } |
248 | else | 248 | else |
249 | { | 249 | { |
250 | if ( m_recMail.Wrapper() != 0l ) | 250 | if ( m_recMail.Wrapper() != 0l ) |
251 | { // make sure that there is a wrapper , even after delete or simular actions | 251 | { // make sure that there is a wrapper , even after delete or simular actions |
252 | browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 252 | browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | break; | 255 | break; |
256 | } | 256 | } |
257 | delete menu; | 257 | delete menu; |
258 | } | 258 | } |
259 | 259 | ||
260 | 260 | ||
261 | void ViewMail::setMail( RecMail mail ) | 261 | void ViewMail::setMail( RecMail mail ) |
262 | { | 262 | { |
263 | 263 | ||
264 | m_recMail = mail; | 264 | m_recMail = mail; |
265 | 265 | ||
266 | m_mail[0] = mail.getFrom(); | 266 | m_mail[0] = mail.getFrom(); |
267 | m_mail[1] = mail.getSubject(); | 267 | m_mail[1] = mail.getSubject(); |
268 | m_mail[3] = mail.getDate(); | 268 | m_mail[3] = mail.getDate(); |
269 | m_mail[4] = mail.Msgid(); | 269 | m_mail[4] = mail.Msgid(); |
270 | 270 | ||
271 | m_mail2[0] = mail.To(); | 271 | m_mail2[0] = mail.To(); |
272 | m_mail2[1] = mail.CC(); | 272 | m_mail2[1] = mail.CC(); |
273 | m_mail2[2] = mail.Bcc(); | 273 | m_mail2[2] = mail.Bcc(); |
274 | 274 | ||
275 | setText(); | 275 | setText(); |
276 | } | 276 | } |
277 | 277 | ||
278 | 278 | ||
279 | 279 | ||
280 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 280 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
281 | : ViewMailBase(parent, name, fl), _inLoop(false) | 281 | : ViewMailBase(parent, name, fl), _inLoop(false) |
282 | { | 282 | { |
283 | m_gotBody = false; | 283 | m_gotBody = false; |
284 | deleted = false; | 284 | deleted = false; |
285 | 285 | ||
286 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); | 286 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); |
287 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); | 287 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); |
288 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); | 288 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); |
289 | connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) ); | 289 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); |
290 | 290 | ||
291 | attachments->setEnabled(m_gotBody); | 291 | attachments->setEnabled(m_gotBody); |
292 | connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); | 292 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); |
293 | 293 | ||
294 | readConfig(); | 294 | readConfig(); |
295 | attachments->setSorting(-1); | 295 | attachments->setSorting(-1); |
296 | } | 296 | } |
297 | 297 | ||
298 | void ViewMail::readConfig() | 298 | void ViewMail::readConfig() |
299 | { | 299 | { |
300 | Config cfg( "mail" ); | 300 | Config cfg( "mail" ); |
301 | cfg.setGroup( "Settings" ); | 301 | cfg.setGroup( "Settings" ); |
302 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); | 302 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); |
303 | showHtml->setOn( m_showHtml ); | 303 | showHtml->setOn( m_showHtml ); |
304 | } | 304 | } |
305 | 305 | ||
306 | void ViewMail::setText() | 306 | void ViewMail::setText() |
307 | { | 307 | { |
308 | 308 | ||
309 | QString toString; | 309 | QString toString; |
310 | QString ccString; | 310 | QString ccString; |
311 | QString bccString; | 311 | QString bccString; |
312 | 312 | ||
313 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) | 313 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) |
314 | { | 314 | { |
315 | toString += (*it); | 315 | toString += (*it); |
316 | } | 316 | } |
317 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) | 317 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) |
318 | { | 318 | { |
319 | ccString += (*it); | 319 | ccString += (*it); |
320 | } | 320 | } |
321 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) | 321 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) |
322 | { | 322 | { |
323 | bccString += (*it); | 323 | bccString += (*it); |
324 | } | 324 | } |
325 | 325 | ||
326 | setCaption( caption().arg( m_mail[0] ) ); | 326 | setCaption( caption().arg( m_mail[0] ) ); |
327 | 327 | ||
328 | m_mailHtml = "<html><body>" | 328 | m_mailHtml = "<html><body>" |
329 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 329 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
330 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 330 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
331 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 331 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
332 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 332 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
333 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 333 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
334 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 334 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
335 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + | 335 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + |
336 | "</td></tr></table><font face=fixed>"; | 336 | "</td></tr></table><font face=fixed>"; |
337 | 337 | ||
338 | if ( !m_showHtml ) | 338 | if ( !m_showHtml ) |
339 | { | 339 | { |
340 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 340 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
341 | } | 341 | } |
342 | else | 342 | else |
343 | { | 343 | { |
344 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 344 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
345 | } | 345 | } |
346 | // remove later in favor of a real handling | 346 | // remove later in favor of a real handling |
347 | m_gotBody = true; | 347 | m_gotBody = true; |
348 | } | 348 | } |
349 | 349 | ||
350 | 350 | ||
351 | ViewMail::~ViewMail() | 351 | ViewMail::~ViewMail() |
352 | { | 352 | { |
353 | m_recMail.Wrapper()->cleanMimeCache(); | 353 | m_recMail.Wrapper()->cleanMimeCache(); |
354 | hide(); | 354 | hide(); |
355 | } | 355 | } |
356 | 356 | ||
357 | void ViewMail::hide() | 357 | void ViewMail::hide() |
358 | { | 358 | { |
359 | QWidget::hide(); | 359 | QWidget::hide(); |
360 | 360 | ||
361 | if (_inLoop) | 361 | if (_inLoop) |
362 | { | 362 | { |
363 | _inLoop = false; | 363 | _inLoop = false; |
364 | qApp->exit_loop(); | 364 | qApp->exit_loop(); |
365 | 365 | ||
366 | } | 366 | } |
367 | 367 | ||
368 | } | 368 | } |
369 | 369 | ||
370 | void ViewMail::exec() | 370 | void ViewMail::exec() |
371 | { | 371 | { |
372 | show(); | 372 | show(); |
373 | 373 | ||
374 | if (!_inLoop) | 374 | if (!_inLoop) |
375 | { | 375 | { |
376 | _inLoop = true; | 376 | _inLoop = true; |
377 | qApp->enter_loop(); | 377 | qApp->enter_loop(); |
378 | } | 378 | } |
379 | 379 | ||
380 | } | 380 | } |
381 | 381 | ||
382 | QString ViewMail::deHtml(const QString &string) | 382 | QString ViewMail::deHtml(const QString &string) |
383 | { | 383 | { |
384 | QString string_ = string; | 384 | QString string_ = string; |
385 | string_.replace(QRegExp("&"), "&"); | 385 | string_.replace(QRegExp("&"), "&"); |
386 | string_.replace(QRegExp("<"), "<"); | 386 | string_.replace(QRegExp("<"), "<"); |
387 | string_.replace(QRegExp(">"), ">"); | 387 | string_.replace(QRegExp(">"), ">"); |
388 | string_.replace(QRegExp("\\n"), "<br>"); | 388 | string_.replace(QRegExp("\\n"), "<br>"); |
389 | return string_; | 389 | return string_; |
390 | } | 390 | } |
391 | 391 | ||
392 | void ViewMail::slotReply() | 392 | void ViewMail::slotReply() |
393 | { | 393 | { |
394 | if (!m_gotBody) | 394 | if (!m_gotBody) |
395 | { | 395 | { |
396 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); | 396 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); |
397 | return; | 397 | return; |
398 | } | 398 | } |
399 | 399 | ||
400 | QString rtext; | 400 | QString rtext; |
401 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 401 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
402 | .arg( m_mail[0] ) | 402 | .arg( m_mail[0] ) |
403 | .arg( m_mail[3] ); | 403 | .arg( m_mail[3] ); |
404 | 404 | ||
405 | QString text = m_mail[2]; | 405 | QString text = m_mail[2]; |
406 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 406 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
407 | QStringList::Iterator it; | 407 | QStringList::Iterator it; |
408 | for (it = lines.begin(); it != lines.end(); it++) | 408 | for (it = lines.begin(); it != lines.end(); it++) |
409 | { | 409 | { |
410 | rtext += "> " + *it + "\n"; | 410 | rtext += "> " + *it + "\n"; |
411 | } | 411 | } |
412 | rtext += "\n"; | 412 | rtext += "\n"; |
413 | 413 | ||
414 | QString prefix; | 414 | QString prefix; |
415 | if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = ""; | 415 | if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = ""; |
416 | else prefix = "Re: "; // no i18n on purpose | 416 | else prefix = "Re: "; // no i18n on purpose |
417 | 417 | ||
418 | Settings *settings = new Settings(); | 418 | Settings *settings = new Settings(); |
419 | ComposeMail composer( settings ,this, 0, true); | 419 | ComposeMail composer( settings ,this, 0, true); |
420 | composer.setTo( m_mail[0] ); | 420 | composer.setTo( m_mail[0] ); |
421 | composer.setSubject( "Re: " + m_mail[1] ); | 421 | composer.setSubject( "Re: " + m_mail[1] ); |
422 | composer.setMessage( rtext ); | 422 | composer.setMessage( rtext ); |
423 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) | 423 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) |
424 | { | 424 | { |
425 | m_recMail.Wrapper()->answeredMail(m_recMail); | 425 | m_recMail.Wrapper()->answeredMail(m_recMail); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | void ViewMail::slotForward() | 429 | void ViewMail::slotForward() |
430 | { | 430 | { |
431 | if (!m_gotBody) | 431 | if (!m_gotBody) |
432 | { | 432 | { |
433 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); | 433 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); |
434 | return; | 434 | return; |
435 | } | 435 | } |
436 | 436 | ||
437 | QString ftext; | 437 | QString ftext; |
438 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") | 438 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") |
439 | .arg( m_mail[0] ); | 439 | .arg( m_mail[0] ); |
440 | if (!m_mail[3].isNull()) | 440 | if (!m_mail[3].isNull()) |
441 | ftext += QString("Date: %1\n") | 441 | ftext += QString("Date: %1\n") |
442 | .arg( m_mail[3] ); | 442 | .arg( m_mail[3] ); |
443 | if (!m_mail[0].isNull()) | 443 | if (!m_mail[0].isNull()) |
444 | ftext += QString("From: %1\n") | 444 | ftext += QString("From: %1\n") |
445 | .arg( m_mail[0] ); | 445 | .arg( m_mail[0] ); |
446 | if (!m_mail[1].isNull()) | 446 | if (!m_mail[1].isNull()) |
447 | ftext += QString("Subject: %1\n") | 447 | ftext += QString("Subject: %1\n") |
448 | .arg( m_mail[1] ); | 448 | .arg( m_mail[1] ); |
449 | 449 | ||
450 | ftext += QString("\n%1\n") | 450 | ftext += QString("\n%1\n") |
451 | .arg( m_mail[2]); | 451 | .arg( m_mail[2]); |
452 | 452 | ||
453 | ftext += QString("----- End forwarded message -----\n"); | 453 | ftext += QString("----- End forwarded message -----\n"); |
454 | 454 | ||
455 | Settings *settings = new Settings(); | 455 | Settings *settings = new Settings(); |
456 | ComposeMail composer( settings ,this, 0, true); | 456 | ComposeMail composer( settings ,this, 0, true); |
457 | composer.setSubject( "Fwd: " + m_mail[1] ); | 457 | composer.setSubject( "Fwd: " + m_mail[1] ); |
458 | composer.setMessage( ftext ); | 458 | composer.setMessage( ftext ); |
459 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer )) | 459 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer )) |
460 | { | 460 | { |
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 | ||
464 | void ViewMail::slotDeleteMail( ) | 464 | void ViewMail::slotDeleteMail( ) |
465 | { | 465 | { |
466 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 466 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
467 | { | 467 | { |
468 | m_recMail.Wrapper()->deleteMail( m_recMail ); | 468 | m_recMail.Wrapper()->deleteMail( m_recMail ); |
469 | hide(); | 469 | hide(); |
470 | deleted = true; | 470 | deleted = true; |
471 | } | 471 | } |
472 | } | 472 | } |