-rw-r--r-- | kmicromail/viewmail.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 726f540..685b4e4 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp @@ -78,48 +78,60 @@ AttachItem* ViewMail::searchParent(const QValueList<int>&path) AttachItem*ati = (AttachItem*)it.current(); if (ati->isParentof(path)) return ati; } return 0; } AttachItem* ViewMail::lastChild(AttachItem*parent) { if (!parent) return 0; AttachItem* item = (AttachItem*)parent->firstChild(); if (!item) return item; AttachItem*temp=0; while( (temp=(AttachItem*)item->nextSibling())) { item = temp; } return item; } void ViewMail::setBody(const RecBodyP&body ) { m_body = body; m_mail[2] = body->Bodytext(); + m_showHtml = KOPrefs::instance()->mViewAsHtml; + if ( m_showHtml ) { + if ( m_mail[2].find ("<html>",0,false ) > -1 ) { + qDebug("html mail "); + } else { + qDebug("no html mail "); + m_showHtml = false; + } + } + showHtml->blockSignals( true ); + showHtml->setOn( m_showHtml ); + showHtml->blockSignals( false ); // qDebug("********text %s ",m_mail[2].latin1() ); attachbutton->setEnabled(body->Parts().count()>0); attachments->setEnabled(body->Parts().count()>0); if (body->Parts().count()==0) { return; } AttachItem * curItem=0; AttachItem * parentItem = 0; QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); QString desc,fsize; double s = body->Description()->Size(); int w; w=0; while (s>1024) { s/=1024; ++w; if (w>=2) break; } QString q=""; switch(w) @@ -310,69 +322,76 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int } break; } delete menu; } void ViewMail::setMail(const RecMailP&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_mail2[0] = mail->To(); m_mail2[1] = mail->CC(); m_mail2[2] = mail->Bcc(); setText(); } - +void ViewMail::slotNextMail() +{ + nextMail->blockSignals( true ); + setCaption(i18n("Displaying next mail...please wait!")); + qApp->processEvents(); + emit showNextMail(this); + nextMail->blockSignals( false ); +} ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; deleted = false; sourceOn = false; + readConfig(); 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) ) ); connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); attachments->setEnabled(m_gotBody); connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); - readConfig(); attachments->setSorting(-1); } void ViewMail::readConfig() { setFont ( KOPrefs::instance()->mReadFont ); m_showHtml = KOPrefs::instance()->mViewAsHtml; showHtml->setOn( m_showHtml ); } void ViewMail::setText() { viewSource->setText(i18n("View Source")); sourceOn = false; QString toString; QString ccString; QString bccString; toString = m_mail2[0].join(","); ccString = m_mail2[1].join(","); bccString = m_mail2[2].join(","); |