author | alwin <alwin> | 2004-03-12 19:24:38 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-12 19:24:38 (UTC) |
commit | b600871ce93553a116a66fd80acd6dfc1cc46829 (patch) (unidiff) | |
tree | b361346a49e09d9f0220993583bf183cf29bd974 /noncore/net/mail/viewmail.cpp | |
parent | 874d5a34eca296263dcd1adf857aebe9981825a1 (diff) | |
download | opie-b600871ce93553a116a66fd80acd6dfc1cc46829.zip opie-b600871ce93553a116a66fd80acd6dfc1cc46829.tar.gz opie-b600871ce93553a116a66fd80acd6dfc1cc46829.tar.bz2 |
some more smart-pointers
some bugfixes
some renaming of internals
Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 78652d7..894a386 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -216,68 +216,68 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
216 | 216 | ||
217 | switch(ret) | 217 | switch(ret) |
218 | { | 218 | { |
219 | case 0: | 219 | case 0: |
220 | { | 220 | { |
221 | MimeTypes types; | 221 | MimeTypes types; |
222 | types.insert( "all", "*" ); | 222 | types.insert( "all", "*" ); |
223 | QString str = Opie::OFileDialog::getSaveFileName( 1, | 223 | QString str = Opie::OFileDialog::getSaveFileName( 1, |
224 | "/", item->text( 2 ) , types, 0 ); | 224 | "/", item->text( 2 ) , types, 0 ); |
225 | 225 | ||
226 | if( !str.isEmpty() ) | 226 | if( !str.isEmpty() ) |
227 | { | 227 | { |
228 | encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 228 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
229 | if (content) | 229 | if (content) |
230 | { | 230 | { |
231 | QFile output(str); | 231 | QFile output(str); |
232 | output.open(IO_WriteOnly); | 232 | output.open(IO_WriteOnly); |
233 | output.writeBlock(content->Content(),content->Length()); | 233 | output.writeBlock(content->Content(),content->Length()); |
234 | output.close(); | 234 | output.close(); |
235 | delete content; | 235 | delete content; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | } | 238 | } |
239 | break ; | 239 | break ; |
240 | 240 | ||
241 | case 1: | 241 | case 1: |
242 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 242 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
243 | { | 243 | { |
244 | setText(); | 244 | setText(); |
245 | } | 245 | } |
246 | else | 246 | else |
247 | { | 247 | { |
248 | if ( m_recMail.Wrapper() != 0l ) | 248 | if ( m_recMail->Wrapper() != 0l ) |
249 | { // make sure that there is a wrapper , even after delete or simular actions | 249 | { // make sure that there is a wrapper , even after delete or simular actions |
250 | browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 250 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | break; | 253 | break; |
254 | } | 254 | } |
255 | delete menu; | 255 | delete menu; |
256 | } | 256 | } |
257 | 257 | ||
258 | 258 | ||
259 | void ViewMail::setMail( RecMail mail ) | 259 | void ViewMail::setMail( RecMailP mail ) |
260 | { | 260 | { |
261 | 261 | ||
262 | m_recMail = mail; | 262 | m_recMail = mail; |
263 | 263 | ||
264 | m_mail[0] = mail.getFrom(); | 264 | m_mail[0] = mail->getFrom(); |
265 | m_mail[1] = mail.getSubject(); | 265 | m_mail[1] = mail->getSubject(); |
266 | m_mail[3] = mail.getDate(); | 266 | m_mail[3] = mail->getDate(); |
267 | m_mail[4] = mail.Msgid(); | 267 | m_mail[4] = mail->Msgid(); |
268 | 268 | ||
269 | m_mail2[0] = mail.To(); | 269 | m_mail2[0] = mail->To(); |
270 | m_mail2[1] = mail.CC(); | 270 | m_mail2[1] = mail->CC(); |
271 | m_mail2[2] = mail.Bcc(); | 271 | m_mail2[2] = mail->Bcc(); |
272 | 272 | ||
273 | setText(); | 273 | setText(); |
274 | } | 274 | } |
275 | 275 | ||
276 | 276 | ||
277 | 277 | ||
278 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 278 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
279 | : ViewMailBase(parent, name, fl), _inLoop(false) | 279 | : ViewMailBase(parent, name, fl), _inLoop(false) |
280 | { | 280 | { |
281 | m_gotBody = false; | 281 | m_gotBody = false; |
282 | deleted = false; | 282 | deleted = false; |
283 | 283 | ||
@@ -339,25 +339,25 @@ void ViewMail::setText() | |||
339 | } | 339 | } |
340 | else | 340 | else |
341 | { | 341 | { |
342 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 342 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
343 | } | 343 | } |
344 | // remove later in favor of a real handling | 344 | // remove later in favor of a real handling |
345 | m_gotBody = true; | 345 | m_gotBody = true; |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | ViewMail::~ViewMail() | 349 | ViewMail::~ViewMail() |
350 | { | 350 | { |
351 | m_recMail.Wrapper()->cleanMimeCache(); | 351 | m_recMail->Wrapper()->cleanMimeCache(); |
352 | hide(); | 352 | hide(); |
353 | } | 353 | } |
354 | 354 | ||
355 | void ViewMail::hide() | 355 | void ViewMail::hide() |
356 | { | 356 | { |
357 | QWidget::hide(); | 357 | QWidget::hide(); |
358 | 358 | ||
359 | if (_inLoop) | 359 | if (_inLoop) |
360 | { | 360 | { |
361 | _inLoop = false; | 361 | _inLoop = false; |
362 | qApp->exit_loop(); | 362 | qApp->exit_loop(); |
363 | 363 | ||
@@ -406,36 +406,36 @@ void ViewMail::slotReply() | |||
406 | for (it = lines.begin(); it != lines.end(); it++) | 406 | for (it = lines.begin(); it != lines.end(); it++) |
407 | { | 407 | { |
408 | rtext += "> " + *it + "\n"; | 408 | rtext += "> " + *it + "\n"; |
409 | } | 409 | } |
410 | rtext += "\n"; | 410 | rtext += "\n"; |
411 | 411 | ||
412 | QString prefix; | 412 | QString prefix; |
413 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 413 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
414 | else prefix = "Re: "; // no i18n on purpose | 414 | else prefix = "Re: "; // no i18n on purpose |
415 | 415 | ||
416 | Settings *settings = new Settings(); | 416 | Settings *settings = new Settings(); |
417 | ComposeMail composer( settings ,this, 0, true); | 417 | ComposeMail composer( settings ,this, 0, true); |
418 | if (m_recMail.Replyto().isEmpty()) { | 418 | if (m_recMail->Replyto().isEmpty()) { |
419 | composer.setTo( m_recMail.getFrom()); | 419 | composer.setTo( m_recMail->getFrom()); |
420 | } else { | 420 | } else { |
421 | composer.setTo( m_recMail.Replyto()); | 421 | composer.setTo( m_recMail->Replyto()); |
422 | } | 422 | } |
423 | composer.setSubject( prefix + m_mail[1] ); | 423 | composer.setSubject( prefix + m_mail[1] ); |
424 | composer.setMessage( rtext ); | 424 | composer.setMessage( rtext ); |
425 | composer.setInReplyTo(m_recMail.Msgid()); | 425 | composer.setInReplyTo(m_recMail->Msgid()); |
426 | 426 | ||
427 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) | 427 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) |
428 | { | 428 | { |
429 | m_recMail.Wrapper()->answeredMail(m_recMail); | 429 | m_recMail->Wrapper()->answeredMail(m_recMail); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | void ViewMail::slotForward() | 433 | void ViewMail::slotForward() |
434 | { | 434 | { |
435 | if (!m_gotBody) | 435 | if (!m_gotBody) |
436 | { | 436 | { |
437 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); | 437 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | 440 | ||
441 | QString ftext; | 441 | QString ftext; |
@@ -460,17 +460,17 @@ void ViewMail::slotForward() | |||
460 | ComposeMail composer( settings ,this, 0, true); | 460 | ComposeMail composer( settings ,this, 0, true); |
461 | composer.setSubject( "Fwd: " + m_mail[1] ); | 461 | composer.setSubject( "Fwd: " + m_mail[1] ); |
462 | composer.setMessage( ftext ); | 462 | composer.setMessage( ftext ); |
463 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer )) | 463 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer )) |
464 | { | 464 | { |
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
468 | void ViewMail::slotDeleteMail( ) | 468 | void ViewMail::slotDeleteMail( ) |
469 | { | 469 | { |
470 | 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 ) | 470 | 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 ) |
471 | { | 471 | { |
472 | m_recMail.Wrapper()->deleteMail( m_recMail ); | 472 | m_recMail->Wrapper()->deleteMail( m_recMail ); |
473 | hide(); | 473 | hide(); |
474 | deleted = true; | 474 | deleted = true; |
475 | } | 475 | } |
476 | } | 476 | } |