summaryrefslogtreecommitdiff
path: root/noncore/net/mail
Unidiff
Diffstat (limited to 'noncore/net/mail') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp5
-rw-r--r--noncore/net/mail/viewmail.cpp95
-rw-r--r--noncore/net/mail/viewmail.h27
3 files changed, 43 insertions, 84 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 6d13a8b..1d6e901 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -153,3 +153,2 @@ void MainWindow::displayMail(QListViewItem*item)
153 if (!item) return; 153 if (!item) return;
154 qDebug("View mail");
155 RecMail mail = ((MailListViewItem*)item)->data(); 154 RecMail mail = ((MailListViewItem*)item)->data();
@@ -158,4 +157,4 @@ void MainWindow::displayMail(QListViewItem*item)
158 ViewMail readMail( this ); 157 ViewMail readMail( this );
159 158 readMail.setBody( body );
160 readMail.setMailInfo( mail.getFrom(), mail.To(), mail.getSubject(), mail.CC(), mail.Bcc(), mail.getDate(), body.Bodytext(), mail.Msgid() ); 159 readMail.setMail( mail );
161 readMail.showMaximized(); 160 readMail.showMaximized();
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 7969235..7b8494d 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -25,12 +25,19 @@ AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore)
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, const QString & messageID ) {
27 26
28m_mail[0] = from; 27void ViewMail::setBody( RecBody body ) {
29m_mail2[0] = to; 28
30m_mail[1] = subject; 29m_mail[2] = body.Bodytext();
31m_mail2[1] = cc; 30
32m_mail2[2] = bcc; 31}
33m_mail[2] = bodytext; 32
34m_mail[3] = date; 33void ViewMail::setMail( RecMail mail ) {
35m_mail[4] = messageID; 34
35m_mail[0] = mail.getFrom();
36m_mail[1] = mail.getSubject();
37m_mail[3] = mail.getDate();
38m_mail[4] = mail.Msgid();
39
40m_mail2[0] = mail.To();
41m_mail2[1] = mail.CC();
42m_mail2[2] = mail.Bcc();
36 43
@@ -40,2 +47,3 @@ setText();
40 47
48
41ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 49ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
@@ -43,3 +51,3 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
43{ 51{
44 _gotBody = false; 52 m_gotBody = false;
45 53
@@ -48,6 +56,3 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
48 56
49 attachments->setEnabled(_gotBody); 57 attachments->setEnabled(m_gotBody);
50
51 //_handler->iUid("FETCH", QString("%1 (BODY[1])").arg(mail.uid()));
52 //connect(_handler, SIGNAL(gotResponse(IMAPResponse &)), SLOT(slotIMAPUid(IMAPResponse &)));
53} 58}
@@ -73,18 +78,15 @@ void ViewMail::setText()
73 78
74 _mailHtml = tr( 79 m_mailHtml = "<html><body>"
75 "<html><body>" 80 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
76 "<div align=center><b><font color=#0000FF>%1</b></font></div>" 81 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
77 "<b>From:</b><font color=#6C86C0> %2</font><br>" 82 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
78 "<b>To:</b><font color=#6C86C0> %3</font><br>" 83 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
79 "%4" 84 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
80 "<b>Date:</b> %5<hr>" 85 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
81 "<font face=fixed>") 86 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
82 .arg( deHtml( m_mail[1] ) ) 87 "</td></tr></table><font face=fixed>";
83 .arg( deHtml( m_mail[0] ) ) 88
84 .arg( deHtml( toString ) ) 89 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
85 .arg( tr("<b>Cc:</b> %1<br>").arg( deHtml( ccString ) ) )
86 .arg( m_mail[3] );
87 browser->setText( QString(_mailHtml) + deHtml( m_mail[2] ) + "</font>" );
88 // remove later in favor of a real handling 90 // remove later in favor of a real handling
89 _gotBody = true; 91 m_gotBody = true;
90} 92}
@@ -92,3 +94,2 @@ void ViewMail::setText()
92 94
93
94ViewMail::~ViewMail() 95ViewMail::~ViewMail()
@@ -130,3 +131,3 @@ void ViewMail::slotReply()
130{ 131{
131 if (!_gotBody) { 132 if (!m_gotBody) {
132 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); 133 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok"));
@@ -160,3 +161,2 @@ void ViewMail::slotReply()
160 161
161 qDebug ( rtext );
162} 162}
@@ -165,3 +165,3 @@ void ViewMail::slotForward()
165{ 165{
166 if (!_gotBody) { 166 if (!m_gotBody) {
167 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); 167 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok"));
@@ -179,8 +179,2 @@ void ViewMail::slotForward()
179 .arg( m_mail[0] ); 179 .arg( m_mail[0] );
180 //if (!_mail.envelope().to().toString().isNull())
181 //ftext += QString("To: %1\n")
182 // .arg(_mail.envelope().to().toString());
183 //if (!_mail.envelope().cc().toString().isNull())
184 //ftext += QString("Cc: %1\n")
185 // .arg(_mail.envelope().cc().toString());
186 if (!m_mail[1].isNull()) 180 if (!m_mail[1].isNull())
@@ -194,5 +188,2 @@ void ViewMail::slotForward()
194 188
195 qDebug( ftext );
196
197
198 Settings *settings = new Settings(); 189 Settings *settings = new Settings();
@@ -205,21 +196 @@ void ViewMail::slotForward()
205
206/*
207void ViewMail::slotIMAPUid(IMAPResponse &response)
208{
209 disconnect(_handler, SIGNAL(gotResponse(IMAPResponse &)), this, SLOT(slotIMAPUid(IMAPResponse &)));
210
211 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
212 QValueList<IMAPResponseBodyPart> bodyParts;
213 bodyParts.append(response.FETCH()[0].bodyPart(0));
214 _mail.setBodyParts(bodyParts);
215
216 browser->setText(QString(_mailHtml).arg(deHtml(response.FETCH()[0].bodyPart(0).data())));
217
218 // fillList(response.FETCH()[0].bodyStructure());
219
220 _gotBody = true;
221 } else {
222 QMessageBox::warning(this, tr("Error"), tr("<p>I was unable to retrieve the mail from the server. You can try again later or give up.</p>"), tr("Ok"));
223 }
224}
225*/
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index 258c09b..61baa1d 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -8,4 +8,3 @@
8#include "viewmailbase.h" 8#include "viewmailbase.h"
9//#include "imapresponse.h" 9#include "mailtypes.h"
10//#include "mailtable.h"
11 10
@@ -51,7 +50,6 @@ public:
51 void exec(); 50 void exec();
52 static QString appName() { return QString::fromLatin1("mail"); } 51 void setMail( RecMail mail );
53 void setMailInfo( const QString & from, const QStringList & to, const QString & subject, const QStringList & cc, const QStringList & bcc,const QString & date, const QString & bodytext, const QString & messageID ); 52 void setBody( RecBody body );
54 53
55protected: 54protected:
56 //void fillList(IMAPResponseBODYSTRUCTURE &structure);
57 QString deHtml(const QString &string); 55 QString deHtml(const QString &string);
@@ -63,19 +61,10 @@ protected slots:
63 61
64 //void slotIMAPUid(IMAPResponse &response);
65
66private: 62private:
67 bool _inLoop; 63 bool _inLoop;
68 //IMAPResponseFETCH _mail; 64 QString m_mailHtml;
69 //IMAPHandler *_handler; 65 bool m_gotBody;
70 QString _mailHtml; 66
71 bool _gotBody; 67 // 0 from 1 subject 2 bodytext 3 date
72
73 // 0 from
74 // 1 subject
75 // 2 bodytext
76 // 3 date
77 QMap <int,QString> m_mail; 68 QMap <int,QString> m_mail;
78 // 0 to 69 // 0 to 1 cc 2 bcc
79 // 1 cc
80 // 2 bcc
81 QMap <int,QStringList> m_mail2; 70 QMap <int,QStringList> m_mail2;