summaryrefslogtreecommitdiff
path: root/noncore/net/mail/viewmail.cpp
authoralwin <alwin>2005-03-06 00:09:33 (UTC)
committer alwin <alwin>2005-03-06 00:09:33 (UTC)
commit7e44f77d3749db2f43a1313d835a06684ecc1cd6 (patch) (side-by-side diff)
tree13499da9a407e9b384db0f3abdd381fe3bb9b6f4 /noncore/net/mail/viewmail.cpp
parent0baadaef5a3da4fda08df75394475f577af58828 (diff)
downloadopie-7e44f77d3749db2f43a1313d835a06684ecc1cd6.zip
opie-7e44f77d3749db2f43a1313d835a06684ecc1cd6.tar.gz
opie-7e44f77d3749db2f43a1313d835a06684ecc1cd6.tar.bz2
attached images may views inside the mailview and not as extra dialog
Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/viewmail.cpp46
1 files changed, 41 insertions, 5 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index d2f1584..a64a168 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -250,18 +250,31 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
case 2:
{
- QString tmpfile = "/tmp/opiemail-image";
+ QString tmpfile = QString("/tmp/opiemail-image-%1").arg(_icounter++);
encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
- if (content) {
+ if (content && content->Length()) {
QFile output(tmpfile);
output.open(IO_WriteOnly);
output.writeBlock(content->Content(),content->Length());
output.close();
delete content;
- MailImageDlg iview("");
- iview.setName(tmpfile);
- QPEApplication::execDialog(&iview);
+ if (!m_PicsInline) {
+ MailImageDlg iview("");
+ iview.setName(tmpfile);
+ QPEApplication::execDialog(&iview);
+ } else {
+ if (!m_lastdlg) {
+ m_lastdlg=new Opie::MM::OImageScrollView("",browser->parentWidget(),false);
+ m_lastdlg->setAutoScale(true);
+ }
+ //m_lastdlg->setImage("");
+ m_lastdlg->setImage(tmpfile);
+ browser->hide();
+ m_lastdlg->show();
+ }
output.remove();
+ } else {
+ QMessageBox::critical(this, tr("Reading attachment"), tr("Could not read content of attachment"));
}
}
break;
@@ -313,19 +326,38 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
connect( forward, SIGNAL(activated()), SLOT(slotForward()));
connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
+ connect( showPicsInline, SIGNAL( toggled(bool) ), SLOT( slotImageInline(bool) ) );
attachments->setEnabled(m_gotBody);
connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
+ m_lastdlg = 0;
+ _icounter = 0;
readConfig();
attachments->setSorting(-1);
}
+void ViewMail::slotImageInline(bool how)
+{
+ Config cfg( "mail" );
+ cfg.writeEntry( "showPicsInline", how);
+ m_PicsInline = how;
+ if (m_lastdlg&&!how) {
+ browser->show();
+ m_lastdlg->hide();
+ m_lastdlg->reparent(0,QPoint(0,0),false);
+ delete m_lastdlg;
+ m_lastdlg = 0;
+ }
+}
+
void ViewMail::readConfig()
{
Config cfg( "mail" );
cfg.setGroup( "Settings" );
m_showHtml = cfg.readBoolEntry( "showHtml", false );
+ m_PicsInline = cfg.readBoolEntry( "showPicsInline", true );
+ showPicsInline->setOn(m_PicsInline);
showHtml->setOn( m_showHtml );
}
@@ -336,6 +368,10 @@ void ViewMail::setText()
QString bccString;
QString mailHtml;
+ if (m_lastdlg) {
+ m_lastdlg->hide();
+ }
+ browser->show();
for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
{
toString += (*it);