summaryrefslogtreecommitdiffabout
path: root/kmicromail/viewmail.cpp
Unidiff
Diffstat (limited to 'kmicromail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/viewmail.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 0b4c322..f1e0225 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -1,78 +1,81 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2
3
4
5#include <kfiledialog.h>
6#include "koprefs.h"
7#include <klocale.h>
8#include <kglobal.h>
9#include <kapplication.h>
10
11#ifdef MINIKDE_KDIALOG_H
12#undef MINIKDE_KDIALOG_H
13#endif
14
2#include "composemail.h" 15#include "composemail.h"
3#include "viewmail.h" 16#include "viewmail.h"
4 17
5#include <libmailwrapper/settings.h> 18#include <libmailwrapper/settings.h>
6#include <libmailwrapper/abstractmail.h> 19#include <libmailwrapper/abstractmail.h>
7#include <libmailwrapper/mailtypes.h> 20#include <libmailwrapper/mailtypes.h>
8#include <kapplication.h>
9
10/* OPIE */
11//#include <opie2/odebug.h>
12//#include <opie2/ofiledialog.h>
13//#include <opie2/oimagescrollview.h>
14 21
15#include <kfiledialog.h> 22#include <qdialog.h>
16#include <kdialog.h>
17 23
18#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
19 25
20/* QT */ 26/* QT */
21#include <qtextbrowser.h> 27#include <qtextbrowser.h>
22#include <qmessagebox.h> 28#include <qmessagebox.h>
23#include <qtextstream.h> 29#include <qtextstream.h>
24#include <qaction.h> 30#include <qaction.h>
25#include <qpopupmenu.h> 31#include <qpopupmenu.h>
26#include <qfile.h> 32#include <qfile.h>
27#include <qlayout.h> 33#include <qlayout.h>
28#include "koprefs.h"
29#include <klocale.h>
30#include <kglobal.h>
31 34
32//using namespace Opie::Ui; 35//using namespace Opie::Ui;
33//using namespace Opie::Core; 36//using namespace Opie::Core;
34 37
35AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 38AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
36 const QString&fsize,int num,const QValueList<int>&path) 39 const QString&fsize,int num,const QValueList<int>&path)
37 : QListViewItem(parent,after),_partNum(num) 40 : QListViewItem(parent,after),_partNum(num)
38{ 41{
39 _path=path; 42 _path=path;
40 setText(0, mime); 43 setText(0, mime);
41 setText(1, desc); 44 setText(1, desc);
42 setText(2, file); 45 setText(2, file);
43 setText(3, fsize); 46 setText(3, fsize);
44} 47}
45 48
46AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 49AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
47 const QString&fsize,int num,const QValueList<int>&path) 50 const QString&fsize,int num,const QValueList<int>&path)
48 : QListViewItem(parent,after),_partNum(num) 51 : QListViewItem(parent,after),_partNum(num)
49{ 52{
50 _path=path; 53 _path=path;
51 setText(0, mime); 54 setText(0, mime);
52 setText(1, desc); 55 setText(1, desc);
53 setText(2, file); 56 setText(2, file);
54 setText(3, fsize); 57 setText(3, fsize);
55} 58}
56 59
57bool AttachItem::isParentof(const QValueList<int>&path) 60bool AttachItem::isParentof(const QValueList<int>&path)
58{ 61{
59 /* if not set, then no parent */ 62 /* if not set, then no parent */
60 if (path.count()==0||_path.count()==0) return false; 63 if (path.count()==0||_path.count()==0) return false;
61 /* the parent must have one digit less then a child */ 64 /* the parent must have one digit less then a child */
62 if (path.count()!=_path.count()+1) return false; 65 if (path.count()!=_path.count()+1) return false;
63 for (unsigned int i=0; i < _path.count();++i) 66 for (unsigned int i=0; i < _path.count();++i)
64 { 67 {
65 if (_path[i]!=path[i]) return false; 68 if (_path[i]!=path[i]) return false;
66 } 69 }
67 return true; 70 return true;
68} 71}
69 72
70AttachItem* ViewMail::searchParent(const QValueList<int>&path) 73AttachItem* ViewMail::searchParent(const QValueList<int>&path)
71{ 74{
72 QListViewItemIterator it( attachments ); 75 QListViewItemIterator it( attachments );
73 for ( ; it.current(); ++it ) 76 for ( ; it.current(); ++it )
74 { 77 {
75 AttachItem*ati = (AttachItem*)it.current(); 78 AttachItem*ati = (AttachItem*)it.current();
76 if (ati->isParentof(path)) return ati; 79 if (ati->isParentof(path)) return ati;
77 } 80 }
78 return 0; 81 return 0;
@@ -468,66 +471,66 @@ void ViewMail::slotReply()
468} 471}
469 472
470void ViewMail::slotForward() 473void ViewMail::slotForward()
471{ 474{
472 if (!m_gotBody) 475 if (!m_gotBody)
473 { 476 {
474 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); 477 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
475 return; 478 return;
476 } 479 }
477 480
478 QString ftext; 481 QString ftext;
479 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 482 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
480 .arg( m_mail[0] ); 483 .arg( m_mail[0] );
481 if (!m_mail[3].isNull()) 484 if (!m_mail[3].isNull())
482 ftext += QString("Date: %1\n") 485 ftext += QString("Date: %1\n")
483 .arg( m_mail[3] ); 486 .arg( m_mail[3] );
484 if (!m_mail[0].isNull()) 487 if (!m_mail[0].isNull())
485 ftext += QString("From: %1\n") 488 ftext += QString("From: %1\n")
486 .arg( m_mail[0] ); 489 .arg( m_mail[0] );
487 if (!m_mail[1].isNull()) 490 if (!m_mail[1].isNull())
488 ftext += QString("Subject: %1\n") 491 ftext += QString("Subject: %1\n")
489 .arg( m_mail[1] ); 492 .arg( m_mail[1] );
490 493
491 ftext += QString("\n%1\n") 494 ftext += QString("\n%1\n")
492 .arg( m_mail[2]); 495 .arg( m_mail[2]);
493 496
494 ftext += QString("----- End forwarded message -----\n"); 497 ftext += QString("----- End forwarded message -----\n");
495 498
496 Settings *settings = new Settings(); 499 Settings *settings = new Settings();
497 ComposeMail composer( settings ,this, 0, true); 500 ComposeMail composer( settings ,this, 0, true);
498 composer.setSubject( "Fwd: " + m_mail[1] ); 501 composer.setSubject( "Fwd: " + m_mail[1] );
499 composer.setMessage( ftext ); 502 composer.setMessage( ftext );
500 if ( QDialog::Accepted == KApplication::execDialog( &composer )) 503 if ( QDialog::Accepted == KApplication::execDialog( &composer ))
501 { 504 {
502 } 505 }
503} 506}
504 507
505void ViewMail::slotDeleteMail( ) 508void ViewMail::slotDeleteMail( )
506{ 509{
507 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 510 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
508 { 511 {
509 m_recMail->Wrapper()->deleteMail( m_recMail ); 512 m_recMail->Wrapper()->deleteMail( m_recMail );
510 hide(); 513 hide();
511 deleted = true; 514 deleted = true;
512 } 515 }
513} 516}
514 517
515MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) 518MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
516 : KDialog(parent,name,modal) 519 : QDialog(parent,name,modal)
517{ 520{
518 QVBoxLayout*dlglayout = new QVBoxLayout(this); 521 QVBoxLayout*dlglayout = new QVBoxLayout(this);
519 dlglayout->setSpacing(2); 522 dlglayout->setSpacing(2);
520 dlglayout->setMargin(1); 523 dlglayout->setMargin(1);
521 //m_imageview = new Opie::MM::OImageScrollView(this); 524 //m_imageview = new Opie::MM::OImageScrollView(this);
522 //dlglayout->addWidget(m_imageview); 525 //dlglayout->addWidget(m_imageview);
523} 526}
524 527
525MailImageDlg::~MailImageDlg() 528MailImageDlg::~MailImageDlg()
526{ 529{
527} 530}
528 531
529void MailImageDlg::setName(const QString&fname) 532void MailImageDlg::setName(const QString&fname)
530{ 533{
531 qDebug("viewmail.cpp: MailImageDlg::setName Pending"); 534 qDebug("viewmail.cpp: MailImageDlg::setName Pending");
532 // m_imageview->setImage(fname); 535 // m_imageview->setImage(fname);
533} 536}