summaryrefslogtreecommitdiff
path: root/noncore/net/mail
authoralwin <alwin>2005-03-06 00:09:33 (UTC)
committer alwin <alwin>2005-03-06 00:09:33 (UTC)
commit7e44f77d3749db2f43a1313d835a06684ecc1cd6 (patch) (unidiff)
tree13499da9a407e9b384db0f3abdd381fe3bb9b6f4 /noncore/net/mail
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') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/viewmail.cpp40
-rw-r--r--noncore/net/mail/viewmail.h9
-rw-r--r--noncore/net/mail/viewmailbase.cpp18
-rw-r--r--noncore/net/mail/viewmailbase.h2
4 files changed, 57 insertions, 12 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
@@ -252,5 +252,5 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
252 { 252 {
253 QString tmpfile = "/tmp/opiemail-image"; 253 QString tmpfile = QString("/tmp/opiemail-image-%1").arg(_icounter++);
254 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 254 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
255 if (content) { 255 if (content && content->Length()) {
256 QFile output(tmpfile); 256 QFile output(tmpfile);
@@ -260,2 +260,3 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
260 delete content; 260 delete content;
261 if (!m_PicsInline) {
261 MailImageDlg iview(""); 262 MailImageDlg iview("");
@@ -263,3 +264,15 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
263 QPEApplication::execDialog(&iview); 264 QPEApplication::execDialog(&iview);
265 } else {
266 if (!m_lastdlg) {
267 m_lastdlg=new Opie::MM::OImageScrollView("",browser->parentWidget(),false);
268 m_lastdlg->setAutoScale(true);
269 }
270 //m_lastdlg->setImage("");
271 m_lastdlg->setImage(tmpfile);
272 browser->hide();
273 m_lastdlg->show();
274 }
264 output.remove(); 275 output.remove();
276 } else {
277 QMessageBox::critical(this, tr("Reading attachment"), tr("Could not read content of attachment"));
265 } 278 }
@@ -315,2 +328,3 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
315 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 328 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
329 connect( showPicsInline, SIGNAL( toggled(bool) ), SLOT( slotImageInline(bool) ) );
316 330
@@ -318,2 +332,4 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
318 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 332 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
333 m_lastdlg = 0;
334 _icounter = 0;
319 335
@@ -323,2 +339,16 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
323 339
340void ViewMail::slotImageInline(bool how)
341{
342 Config cfg( "mail" );
343 cfg.writeEntry( "showPicsInline", how);
344 m_PicsInline = how;
345 if (m_lastdlg&&!how) {
346 browser->show();
347 m_lastdlg->hide();
348 m_lastdlg->reparent(0,QPoint(0,0),false);
349 delete m_lastdlg;
350 m_lastdlg = 0;
351 }
352}
353
324void ViewMail::readConfig() 354void ViewMail::readConfig()
@@ -328,2 +358,4 @@ void ViewMail::readConfig()
328 m_showHtml = cfg.readBoolEntry( "showHtml", false ); 358 m_showHtml = cfg.readBoolEntry( "showHtml", false );
359 m_PicsInline = cfg.readBoolEntry( "showPicsInline", true );
360 showPicsInline->setOn(m_PicsInline);
329 showHtml->setOn( m_showHtml ); 361 showHtml->setOn( m_showHtml );
@@ -338,2 +370,6 @@ void ViewMail::setText()
338 370
371 if (m_lastdlg) {
372 m_lastdlg->hide();
373 }
374 browser->show();
339 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) 375 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index 297836b..f5033f0 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -13,2 +13,4 @@
13 13
14class MailImageDlg;
15
14namespace Opie { namespace MM { class OImageScrollView; } } 16namespace Opie { namespace MM { class OImageScrollView; } }
@@ -50,2 +52,4 @@ protected:
50 52
53 Opie::MM::OImageScrollView*m_lastdlg;
54
51protected slots: 55protected slots:
@@ -57,2 +61,3 @@ protected slots:
57 void slotShowHtml( bool ); 61 void slotShowHtml( bool );
62 void slotImageInline(bool);
58 63
@@ -66,3 +71,5 @@ private:
66 RecMailP m_recMail; 71 RecMailP m_recMail;
67 bool m_showHtml; 72 bool m_showHtml:1;
73 bool m_PicsInline:1;
74 unsigned int _icounter;
68 75
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp
index 49a0e6a..65ad0d6 100644
--- a/noncore/net/mail/viewmailbase.cpp
+++ b/noncore/net/mail/viewmailbase.cpp
@@ -7,2 +7,3 @@
7#include <qtoolbar.h> 7#include <qtoolbar.h>
8#include <qlayout.h>
8#include <qmenubar.h> 9#include <qmenubar.h>
@@ -23,6 +24,4 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
23 menubar->insertItem( tr( "Mail" ), mailmenu ); 24 menubar->insertItem( tr( "Mail" ), mailmenu );
24
25 toolbar->setHorizontalStretchable(true); 25 toolbar->setHorizontalStretchable(true);
26 addToolBar(toolbar); 26 addToolBar(toolbar);
27
28 QLabel *spacer = new QLabel(toolbar); 27 QLabel *spacer = new QLabel(toolbar);
@@ -49,2 +48,7 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
49 48
49 showPicsInline= new QAction(tr("Show image preview inline"), QIconSet(Resource::loadPixmap("pixmap")), 0, 0, this);
50 showPicsInline->setToggleAction(true);
51 showPicsInline->addTo(toolbar);
52 showPicsInline->addTo(mailmenu);
53
50 deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("trash")), 0, 0, this); 54 deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("trash")), 0, 0, this);
@@ -54,2 +58,4 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
54 QVBox *view = new QVBox(this); 58 QVBox *view = new QVBox(this);
59 view->setSpacing(1);
60 view->setMargin(0);
55 setCentralWidget(view); 61 setCentralWidget(view);
@@ -65,10 +71,6 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
65 attachments->setSorting(-1); 71 attachments->setSorting(-1);
66 attachments->hide();
67 72
68 //header = new QTextBrowser(view);
69 browser = new QTextBrowser(view); 73 browser = new QTextBrowser(view);
70 74 adjustSize();
71// openDiag = new OpenDiag(view); 75 attachments->hide();
72// openDiag->hide();
73
74} 76}
diff --git a/noncore/net/mail/viewmailbase.h b/noncore/net/mail/viewmailbase.h
index 583b1f6..59179a4 100644
--- a/noncore/net/mail/viewmailbase.h
+++ b/noncore/net/mail/viewmailbase.h
@@ -21,3 +21,3 @@ public:
21protected: 21protected:
22 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml; 22 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml,*showPicsInline;
23 QListView *attachments; 23 QListView *attachments;