summaryrefslogtreecommitdiff
path: root/noncore/net/mail
authoralwin <alwin>2004-04-14 22:36:20 (UTC)
committer alwin <alwin>2004-04-14 22:36:20 (UTC)
commit6439d07d42e10b0804a3a31fdfd6645b36d2fad5 (patch) (unidiff)
tree07ff558875de1ebe8235badaa3cab4205fa82089 /noncore/net/mail
parent1b8fac62de40773977e9b3e800cf22cc42603ced (diff)
downloadopie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.zip
opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.tar.gz
opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.tar.bz2
opiemail now displays images send with mail
Diffstat (limited to 'noncore/net/mail') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mail.pro4
-rw-r--r--noncore/net/mail/opie-mail.control2
-rw-r--r--noncore/net/mail/viewmail.cpp43
-rw-r--r--noncore/net/mail/viewmail.h20
4 files changed, 62 insertions, 7 deletions
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index 6969644..7b00c58 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -11,56 +11,56 @@ HEADERS = defines.h \
11 opiemail.h \ 11 opiemail.h \
12 mailistviewitem.h \ 12 mailistviewitem.h \
13 settingsdialog.h \ 13 settingsdialog.h \
14 statuswidget.h \ 14 statuswidget.h \
15 newmaildir.h \ 15 newmaildir.h \
16 selectstore.h \ 16 selectstore.h \
17 selectsmtp.h \ 17 selectsmtp.h \
18 nntpgroups.h \ 18 nntpgroups.h \
19 nntpgroupsdlg.h 19 nntpgroupsdlg.h
20 20
21SOURCES = main.cpp \ 21SOURCES = main.cpp \
22 opiemail.cpp \ 22 opiemail.cpp \
23 mainwindow.cpp \ 23 mainwindow.cpp \
24 accountview.cpp \ 24 accountview.cpp \
25 accountitem.cpp \ 25 accountitem.cpp \
26 composemail.cpp \ 26 composemail.cpp \
27 addresspicker.cpp \ 27 addresspicker.cpp \
28 editaccounts.cpp \ 28 editaccounts.cpp \
29 viewmail.cpp \ 29 viewmail.cpp \
30 viewmailbase.cpp \ 30 viewmailbase.cpp \
31 mailistviewitem.cpp \ 31 mailistviewitem.cpp \
32 settingsdialog.cpp \ 32 settingsdialog.cpp \
33 statuswidget.cpp \ 33 statuswidget.cpp \
34 newmaildir.cpp \ 34 newmaildir.cpp \
35 selectstore.cpp \ 35 selectstore.cpp \
36 selectsmtp.cpp \ 36 selectsmtp.cpp \
37 nntpgroups.cpp \ 37 nntpgroups.cpp \
38 nntpgroupsdlg.cpp 38 nntpgroupsdlg.cpp
39 39
40INTERFACES = editaccountsui.ui \ 40INTERFACES = editaccountsui.ui \
41 selectmailtypeui.ui \ 41 selectmailtypeui.ui \
42 imapconfigui.ui \ 42 imapconfigui.ui \
43 pop3configui.ui \ 43 pop3configui.ui \
44 nntpconfigui.ui \ 44 nntpconfigui.ui \
45 smtpconfigui.ui \ 45 smtpconfigui.ui \
46 addresspickerui.ui \ 46 addresspickerui.ui \
47 composemailui.ui \ 47 composemailui.ui \
48 settingsdialogui.ui \ 48 settingsdialogui.ui \
49 statuswidgetui.ui \ 49 statuswidgetui.ui \
50 newmaildirui.ui \ 50 newmaildirui.ui \
51 selectstoreui.ui \ 51 selectstoreui.ui \
52 nntpgroupsui.ui 52 nntpgroupsui.ui
53 53
54 54
55INCLUDEPATH += $(OPIEDIR)/include /usr/local/include 55INCLUDEPATH += $(OPIEDIR)/include /usr/local/include
56 56
57CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) 57CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
58contains( CONFTEST, y ){ 58contains( CONFTEST, y ){
59 LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -liconv 59 LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -liconv -lopiemm2
60}else{ 60}else{
61 LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper 61 LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -lopiemm2
62} 62}
63 63
64TARGET = opiemail 64TARGET = opiemail
65 65
66include ( $(OPIEDIR)/include.pro ) 66include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/mail/opie-mail.control b/noncore/net/mail/opie-mail.control
index 98cb3a4..1bb588a 100644
--- a/noncore/net/mail/opie-mail.control
+++ b/noncore/net/mail/opie-mail.control
@@ -1,10 +1,10 @@
1Package: opie-mail 1Package: opie-mail
2Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/mail.desktop pics/mail/*.png 2Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/mail.desktop pics/mail/*.png
3Priority: optional 3Priority: optional
4Section: opie/pim 4Section: opie/pim
5Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> 5Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 0.6-$SUB_VERSION 7Version: 0.6-$SUB_VERSION
8Depends: task-opie-minimal, libopiecore2, libopieui2, libmailwrapper (>= 0.6) 8Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libmailwrapper (>= 0.6)
9Description: Opie's mail and news client (POP3, IMAP and NNTP) 9Description: Opie's mail and news client (POP3, IMAP and NNTP)
10License: LGPL 10License: LGPL
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 7267bcb..ce694d5 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -1,68 +1,70 @@
1#include "composemail.h" 1#include "composemail.h"
2#include "viewmail.h" 2#include "viewmail.h"
3 3
4/* OPIE */
5#include <libmailwrapper/settings.h> 4#include <libmailwrapper/settings.h>
6#include <libmailwrapper/abstractmail.h> 5#include <libmailwrapper/abstractmail.h>
7#include <libmailwrapper/mailtypes.h> 6#include <libmailwrapper/mailtypes.h>
8 7
8/* OPIE */
9#include <opie2/odebug.h> 9#include <opie2/odebug.h>
10#include <opie2/ofiledialog.h> 10#include <opie2/ofiledialog.h>
11#include <opie2/oimagescrollview.h>
11#include <qpe/config.h> 12#include <qpe/config.h>
12#include <qpe/qpeapplication.h> 13#include <qpe/qpeapplication.h>
13 14
14/* QT */ 15/* QT */
15#include <qtextbrowser.h> 16#include <qtextbrowser.h>
16#include <qmessagebox.h> 17#include <qmessagebox.h>
17#include <qtextstream.h> 18#include <qtextstream.h>
18#include <qaction.h> 19#include <qaction.h>
19#include <qpopupmenu.h> 20#include <qpopupmenu.h>
20#include <qfile.h> 21#include <qfile.h>
22#include <qlayout.h>
21 23
22using namespace Opie::Ui; 24using namespace Opie::Ui;
23using namespace Opie::Core; 25using namespace Opie::Core;
24 26
25AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 27AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
26 const QString&fsize,int num,const QValueList<int>&path) 28 const QString&fsize,int num,const QValueList<int>&path)
27 : QListViewItem(parent,after),_partNum(num) 29 : QListViewItem(parent,after),_partNum(num)
28{ 30{
29 _path=path; 31 _path=path;
30 setText(0, mime); 32 setText(0, mime);
31 setText(1, desc); 33 setText(1, desc);
32 setText(2, file); 34 setText(2, file);
33 setText(3, fsize); 35 setText(3, fsize);
34} 36}
35 37
36AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 38AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
37 const QString&fsize,int num,const QValueList<int>&path) 39 const QString&fsize,int num,const QValueList<int>&path)
38 : QListViewItem(parent,after),_partNum(num) 40 : QListViewItem(parent,after),_partNum(num)
39{ 41{
40 _path=path; 42 _path=path;
41 setText(0, mime); 43 setText(0, mime);
42 setText(1, desc); 44 setText(1, desc);
43 setText(2, file); 45 setText(2, file);
44 setText(3, fsize); 46 setText(3, fsize);
45} 47}
46 48
47bool AttachItem::isParentof(const QValueList<int>&path) 49bool AttachItem::isParentof(const QValueList<int>&path)
48{ 50{
49 /* if not set, then no parent */ 51 /* if not set, then no parent */
50 if (path.count()==0||_path.count()==0) return false; 52 if (path.count()==0||_path.count()==0) return false;
51 /* the parent must have one digit less then a child */ 53 /* the parent must have one digit less then a child */
52 if (path.count()!=_path.count()+1) return false; 54 if (path.count()!=_path.count()+1) return false;
53 for (unsigned int i=0; i < _path.count();++i) 55 for (unsigned int i=0; i < _path.count();++i)
54 { 56 {
55 if (_path[i]!=path[i]) return false; 57 if (_path[i]!=path[i]) return false;
56 } 58 }
57 return true; 59 return true;
58} 60}
59 61
60AttachItem* ViewMail::searchParent(const QValueList<int>&path) 62AttachItem* ViewMail::searchParent(const QValueList<int>&path)
61{ 63{
62 QListViewItemIterator it( attachments ); 64 QListViewItemIterator it( attachments );
63 for ( ; it.current(); ++it ) 65 for ( ; it.current(); ++it )
64 { 66 {
65 AttachItem*ati = (AttachItem*)it.current(); 67 AttachItem*ati = (AttachItem*)it.current();
66 if (ati->isParentof(path)) return ati; 68 if (ati->isParentof(path)) return ati;
67 } 69 }
68 return 0; 70 return 0;
@@ -168,125 +170,145 @@ void ViewMail::setBody(const RecBodyP&body )
168 q=""; 170 q="";
169 break; 171 break;
170 } 172 }
171 QTextOStream o(&fsize); 173 QTextOStream o(&fsize);
172 if (w>0) o.precision(2); else o.precision(0); 174 if (w>0) o.precision(2); else o.precision(0);
173 o.setf(QTextStream::fixed); 175 o.setf(QTextStream::fixed);
174 o << s << " " << q << "Byte"; 176 o << s << " " << q << "Byte";
175 desc = body->Parts()[i]->Description(); 177 desc = body->Parts()[i]->Description();
176 parentItem = searchParent(body->Parts()[i]->Positionlist()); 178 parentItem = searchParent(body->Parts()[i]->Positionlist());
177 if (parentItem) 179 if (parentItem)
178 { 180 {
179 AttachItem*temp = lastChild(parentItem); 181 AttachItem*temp = lastChild(parentItem);
180 if (temp) curItem = temp; 182 if (temp) curItem = temp;
181 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 183 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
182 attachments->setRootIsDecorated(true); 184 attachments->setRootIsDecorated(true);
183 curItem = parentItem; 185 curItem = parentItem;
184 } 186 }
185 else 187 else
186 { 188 {
187 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 189 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
188 } 190 }
189 } 191 }
190} 192}
191 193
192 194
193void ViewMail::slotShowHtml( bool state ) 195void ViewMail::slotShowHtml( bool state )
194{ 196{
195 m_showHtml = state; 197 m_showHtml = state;
196 setText(); 198 setText();
197} 199}
198 200
199void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 201void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
200{ 202{
201 if (!item ) 203 if (!item )
202 return; 204 return;
203 205
204 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 206 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
205 { 207 {
206 setText(); 208 setText();
207 return; 209 return;
208 } 210 }
209 QPopupMenu *menu = new QPopupMenu(); 211 QPopupMenu *menu = new QPopupMenu();
210 int ret=0; 212 int ret=0;
211 213
212 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 214 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
213 { 215 {
214 menu->insertItem( tr( "Show Text" ), 1 ); 216 menu->insertItem( tr( "Show Text" ), 1 );
215 } 217 }
218 if (item->text(0).left(6)=="image/") {
219 menu->insertItem(tr("Display image preview"),2);
220 }
216 menu->insertItem( tr( "Save Attachment" ), 0 ); 221 menu->insertItem( tr( "Save Attachment" ), 0 );
217 menu->insertSeparator(1); 222 menu->insertSeparator(1);
218 223
219 ret = menu->exec( point, 0 ); 224 ret = menu->exec( point, 0 );
220 225
221 switch(ret) 226 switch(ret)
222 { 227 {
223 case 0: 228 case 0:
224 { 229 {
225 MimeTypes types; 230 MimeTypes types;
226 types.insert( "all", "*" ); 231 types.insert( "all", "*" );
227 QString str = OFileDialog::getSaveFileName( 1, 232 QString str = OFileDialog::getSaveFileName( 1,
228 "/", item->text( 2 ) , types, 0 ); 233 "/", item->text( 2 ) , types, 0 );
229 234
230 if( !str.isEmpty() ) 235 if( !str.isEmpty() )
231 { 236 {
232 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 237 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
233 if (content) 238 if (content)
234 { 239 {
235 QFile output(str); 240 QFile output(str);
236 output.open(IO_WriteOnly); 241 output.open(IO_WriteOnly);
237 output.writeBlock(content->Content(),content->Length()); 242 output.writeBlock(content->Content(),content->Length());
238 output.close(); 243 output.close();
239 delete content; 244 delete content;
240 } 245 }
241 } 246 }
242 } 247 }
243 break ; 248 break ;
244 249
250 case 2:
251 {
252 QString tmpfile = "/tmp/opiemail-image";
253 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
254 if (content) {
255 QFile output(tmpfile);
256 output.open(IO_WriteOnly);
257 output.writeBlock(content->Content(),content->Length());
258 output.close();
259 delete content;
260 MailImageDlg iview("");
261 iview.setName(tmpfile);
262 QPEApplication::execDialog(&iview);
263 output.remove();
264 }
265 }
266 break;
245 case 1: 267 case 1:
246 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 268 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
247 { 269 {
248 setText(); 270 setText();
249 } 271 }
250 else 272 else
251 { 273 {
252 if ( m_recMail->Wrapper() != 0l ) 274 if ( m_recMail->Wrapper() != 0l )
253 { // make sure that there is a wrapper , even after delete or simular actions 275 { // make sure that there is a wrapper , even after delete or simular actions
254 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 276 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
255 } 277 }
256 } 278 }
257 break; 279 break;
258 } 280 }
259 delete menu; 281 delete menu;
260} 282}
261 283
262 284
263void ViewMail::setMail(const RecMailP&mail ) 285void ViewMail::setMail(const RecMailP&mail )
264{ 286{
265 287
266 m_recMail = mail; 288 m_recMail = mail;
267 289
268 m_mail[0] = mail->getFrom(); 290 m_mail[0] = mail->getFrom();
269 m_mail[1] = mail->getSubject(); 291 m_mail[1] = mail->getSubject();
270 m_mail[3] = mail->getDate(); 292 m_mail[3] = mail->getDate();
271 m_mail[4] = mail->Msgid(); 293 m_mail[4] = mail->Msgid();
272 294
273 m_mail2[0] = mail->To(); 295 m_mail2[0] = mail->To();
274 m_mail2[1] = mail->CC(); 296 m_mail2[1] = mail->CC();
275 m_mail2[2] = mail->Bcc(); 297 m_mail2[2] = mail->Bcc();
276 298
277 setText(); 299 setText();
278} 300}
279 301
280 302
281 303
282ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 304ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
283 : ViewMailBase(parent, name, fl), _inLoop(false) 305 : ViewMailBase(parent, name, fl), _inLoop(false)
284{ 306{
285 m_gotBody = false; 307 m_gotBody = false;
286 deleted = false; 308 deleted = false;
287 309
288 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 310 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
289 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 311 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
290 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 312 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
291 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 313 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
292 314
@@ -433,48 +455,67 @@ void ViewMail::slotReply()
433 m_recMail->Wrapper()->answeredMail(m_recMail); 455 m_recMail->Wrapper()->answeredMail(m_recMail);
434 } 456 }
435} 457}
436 458
437void ViewMail::slotForward() 459void ViewMail::slotForward()
438{ 460{
439 if (!m_gotBody) 461 if (!m_gotBody)
440 { 462 {
441 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); 463 QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok"));
442 return; 464 return;
443 } 465 }
444 466
445 QString ftext; 467 QString ftext;
446 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 468 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
447 .arg( m_mail[0] ); 469 .arg( m_mail[0] );
448 if (!m_mail[3].isNull()) 470 if (!m_mail[3].isNull())
449 ftext += QString("Date: %1\n") 471 ftext += QString("Date: %1\n")
450 .arg( m_mail[3] ); 472 .arg( m_mail[3] );
451 if (!m_mail[0].isNull()) 473 if (!m_mail[0].isNull())
452 ftext += QString("From: %1\n") 474 ftext += QString("From: %1\n")
453 .arg( m_mail[0] ); 475 .arg( m_mail[0] );
454 if (!m_mail[1].isNull()) 476 if (!m_mail[1].isNull())
455 ftext += QString("Subject: %1\n") 477 ftext += QString("Subject: %1\n")
456 .arg( m_mail[1] ); 478 .arg( m_mail[1] );
457 479
458 ftext += QString("\n%1\n") 480 ftext += QString("\n%1\n")
459 .arg( m_mail[2]); 481 .arg( m_mail[2]);
460 482
461 ftext += QString("----- End forwarded message -----\n"); 483 ftext += QString("----- End forwarded message -----\n");
462 484
463 Settings *settings = new Settings(); 485 Settings *settings = new Settings();
464 ComposeMail composer( settings ,this, 0, true); 486 ComposeMail composer( settings ,this, 0, true);
465 composer.setSubject( "Fwd: " + m_mail[1] ); 487 composer.setSubject( "Fwd: " + m_mail[1] );
466 composer.setMessage( ftext ); 488 composer.setMessage( ftext );
467 if ( QDialog::Accepted == QPEApplication::execDialog( &composer )) 489 if ( QDialog::Accepted == QPEApplication::execDialog( &composer ))
468 { 490 {
469 } 491 }
470} 492}
471 493
472void ViewMail::slotDeleteMail( ) 494void ViewMail::slotDeleteMail( )
473{ 495{
474 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 496 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
475 { 497 {
476 m_recMail->Wrapper()->deleteMail( m_recMail ); 498 m_recMail->Wrapper()->deleteMail( m_recMail );
477 hide(); 499 hide();
478 deleted = true; 500 deleted = true;
479 } 501 }
480} 502}
503
504MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
505 : Opie::Ui::ODialog(parent,name,modal,f)
506{
507 QVBoxLayout*dlglayout = new QVBoxLayout(this);
508 dlglayout->setSpacing(2);
509 dlglayout->setMargin(1);
510 m_imageview = new Opie::MM::OImageScrollView(this);
511 dlglayout->addWidget(m_imageview);
512}
513
514MailImageDlg::~MailImageDlg()
515{
516}
517
518void MailImageDlg::setName(const QString&fname)
519{
520 m_imageview->setImage(fname);
521}
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index b60fb8e..297836b 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -1,72 +1,86 @@
1#ifndef VIEWMAIL_H 1#ifndef VIEWMAIL_H
2#define VIEWMAIL_H 2#define VIEWMAIL_H
3 3
4#include "viewmailbase.h"
5#include <libmailwrapper/mailtypes.h>
6
7#include <opie2/odialog.h>
8
4#include <qlistview.h> 9#include <qlistview.h>
5#include <qmap.h> 10#include <qmap.h>
6#include <qstringlist.h> 11#include <qstringlist.h>
7#include <qvaluelist.h> 12#include <qvaluelist.h>
8 13
9#include "viewmailbase.h" 14namespace Opie { namespace MM { class OImageScrollView; } }
10#include <libmailwrapper/mailtypes.h>
11
12 15
13class AttachItem : public QListViewItem 16class AttachItem : public QListViewItem
14{ 17{
15public: 18public:
16 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 19 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
17 const QString&fsize,int num,const QValueList<int>&path); 20 const QString&fsize,int num,const QValueList<int>&path);
18 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 21 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
19 const QString&fsize,int num,const QValueList<int>&path); 22 const QString&fsize,int num,const QValueList<int>&path);
20 int Partnumber() { return _partNum; } 23 int Partnumber() { return _partNum; }
21 bool isParentof(const QValueList<int>&path); 24 bool isParentof(const QValueList<int>&path);
22 25
23private: 26private:
24 int _partNum; 27 int _partNum;
25 /* needed for a better display of attachments */ 28 /* needed for a better display of attachments */
26 QValueList<int> _path; 29 QValueList<int> _path;
27}; 30};
28 31
29class ViewMail : public ViewMailBase 32class ViewMail : public ViewMailBase
30{ 33{
31 Q_OBJECT 34 Q_OBJECT
32 35
33public: 36public:
34 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 37 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
35 ~ViewMail(); 38 ~ViewMail();
36 39
37 void hide(); 40 void hide();
38 void exec(); 41 void exec();
39 void setMail(const RecMailP&mail ); 42 void setMail(const RecMailP&mail );
40 void setBody(const RecBodyP&body); 43 void setBody(const RecBodyP&body);
41 bool deleted; 44 bool deleted;
42 45
43protected: 46protected:
44 QString deHtml(const QString &string); 47 QString deHtml(const QString &string);
45 AttachItem* searchParent(const QValueList<int>&path); 48 AttachItem* searchParent(const QValueList<int>&path);
46 AttachItem* lastChild(AttachItem*parent); 49 AttachItem* lastChild(AttachItem*parent);
47 50
48protected slots: 51protected slots:
49 void slotReply(); 52 void slotReply();
50 void slotForward(); 53 void slotForward();
51 void setText(); 54 void setText();
52 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 55 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
53 void slotDeleteMail( ); 56 void slotDeleteMail( );
54 void slotShowHtml( bool ); 57 void slotShowHtml( bool );
55 58
56private: 59private:
57 void readConfig(); 60 void readConfig();
58 61
59 bool _inLoop; 62 bool _inLoop;
60 QString m_mailHtml; 63 QString m_mailHtml;
61 bool m_gotBody; 64 bool m_gotBody;
62 RecBodyP m_body; 65 RecBodyP m_body;
63 RecMailP m_recMail; 66 RecMailP m_recMail;
64 bool m_showHtml; 67 bool m_showHtml;
65 68
66 // 0 from 1 subject 2 bodytext 3 date 69 // 0 from 1 subject 2 bodytext 3 date
67 QMap <int,QString> m_mail; 70 QMap <int,QString> m_mail;
68 // 0 to 1 cc 2 bcc 71 // 0 to 1 cc 2 bcc
69 QMap <int,QStringList> m_mail2; 72 QMap <int,QStringList> m_mail2;
70}; 73};
71 74
75class MailImageDlg:public Opie::Ui::ODialog
76{
77 Q_OBJECT
78public:
79 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
80 ~MailImageDlg();
81 void setName(const QString&);
82protected:
83 Opie::MM::OImageScrollView*m_imageview;
84};
85
72#endif 86#endif