summaryrefslogtreecommitdiff
path: root/noncore/net/mail/viewmail.cpp
authorharlekin <harlekin>2003-12-20 00:05:37 (UTC)
committer harlekin <harlekin>2003-12-20 00:05:37 (UTC)
commitdc088ad432189b4883f7654ef6b2c1e2f69112cc (patch) (unidiff)
tree090f6afd960e644d7da1fae3b8c8ffa97b669b59 /noncore/net/mail/viewmail.cpp
parent00a0c8cf03fe746c1e3ba608bf298c8e66d065f9 (diff)
downloadopie-dc088ad432189b4883f7654ef6b2c1e2f69112cc.zip
opie-dc088ad432189b4883f7654ef6b2c1e2f69112cc.tar.gz
opie-dc088ad432189b4883f7654ef6b2c1e2f69112cc.tar.bz2
- beginning of a settings dialog
- button for switching between html and plain text view of the mail - hide some unused icons - completed alwins idea about status icons ( alwin you missed the one that sets the read icon .-) ) - beginning of a status widget -
Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/viewmail.cpp91
1 files changed, 56 insertions, 35 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
@@ -6,6 +6,8 @@
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"
@@ -109,6 +111,12 @@ for (unsigned int i = 0; i < body.Parts().count();++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;
@@ -164,18 +172,18 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
164 172
165void ViewMail::setMail( RecMail mail ) { 173void ViewMail::setMail( RecMail mail ) {
166 174
167m_recMail = mail; 175 m_recMail = mail;
168 176
169m_mail[0] = mail.getFrom(); 177 m_mail[0] = mail.getFrom();
170m_mail[1] = mail.getSubject(); 178 m_mail[1] = mail.getSubject();
171m_mail[3] = mail.getDate(); 179 m_mail[3] = mail.getDate();
172m_mail[4] = mail.Msgid(); 180 m_mail[4] = mail.Msgid();
173 181
174m_mail2[0] = mail.To(); 182 m_mail2[0] = mail.To();
175m_mail2[1] = mail.CC(); 183 m_mail2[1] = mail.CC();
176m_mail2[2] = mail.Bcc(); 184 m_mail2[2] = mail.Bcc();
177 185
178setText(); 186 setText();
179} 187}
180 188
181 189
@@ -186,48 +194,61 @@ 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;
205 222
206 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { 223 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) {
207 toString += (*it); 224 toString += (*it);
208 } 225 }
209 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { 226 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) {
210 ccString += (*it); 227 ccString += (*it);
211 } 228 }
212 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { 229 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) {
213 bccString += (*it); 230 bccString += (*it);
214 } 231 }
215 232
216 setCaption( caption().arg( m_mail[0] ) ); 233 setCaption( caption().arg( m_mail[0] ) );
217 234
218 m_mailHtml = "<html><body>" 235 m_mailHtml = "<html><body>"
219 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 236 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
220 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 237 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
221 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 238 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
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>" );
229 // remove later in favor of a real handling 247 } else {
230 m_gotBody = true; 248 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
249 }
250 // remove later in favor of a real handling
251 m_gotBody = true;
231} 252}
232 253
233 254