author | harlekin <harlekin> | 2003-12-20 00:05:37 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-20 00:05:37 (UTC) |
commit | dc088ad432189b4883f7654ef6b2c1e2f69112cc (patch) (side-by-side diff) | |
tree | 090f6afd960e644d7da1fae3b8c8ffa97b669b59 /noncore/net/mail/viewmail.cpp | |
parent | 00a0c8cf03fe746c1e3ba608bf298c8e66d065f9 (diff) | |
download | opie-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.cpp | 91 |
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 @@ -1,20 +1,22 @@ #include <qtextbrowser.h> #include <qmessagebox.h> #include <qtextstream.h> #include <qaction.h> #include <qpopupmenu.h> #include <qfile.h> #include <qapplication.h> +#include <qpe/config.h> + #include <opie/ofiledialog.h> #include "settings.h" #include "composemail.h" #include "viewmail.h" #include "abstractmail.h" #include "accountview.h" #include "mailtypes.h" AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, const QString&fsize,int num) : QListViewItem(parent,after),_partNum(num) @@ -100,24 +102,30 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { q=""; break; } QTextOStream o(&fsize); if (w>0) o.precision(2); else o.precision(0); o.setf(QTextStream::fixed); o << s << " " << q << "Byte"; desc = body.Parts()[i].Description(); curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i); } } + +void ViewMail::slotShowHtml( bool state ) { + m_showHtml = state; + setText(); +} + void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { if (!item ) return; if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { setText(); return; } QPopupMenu *menu = new QPopupMenu(); int ret=0; if ( item->text( 0 ).left( 5 ) == "text/" ) { @@ -155,88 +163,101 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); } } break; } delete menu; } void ViewMail::setMail( RecMail mail ) { -m_recMail = mail; + m_recMail = mail; -m_mail[0] = mail.getFrom(); -m_mail[1] = mail.getSubject(); -m_mail[3] = mail.getDate(); -m_mail[4] = mail.Msgid(); + m_mail[0] = mail.getFrom(); + m_mail[1] = mail.getSubject(); + m_mail[3] = mail.getDate(); + m_mail[4] = mail.Msgid(); -m_mail2[0] = mail.To(); -m_mail2[1] = mail.CC(); -m_mail2[2] = mail.Bcc(); + m_mail2[0] = mail.To(); + m_mail2[1] = mail.CC(); + m_mail2[2] = mail.Bcc(); -setText(); + setText(); } ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; deleted = false; - connect(reply, SIGNAL(activated()), SLOT(slotReply())); - connect(forward, SIGNAL(activated()), SLOT(slotForward())); + connect( reply, SIGNAL(activated()), SLOT(slotReply())); + connect( forward, SIGNAL(activated()), SLOT(slotForward())); connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) ); + connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) ); attachments->setEnabled(m_gotBody); connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); + readConfig(); } +void ViewMail::readConfig() { + Config cfg( "mail" ); + cfg.setGroup( "Settings" ); + m_showHtml = cfg.readBoolEntry( "showHtml", false ); + showHtml->setOn( m_showHtml ); +} + void ViewMail::setText() { - QString toString; - QString ccString; - QString bccString; + QString toString; + QString ccString; + QString bccString; - for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { - toString += (*it); - } - for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { - ccString += (*it); - } - for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { - bccString += (*it); - } + for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { + toString += (*it); + } + for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { + ccString += (*it); + } + for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { + bccString += (*it); + } - setCaption( caption().arg( m_mail[0] ) ); + setCaption( caption().arg( m_mail[0] ) ); - m_mailHtml = "<html><body>" - "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" - "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" - "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" - "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" - "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + - tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" - "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + - "</td></tr></table><font face=fixed>"; + m_mailHtml = "<html><body>" + "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" + "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" + "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" + "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" + "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + + tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" + "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + + "</td></tr></table><font face=fixed>"; + if ( !m_showHtml ) { browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); - // remove later in favor of a real handling - m_gotBody = true; + } else { + browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); + } + // remove later in favor of a real handling + m_gotBody = true; } ViewMail::~ViewMail() { hide(); } void ViewMail::hide() { QWidget::hide(); |