summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-09 23:51:22 (UTC)
committer harlekin <harlekin>2003-12-09 23:51:22 (UTC)
commite8ca3ebcf4cf356497670a455f43e08a16c0f2aa (patch) (unidiff)
tree0fa7ad39387559a527bee58d24cbc4ac50a35e23
parentc361d36374d9c333ffe4b853067858df5636e1a5 (diff)
downloadopie-e8ca3ebcf4cf356497670a455f43e08a16c0f2aa.zip
opie-e8ca3ebcf4cf356497670a455f43e08a16c0f2aa.tar.gz
opie-e8ca3ebcf4cf356497670a455f43e08a16c0f2aa.tar.bz2
more updated to the mail viewer
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp17
-rw-r--r--noncore/net/mail/composemail.h3
-rw-r--r--noncore/net/mail/viewmail.cpp50
3 files changed, 39 insertions, 31 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 88dd780..96787e4 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,173 +1,174 @@
1#include <qt.h> 1#include <qt.h>
2 2
3#include <opie/ofiledialog.h> 3#include <opie/ofiledialog.h>
4#include <qpe/resource.h> 4#include <qpe/resource.h>
5 5
6#include "composemail.h" 6#include "composemail.h"
7 7
8ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 8ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
9 : ComposeMailUI( parent, name, modal, flags ) 9 : ComposeMailUI( parent, name, modal, flags )
10{ 10{
11 settings = s; 11 settings = s;
12 12
13 attList->addColumn( tr( "Name" ) ); 13 attList->addColumn( tr( "Name" ) );
14 attList->addColumn( tr( "Size" ) ); 14 attList->addColumn( tr( "Size" ) );
15 15
16 QList<Account> accounts = settings->getAccounts(); 16 QList<Account> accounts = settings->getAccounts();
17 Account *it; 17 Account *it;
18 for ( it = accounts.first(); it; it = accounts.next() ) { 18 for ( it = accounts.first(); it; it = accounts.next() ) {
19 if ( it->getType().compare( "SMTP" ) == 0 ) { 19 if ( it->getType().compare( "SMTP" ) == 0 ) {
20 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 20 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
21 fromBox->insertItem( smtp->getMail() ); 21 fromBox->insertItem( smtp->getMail() );
22 smtpAccounts.append( smtp ); 22 smtpAccounts.append( smtp );
23 } 23 }
24 } 24 }
25 25
26 if ( smtpAccounts.count() > 0 ) { 26 if ( smtpAccounts.count() > 0 ) {
27 fillValues( fromBox->currentItem() ); 27 fillValues( fromBox->currentItem() );
28 } else { 28 } else {
29 QMessageBox::information( this, tr( "Problem" ), 29 QMessageBox::information( this, tr( "Problem" ),
30 tr( "<p>Please create an SMTP account first.</p>" ), 30 tr( "<p>Please create an SMTP account first.</p>" ),
31 tr( "Ok" ) ); 31 tr( "Ok" ) );
32 } 32 }
33 33
34 connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); 34 connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) );
35 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 35 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
36 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 36 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
37 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 37 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
38 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 38 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
39 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 39 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
40 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 40 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
41} 41}
42 42
43void ComposeMail::pickAddress( QLineEdit *line ) 43void ComposeMail::pickAddress( QLineEdit *line )
44{ 44{
45 QString names = AddressPicker::getNames(); 45 QString names = AddressPicker::getNames();
46 if ( line->text().isEmpty() ) { 46 if ( line->text().isEmpty() ) {
47 line->setText( names ); 47 line->setText( names );
48 } else if ( !names.isEmpty() ) { 48 } else if ( !names.isEmpty() ) {
49 line->setText( line->text() + ", " + names ); 49 line->setText( line->text() + ", " + names );
50 } 50 }
51} 51}
52 52
53
53void ComposeMail::pickAddressTo() 54void ComposeMail::pickAddressTo()
54{ 55{
55 pickAddress( toLine ); 56 pickAddress( toLine );
56} 57}
57 58
58void ComposeMail::pickAddressCC() 59void ComposeMail::pickAddressCC()
59{ 60{
60 pickAddress( ccLine ); 61 pickAddress( ccLine );
61} 62}
62 63
63void ComposeMail::pickAddressBCC() 64void ComposeMail::pickAddressBCC()
64{ 65{
65 pickAddress( bccLine ); 66 pickAddress( bccLine );
66} 67}
67 68
68void ComposeMail::pickAddressReply() 69void ComposeMail::pickAddressReply()
69{ 70{
70 pickAddress( replyLine ); 71 pickAddress( replyLine );
71} 72}
72 73
73void ComposeMail::fillValues( int current ) 74void ComposeMail::fillValues( int current )
74{ 75{
75 SMTPaccount *smtp = smtpAccounts.at( current ); 76 SMTPaccount *smtp = smtpAccounts.at( current );
76 77
77 ccLine->clear(); 78 ccLine->clear();
78 if ( smtp->getUseCC() ) { 79 if ( smtp->getUseCC() ) {
79 ccLine->setText( smtp->getCC() ); 80 ccLine->setText( smtp->getCC() );
80 } 81 }
81 bccLine->clear(); 82 bccLine->clear();
82 if ( smtp->getUseBCC() ) { 83 if ( smtp->getUseBCC() ) {
83 bccLine->setText( smtp->getBCC() ); 84 bccLine->setText( smtp->getBCC() );
84 } 85 }
85 replyLine->clear(); 86 replyLine->clear();
86 if ( smtp->getUseReply() ) { 87 if ( smtp->getUseReply() ) {
87 replyLine->setText( smtp->getReply() ); 88 replyLine->setText( smtp->getReply() );
88 } 89 }
89 90
90 sigMultiLine->setText( smtp->getSignature() ); 91 sigMultiLine->setText( smtp->getSignature() );
91} 92}
92 93
93void ComposeMail::slotAdjustColumns() 94void ComposeMail::slotAdjustColumns()
94{ 95{
95 int currPage = tabWidget->currentPageIndex(); 96 int currPage = tabWidget->currentPageIndex();
96 97
97 tabWidget->showPage( attachTab ); 98 tabWidget->showPage( attachTab );
98 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 99 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
99 attList->setColumnWidth( 1, 80 ); 100 attList->setColumnWidth( 1, 80 );
100 101
101 tabWidget->setCurrentPage( currPage ); 102 tabWidget->setCurrentPage( currPage );
102} 103}
103 104
104void ComposeMail::addAttachment() 105void ComposeMail::addAttachment()
105{ 106{
106 DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" ); 107 DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" );
107 if ( !lnk.name().isEmpty() ) { 108 if ( !lnk.name().isEmpty() ) {
108 Attachment *att = new Attachment( lnk ); 109 Attachment *att = new Attachment( lnk );
109 (void) new AttachViewItem( attList, att ); 110 (void) new AttachViewItem( attList, att );
110 } 111 }
111} 112}
112 113
113void ComposeMail::removeAttachment() 114void ComposeMail::removeAttachment()
114{ 115{
115 if ( !attList->currentItem() ) { 116 if ( !attList->currentItem() ) {
116 QMessageBox::information( this, tr( "Error" ), 117 QMessageBox::information( this, tr( "Error" ),
117 tr( "<p>Please select a File.</p>" ), 118 tr( "<p>Please select a File.</p>" ),
118 tr( "Ok" ) ); 119 tr( "Ok" ) );
119 } else { 120 } else {
120 attList->takeItem( attList->currentItem() ); 121 attList->takeItem( attList->currentItem() );
121 } 122 }
122} 123}
123 124
124void ComposeMail::accept() 125void ComposeMail::accept()
125{ 126{
126 qDebug( "Sending Mail with " + 127 qDebug( "Sending Mail with " +
127 smtpAccounts.at( fromBox->currentItem() )->getAccountName() ); 128 smtpAccounts.at( fromBox->currentItem() )->getAccountName() );
128 Mail *mail = new Mail(); 129 Mail *mail = new Mail();
129 SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() ); 130 SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() );
130 mail->setMail( smtp->getMail() ); 131 mail->setMail( smtp->getMail() );
131 mail->setName( smtp->getName() ); 132 mail->setName( smtp->getName() );
132 133
133 if ( !toLine->text().isEmpty() ) { 134 if ( !toLine->text().isEmpty() ) {
134 mail->setTo( toLine->text() ); 135 mail->setTo( toLine->text() );
135 } else { 136 } else {
136 qDebug( "No Reciever spezified -> returning" ); 137 qDebug( "No Reciever spezified -> returning" );
137 return; 138 return;
138 } 139 }
139 140
140 mail->setCC( ccLine->text() ); 141 mail->setCC( ccLine->text() );
141 mail->setBCC( bccLine->text() ); 142 mail->setBCC( bccLine->text() );
142 mail->setReply( replyLine->text() ); 143 mail->setReply( replyLine->text() );
143 mail->setSubject( subjectLine->text() ); 144 mail->setSubject( subjectLine->text() );
144 QString txt = message->text(); 145 QString txt = message->text();
145 if ( !sigMultiLine->text().isEmpty() ) { 146 if ( !sigMultiLine->text().isEmpty() ) {
146 txt.append( "\n--\n" ); 147 txt.append( "\n--\n" );
147 txt.append( sigMultiLine->text() ); 148 txt.append( sigMultiLine->text() );
148 } 149 }
149 mail->setMessage( txt ); 150 mail->setMessage( txt );
150 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 151 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
151 while ( it != NULL ) { 152 while ( it != NULL ) {
152 mail->addAttachment( it->getAttachment() ); 153 mail->addAttachment( it->getAttachment() );
153 it = (AttachViewItem *) it->itemBelow(); 154 it = (AttachViewItem *) it->itemBelow();
154 } 155 }
155 156
156 MailWrapper wrapper( settings ); 157 MailWrapper wrapper( settings );
157 wrapper.sendMail( *mail ); 158 wrapper.sendMail( *mail );
158 159
159 QDialog::accept(); 160 QDialog::accept();
160} 161}
161 162
162AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 163AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
163 : QListViewItem( parent ) 164 : QListViewItem( parent )
164{ 165{
165 attachment = att; 166 attachment = att;
166 qDebug( att->getMimeType() ); 167 qDebug( att->getMimeType() );
167 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 168 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
168 Resource::loadPixmap( "UnknownDocument-14" ) : 169 Resource::loadPixmap( "UnknownDocument-14" ) :
169 attachment->getDocLnk().pixmap() ); 170 attachment->getDocLnk().pixmap() );
170 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 171 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
171 setText( 1, QString::number( att->getSize() ) ); 172 setText( 1, QString::number( att->getSize() ) );
172} 173}
173 174
diff --git a/noncore/net/mail/composemail.h b/noncore/net/mail/composemail.h
index c7ae22a..196a471 100644
--- a/noncore/net/mail/composemail.h
+++ b/noncore/net/mail/composemail.h
@@ -14,55 +14,58 @@ class AddressPicker : public AddressPickerUI
14{ 14{
15 Q_OBJECT 15 Q_OBJECT
16 16
17public: 17public:
18 AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); 18 AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
19 static QString getNames(); 19 static QString getNames();
20 20
21protected: 21protected:
22 QString selectedNames; 22 QString selectedNames;
23 void accept(); 23 void accept();
24 24
25}; 25};
26 26
27 27
28class ComposeMail : public ComposeMailUI 28class ComposeMail : public ComposeMailUI
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31 31
32public: 32public:
33 ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); 33 ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
34 34
35public slots: 35public slots:
36 void slotAdjustColumns(); 36 void slotAdjustColumns();
37 37
38
38protected slots: 39protected slots:
39 void accept(); 40 void accept();
40 41
41private slots: 42private slots:
42 void fillValues( int current ); 43 void fillValues( int current );
43 void pickAddress( QLineEdit *line ); 44 void pickAddress( QLineEdit *line );
44 void pickAddressTo(); 45 void pickAddressTo();
45 void pickAddressCC(); 46 void pickAddressCC();
46 void pickAddressBCC(); 47 void pickAddressBCC();
47 void pickAddressReply(); 48 void pickAddressReply();
48 void addAttachment(); 49 void addAttachment();
49 void removeAttachment(); 50 void removeAttachment();
50 51
52
53
51private: 54private:
52 Settings *settings; 55 Settings *settings;
53 QList<SMTPaccount> smtpAccounts; 56 QList<SMTPaccount> smtpAccounts;
54 57
55}; 58};
56 59
57class AttachViewItem : public QListViewItem 60class AttachViewItem : public QListViewItem
58{ 61{
59 public: 62 public:
60 AttachViewItem( QListView *parent, Attachment *att ); 63 AttachViewItem( QListView *parent, Attachment *att );
61 Attachment *getAttachment() { return attachment; } 64 Attachment *getAttachment() { return attachment; }
62 65
63private: 66private:
64 Attachment *attachment; 67 Attachment *attachment;
65 68
66}; 69};
67 70
68#endif 71#endif
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index cba9948..ed3ece9 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -1,31 +1,31 @@
1#include <qtextbrowser.h> 1#include <qtextbrowser.h>
2#include <qmessagebox.h> 2#include <qmessagebox.h>
3#include <qaction.h> 3#include <qaction.h>
4#include <qapplication.h> 4#include <qapplication.h>
5 5
6//#include "mailfactory.h" 6#include "settings.h"
7//#include "composer.h" 7#include "composemail.h"
8#include "viewmail.h" 8#include "viewmail.h"
9 9
10AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore) 10AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore)
11 : QListViewItem(parent), _attachItemStore(attachItemStore) 11 : QListViewItem(parent), _attachItemStore(attachItemStore)
12{ 12{
13 setText(0, _attachItemStore.mimeType()); 13 setText(0, _attachItemStore.mimeType());
14 setText(1, _attachItemStore.fileName()); 14 setText(1, _attachItemStore.fileName());
15 setText(2, _attachItemStore.description()); 15 setText(2, _attachItemStore.description());
16} 16}
17 17
18AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore) 18AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore)
19 : QListViewItem(parent), _attachItemStore(attachItemStore) 19 : QListViewItem(parent), _attachItemStore(attachItemStore)
20{ 20{
21 setText(0, _attachItemStore.mimeType()); 21 setText(0, _attachItemStore.mimeType());
22 setText(1, _attachItemStore.fileName()); 22 setText(1, _attachItemStore.fileName());
23 setText(2, _attachItemStore.description()); 23 setText(2, _attachItemStore.description());
24} 24}
25 25
26void ViewMail::setMailInfo( const QString & from, const QStringList & to, const QString & subject, const QStringList & cc, const QStringList & bcc, const QString & date, const QString & bodytext ) { 26void ViewMail::setMailInfo( const QString & from, const QStringList & to, const QString & subject, const QStringList & cc, const QStringList & bcc, const QString & date, const QString & bodytext ) {
27 27
28m_mail[0] = from; 28m_mail[0] = from;
29m_mail2[0] = to; 29m_mail2[0] = to;
30m_mail[1] = subject; 30m_mail[1] = subject;
31m_mail2[1] = cc; 31m_mail2[1] = cc;
@@ -52,136 +52,140 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
52 //connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &))); 52 //connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &)));
53} 53}
54 54
55void ViewMail::setText() 55void ViewMail::setText()
56{ 56{
57 57
58 QString toString; 58 QString toString;
59 QString ccString; 59 QString ccString;
60 QString bccString; 60 QString bccString;
61 61
62 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { 62 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) {
63 toString += (*it); 63 toString += (*it);
64 } 64 }
65 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { 65 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) {
66 ccString += (*it); 66 ccString += (*it);
67 } 67 }
68 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { 68 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) {
69 bccString += (*it); 69 bccString += (*it);
70 } 70 }
71 71
72 setCaption( caption().arg( m_mail[0] ) ); 72 setCaption( caption().arg( m_mail[0] ) );
73 73
74 _mailHtml = tr( 74 _mailHtml = tr(
75 "<html><body>" 75 "<html><body>"
76 "<div align=center><b>%1</b></div>" 76 "<div align=center><b><font color=#FF2222>%1</b></font></div>"
77 "<b>From:</b> %2<br>" 77 "<b>From:</b> %2<br>"
78 "<b>To:</b> %3<br>" 78 "<b>To:</b> %3<br>"
79 "%4" 79 "%4"
80 "%5" 80 "%5"
81 "<b>Date:</b> %6<hr>" 81 "<b>Date:</b> %6<hr>"
82 "<font face=fixed>%7</font>") 82 "<font face=fixed>")
83 .arg( deHtml( m_mail[1] ) ) 83 .arg( deHtml( m_mail[1] ) )
84 .arg( deHtml( m_mail[0] ) ) 84 .arg( deHtml( m_mail[0] ) )
85 .arg( deHtml( toString ) ) 85 .arg( deHtml( toString ) )
86 .arg( tr("<b>Cc:</b> %1<br>").arg( deHtml( ccString ) ) ) 86 .arg( tr("<b>Cc:</b> %1<br>").arg( deHtml( ccString ) ) )
87 .arg( tr("<b>Bcc:</b> %1<br>").arg( deHtml( bccString ) ) ) 87 .arg( tr("<b>Bcc:</b> %1<br>").arg( deHtml( bccString ) ) )
88 .arg( m_mail[3] ) 88 .arg( m_mail[3] );
89 .arg("%1"); 89 browser->setText( QString(_mailHtml) + deHtml( m_mail[2] ) + "</font>" );
90 browser->setText( QString(_mailHtml) + deHtml( m_mail[2] ) ); 90 // remove later in favor of a real handling
91 _gotBody = true;
91} 92}
92 93
93 94
94 95
95ViewMail::~ViewMail() 96ViewMail::~ViewMail()
96{ 97{
97 hide(); 98 hide();
98} 99}
99 100
100void ViewMail::hide() 101void ViewMail::hide()
101{ 102{
102 QWidget::hide(); 103 QWidget::hide();
103 104
104 if (_inLoop) { 105 if (_inLoop) {
105 _inLoop = false; 106 _inLoop = false;
106 qApp->exit_loop(); 107 qApp->exit_loop();
107 } 108 }
108} 109}
109 110
110void ViewMail::exec() 111void ViewMail::exec()
111{ 112{
112 show(); 113 show();
113 114
114 if (!_inLoop) { 115 if (!_inLoop) {
115 _inLoop = true; 116 _inLoop = true;
116 qApp->enter_loop(); 117 qApp->enter_loop();
117 } 118 }
118} 119}
119 120
120QString ViewMail::deHtml(const QString &string) 121QString ViewMail::deHtml(const QString &string)
121{ 122{
122 QString string_ = string; 123 QString string_ = string;
123 string_.replace(QRegExp("&"), "&amp;"); 124 string_.replace(QRegExp("&"), "&amp;");
124 string_.replace(QRegExp("<"), "&lt;"); 125 string_.replace(QRegExp("<"), "&lt;");
125 string_.replace(QRegExp(">"), "&gt;"); 126 string_.replace(QRegExp(">"), "&gt;");
126 string_.replace(QRegExp("\\n"), "<br>"); 127 string_.replace(QRegExp("\\n"), "<br>");
127 return string_; 128 return string_;
128} 129}
129 130
130void ViewMail::slotReply() 131void ViewMail::slotReply()
131{ 132{
132 if (!_gotBody) { 133 if (!_gotBody) {
133 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); 134 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok"));
134 return; 135 return;
135 } 136 }
136 137
137 QString rtext; 138 QString rtext;
138 // rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 139 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
139 // .arg(_mail.envelope().from()[0].toString()) 140 .arg( m_mail[1] )
140 // .arg(_mail.envelope().mailDate()); 141 .arg( m_mail[3] );
141 142
142 //QString text = _mail.bodyPart(1).data(); 143 QString text = m_mail[2];
143 //QStringList lines = QStringList::split(QRegExp("\\n"), text); 144 QStringList lines = QStringList::split(QRegExp("\\n"), text);
144 QStringList::Iterator it; 145 QStringList::Iterator it;
145 //for (it = lines.begin(); it != lines.end(); it++) { 146 for (it = lines.begin(); it != lines.end(); it++) {
146 // rtext += "> " + *it + "\n"; 147 rtext += "> " + *it + "\n";
147 //} 148 }
148 rtext += "\n"; 149 rtext += "\n";
149 150
150 QString prefix; 151 QString prefix;
151 //if (_mail.envelope().subject().find(QRegExp("^Re: *$")) != -1) prefix = ""; 152 if ( m_mail[1].find(QRegExp("^Re: *$")) != -1) prefix = "";
152 // else prefix = "Re: "; // no i18n on purpose 153 else prefix = "Re: "; // no i18n on purpose
153 154
154 //SendMail sendMail; 155 //SendMail sendMail;
155 //sendMail.setTo(_mail.envelope().from()[0].toString()); 156 //sendMail.setTo(_mail.envelope().from()[0].toString());
156 //sendMail.setSubject(prefix + _mail.envelope().subject()); 157 //sendMail.setSubject(prefix + _mail.envelope().subject());
157 //sendMail.setInReplyTo(_mail.envelope().messageId()); 158 //sendMail.setInReplyTo(_mail.envelope().messageId());
158 //sendMail.setMessage(rtext); 159 //sendMail.setMessage(rtext);
159 160
160 //Composer composer(this, 0, true); 161
161 //composer.setSendMail(sendMail); 162/* ComposeMail composer(this, 0, true);
162 //composer.showMaximized(); 163 composer.setMessage( );
163 //composer.exec(); 164 composer.showMaximized();
165 composer.exec();
166*/
167 qDebug ( rtext );
164} 168}
165 169
166void ViewMail::slotForward() 170void ViewMail::slotForward()
167{ 171{
168 if (!_gotBody) { 172 if (!_gotBody) {
169 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); 173 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok"));
170 return; 174 return;
171 } 175 }
172 176
173 QString ftext; 177 QString ftext;
174 /*ftext += QString("\n----- Forwarded message from %1 -----\n\n") 178 /*ftext += QString("\n----- Forwarded message from %1 -----\n\n")
175 .arg(_mail.envelope().from()[0].toString()); 179 .arg(_mail.envelope().from()[0].toString());
176 if (!_mail.envelope().mailDate().isNull()) 180 if (!_mail.envelope().mailDate().isNull())
177 ftext += QString("Date: %1\n") 181 ftext += QString("Date: %1\n")
178 .arg(_mail.envelope().mailDate()); 182 .arg(_mail.envelope().mailDate());
179 if (!_mail.envelope().from()[0].toString().isNull()) 183 if (!_mail.envelope().from()[0].toString().isNull())
180 ftext += QString("From: %1\n") 184 ftext += QString("From: %1\n")
181 .arg(_mail.envelope().from()[0].toString()); 185 .arg(_mail.envelope().from()[0].toString());
182 if (!_mail.envelope().to().toString().isNull()) 186 if (!_mail.envelope().to().toString().isNull())
183 ftext += QString("To: %1\n") 187 ftext += QString("To: %1\n")
184 .arg(_mail.envelope().to().toString()); 188 .arg(_mail.envelope().to().toString());
185 if (!_mail.envelope().cc().toString().isNull()) 189 if (!_mail.envelope().cc().toString().isNull())
186 ftext += QString("Cc: %1\n") 190 ftext += QString("Cc: %1\n")
187 .arg(_mail.envelope().cc().toString()); 191 .arg(_mail.envelope().cc().toString());