summaryrefslogtreecommitdiff
path: root/noncore/net/mail/viewmail.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/viewmail.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index d86454c..e11fe1f 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -3,12 +3,14 @@
3#include <qtextstream.h> 3#include <qtextstream.h>
4#include <qaction.h> 4#include <qaction.h>
5#include <qpopupmenu.h> 5#include <qpopupmenu.h>
6#include <qfile.h> 6#include <qfile.h>
7#include <qapplication.h> 7#include <qapplication.h>
8 8
9#include <qpe/config.h>
10
9#include <opie/ofiledialog.h> 11#include <opie/ofiledialog.h>
10 12
11#include "settings.h" 13#include "settings.h"
12#include "composemail.h" 14#include "composemail.h"
13#include "viewmail.h" 15#include "viewmail.h"
14#include "abstractmail.h" 16#include "abstractmail.h"
@@ -106,12 +108,18 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
106 o << s << " " << q << "Byte"; 108 o << s << " " << q << "Byte";
107 desc = body.Parts()[i].Description(); 109 desc = body.Parts()[i].Description();
108 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i); 110 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i);
109} 111}
110} 112}
111 113
114
115void ViewMail::slotShowHtml( bool state ) {
116 m_showHtml = state;
117 setText();
118}
119
112void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { 120void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) {
113 if (!item ) 121 if (!item )
114 return; 122 return;
115 123
116 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { 124 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) {
117 setText(); 125 setText();
@@ -186,19 +194,28 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
186 m_gotBody = false; 194 m_gotBody = false;
187 deleted = false; 195 deleted = false;
188 196
189 connect(reply, SIGNAL(activated()), SLOT(slotReply())); 197 connect(reply, SIGNAL(activated()), SLOT(slotReply()));
190 connect(forward, SIGNAL(activated()), SLOT(slotForward())); 198 connect(forward, SIGNAL(activated()), SLOT(slotForward()));
191 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); 199 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) );
200 connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) );
192 201
193 attachments->setEnabled(m_gotBody); 202 attachments->setEnabled(m_gotBody);
194 connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); 203 connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) );
195 204
205 readConfig();
196 206
197} 207}
198 208
209void ViewMail::readConfig() {
210 Config cfg( "mail" );
211 cfg.setGroup( "Settings" );
212 m_showHtml = cfg.readBoolEntry( "showHtml", false );
213 showHtml->setOn( m_showHtml );
214}
215
199void ViewMail::setText() 216void ViewMail::setText()
200{ 217{
201 218
202 QString toString; 219 QString toString;
203 QString ccString; 220 QString ccString;
204 QString bccString; 221 QString bccString;
@@ -222,13 +239,17 @@ void ViewMail::setText()
222 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 239 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
223 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 240 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
224 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 241 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
225 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + 242 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
226 "</td></tr></table><font face=fixed>"; 243 "</td></tr></table><font face=fixed>";
227 244
245 if ( !m_showHtml ) {
228 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 246 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
247 } else {
248 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
249 }
229 // remove later in favor of a real handling 250 // remove later in favor of a real handling
230 m_gotBody = true; 251 m_gotBody = true;
231} 252}
232 253
233 254
234ViewMail::~ViewMail() 255ViewMail::~ViewMail()