author | alwin <alwin> | 2004-04-14 22:36:20 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-14 22:36:20 (UTC) |
commit | 6439d07d42e10b0804a3a31fdfd6645b36d2fad5 (patch) (unidiff) | |
tree | 07ff558875de1ebe8235badaa3cab4205fa82089 | |
parent | 1b8fac62de40773977e9b3e800cf22cc42603ced (diff) | |
download | opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.zip opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.tar.gz opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.tar.bz2 |
opiemail now displays images send with mail
-rw-r--r-- | noncore/net/mail/mail.pro | 4 | ||||
-rw-r--r-- | noncore/net/mail/opie-mail.control | 2 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 43 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 20 |
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 | |||
@@ -1,66 +1,66 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | 2 | ||
3 | HEADERS = defines.h \ | 3 | HEADERS = defines.h \ |
4 | editaccounts.h \ | 4 | editaccounts.h \ |
5 | composemail.h \ | 5 | composemail.h \ |
6 | accountview.h \ | 6 | accountview.h \ |
7 | accountitem.h \ | 7 | accountitem.h \ |
8 | mainwindow.h \ | 8 | mainwindow.h \ |
9 | viewmail.h \ | 9 | viewmail.h \ |
10 | viewmailbase.h \ | 10 | viewmailbase.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 | ||
21 | SOURCES = main.cpp \ | 21 | SOURCES = 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 | ||
40 | INTERFACES = editaccountsui.ui \ | 40 | INTERFACES = 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 | ||
55 | INCLUDEPATH += $(OPIEDIR)/include /usr/local/include | 55 | INCLUDEPATH += $(OPIEDIR)/include /usr/local/include |
56 | 56 | ||
57 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 57 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
58 | contains( CONFTEST, y ){ | 58 | contains( 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 | ||
64 | TARGET = opiemail | 64 | TARGET = opiemail |
65 | 65 | ||
66 | include ( $(OPIEDIR)/include.pro ) | 66 | include ( $(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 @@ | |||
1 | Package: opie-mail | 1 | Package: opie-mail |
2 | Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/mail.desktop pics/mail/*.png | 2 | Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/mail.desktop pics/mail/*.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/pim | 4 | Section: opie/pim |
5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> | 5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.6-$SUB_VERSION | 7 | Version: 0.6-$SUB_VERSION |
8 | Depends: task-opie-minimal, libopiecore2, libopieui2, libmailwrapper (>= 0.6) | 8 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libmailwrapper (>= 0.6) |
9 | Description: Opie's mail and news client (POP3, IMAP and NNTP) | 9 | Description: Opie's mail and news client (POP3, IMAP and NNTP) |
10 | License: LGPL | 10 | License: 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,480 +1,521 @@ | |||
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 | ||
22 | using namespace Opie::Ui; | 24 | using namespace Opie::Ui; |
23 | using namespace Opie::Core; | 25 | using namespace Opie::Core; |
24 | 26 | ||
25 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 27 | AttachItem::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 | ||
36 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 38 | AttachItem::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 | ||
47 | bool AttachItem::isParentof(const QValueList<int>&path) | 49 | bool 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 | ||
60 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) | 62 | AttachItem* 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; |
69 | } | 71 | } |
70 | 72 | ||
71 | AttachItem* ViewMail::lastChild(AttachItem*parent) | 73 | AttachItem* ViewMail::lastChild(AttachItem*parent) |
72 | { | 74 | { |
73 | if (!parent) return 0; | 75 | if (!parent) return 0; |
74 | AttachItem* item = (AttachItem*)parent->firstChild(); | 76 | AttachItem* item = (AttachItem*)parent->firstChild(); |
75 | if (!item) return item; | 77 | if (!item) return item; |
76 | AttachItem*temp=0; | 78 | AttachItem*temp=0; |
77 | while( (temp=(AttachItem*)item->nextSibling())) | 79 | while( (temp=(AttachItem*)item->nextSibling())) |
78 | { | 80 | { |
79 | item = temp; | 81 | item = temp; |
80 | } | 82 | } |
81 | return item; | 83 | return item; |
82 | } | 84 | } |
83 | 85 | ||
84 | void ViewMail::setBody(const RecBodyP&body ) | 86 | void ViewMail::setBody(const RecBodyP&body ) |
85 | { | 87 | { |
86 | 88 | ||
87 | m_body = body; | 89 | m_body = body; |
88 | m_mail[2] = body->Bodytext(); | 90 | m_mail[2] = body->Bodytext(); |
89 | attachbutton->setEnabled(body->Parts().count()>0); | 91 | attachbutton->setEnabled(body->Parts().count()>0); |
90 | attachments->setEnabled(body->Parts().count()>0); | 92 | attachments->setEnabled(body->Parts().count()>0); |
91 | if (body->Parts().count()==0) | 93 | if (body->Parts().count()==0) |
92 | { | 94 | { |
93 | return; | 95 | return; |
94 | } | 96 | } |
95 | AttachItem * curItem=0; | 97 | AttachItem * curItem=0; |
96 | AttachItem * parentItem = 0; | 98 | AttachItem * parentItem = 0; |
97 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); | 99 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); |
98 | QString desc,fsize; | 100 | QString desc,fsize; |
99 | double s = body->Description()->Size(); | 101 | double s = body->Description()->Size(); |
100 | int w; | 102 | int w; |
101 | w=0; | 103 | w=0; |
102 | 104 | ||
103 | while (s>1024) | 105 | while (s>1024) |
104 | { | 106 | { |
105 | s/=1024; | 107 | s/=1024; |
106 | ++w; | 108 | ++w; |
107 | if (w>=2) break; | 109 | if (w>=2) break; |
108 | } | 110 | } |
109 | 111 | ||
110 | QString q=""; | 112 | QString q=""; |
111 | switch(w) | 113 | switch(w) |
112 | { | 114 | { |
113 | case 1: | 115 | case 1: |
114 | q="k"; | 116 | q="k"; |
115 | break; | 117 | break; |
116 | case 2: | 118 | case 2: |
117 | q="M"; | 119 | q="M"; |
118 | break; | 120 | break; |
119 | default: | 121 | default: |
120 | break; | 122 | break; |
121 | } | 123 | } |
122 | 124 | ||
123 | { | 125 | { |
124 | /* I did not found a method to make a CONTENT reset on a QTextStream | 126 | /* I did not found a method to make a CONTENT reset on a QTextStream |
125 | so I use this construct that the stream will re-constructed in each | 127 | so I use this construct that the stream will re-constructed in each |
126 | loop. To let it work, the textstream is packed into a own area of | 128 | loop. To let it work, the textstream is packed into a own area of |
127 | code is it will be destructed after finishing its small job. | 129 | code is it will be destructed after finishing its small job. |
128 | */ | 130 | */ |
129 | QTextOStream o(&fsize); | 131 | QTextOStream o(&fsize); |
130 | if (w>0) o.precision(2); else o.precision(0); | 132 | if (w>0) o.precision(2); else o.precision(0); |
131 | o.setf(QTextStream::fixed); | 133 | o.setf(QTextStream::fixed); |
132 | o << s << " " << q << "Byte"; | 134 | o << s << " " << q << "Byte"; |
133 | } | 135 | } |
134 | 136 | ||
135 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 137 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
136 | QString filename = ""; | 138 | QString filename = ""; |
137 | 139 | ||
138 | for (unsigned int i = 0; i < body->Parts().count();++i) | 140 | for (unsigned int i = 0; i < body->Parts().count();++i) |
139 | { | 141 | { |
140 | filename = ""; | 142 | filename = ""; |
141 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 143 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
142 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 144 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
143 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 145 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
144 | { | 146 | { |
145 | odebug << it.key() << oendl; | 147 | odebug << it.key() << oendl; |
146 | if (it.key().lower()=="name") | 148 | if (it.key().lower()=="name") |
147 | { | 149 | { |
148 | filename=it.data(); | 150 | filename=it.data(); |
149 | } | 151 | } |
150 | } | 152 | } |
151 | s = body->Parts()[i]->Size(); | 153 | s = body->Parts()[i]->Size(); |
152 | w = 0; | 154 | w = 0; |
153 | while (s>1024) | 155 | while (s>1024) |
154 | { | 156 | { |
155 | s/=1024; | 157 | s/=1024; |
156 | ++w; | 158 | ++w; |
157 | if (w>=2) break; | 159 | if (w>=2) break; |
158 | } | 160 | } |
159 | switch(w) | 161 | switch(w) |
160 | { | 162 | { |
161 | case 1: | 163 | case 1: |
162 | q="k"; | 164 | q="k"; |
163 | break; | 165 | break; |
164 | case 2: | 166 | case 2: |
165 | q="M"; | 167 | q="M"; |
166 | break; | 168 | break; |
167 | default: | 169 | default: |
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 | ||
193 | void ViewMail::slotShowHtml( bool state ) | 195 | void ViewMail::slotShowHtml( bool state ) |
194 | { | 196 | { |
195 | m_showHtml = state; | 197 | m_showHtml = state; |
196 | setText(); | 198 | setText(); |
197 | } | 199 | } |
198 | 200 | ||
199 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 201 | void 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 | ||
263 | void ViewMail::setMail(const RecMailP&mail ) | 285 | void 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 | ||
282 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 304 | ViewMail::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 | ||
293 | attachments->setEnabled(m_gotBody); | 315 | attachments->setEnabled(m_gotBody); |
294 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); | 316 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); |
295 | 317 | ||
296 | readConfig(); | 318 | readConfig(); |
297 | attachments->setSorting(-1); | 319 | attachments->setSorting(-1); |
298 | } | 320 | } |
299 | 321 | ||
300 | void ViewMail::readConfig() | 322 | void ViewMail::readConfig() |
301 | { | 323 | { |
302 | Config cfg( "mail" ); | 324 | Config cfg( "mail" ); |
303 | cfg.setGroup( "Settings" ); | 325 | cfg.setGroup( "Settings" ); |
304 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); | 326 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); |
305 | showHtml->setOn( m_showHtml ); | 327 | showHtml->setOn( m_showHtml ); |
306 | } | 328 | } |
307 | 329 | ||
308 | void ViewMail::setText() | 330 | void ViewMail::setText() |
309 | { | 331 | { |
310 | 332 | ||
311 | QString toString; | 333 | QString toString; |
312 | QString ccString; | 334 | QString ccString; |
313 | QString bccString; | 335 | QString bccString; |
314 | 336 | ||
315 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) | 337 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) |
316 | { | 338 | { |
317 | toString += (*it); | 339 | toString += (*it); |
318 | } | 340 | } |
319 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) | 341 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) |
320 | { | 342 | { |
321 | ccString += (*it); | 343 | ccString += (*it); |
322 | } | 344 | } |
323 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) | 345 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) |
324 | { | 346 | { |
325 | bccString += (*it); | 347 | bccString += (*it); |
326 | } | 348 | } |
327 | 349 | ||
328 | setCaption( caption().arg( m_mail[0] ) ); | 350 | setCaption( caption().arg( m_mail[0] ) ); |
329 | 351 | ||
330 | m_mailHtml = "<html><body>" | 352 | m_mailHtml = "<html><body>" |
331 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 353 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
332 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 354 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
333 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 355 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
334 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 356 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
335 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 357 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
336 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 358 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
337 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + | 359 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + |
338 | "</td></tr></table><font face=fixed>"; | 360 | "</td></tr></table><font face=fixed>"; |
339 | 361 | ||
340 | if ( !m_showHtml ) | 362 | if ( !m_showHtml ) |
341 | { | 363 | { |
342 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 364 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
343 | } | 365 | } |
344 | else | 366 | else |
345 | { | 367 | { |
346 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 368 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
347 | } | 369 | } |
348 | // remove later in favor of a real handling | 370 | // remove later in favor of a real handling |
349 | m_gotBody = true; | 371 | m_gotBody = true; |
350 | } | 372 | } |
351 | 373 | ||
352 | 374 | ||
353 | ViewMail::~ViewMail() | 375 | ViewMail::~ViewMail() |
354 | { | 376 | { |
355 | m_recMail->Wrapper()->cleanMimeCache(); | 377 | m_recMail->Wrapper()->cleanMimeCache(); |
356 | hide(); | 378 | hide(); |
357 | } | 379 | } |
358 | 380 | ||
359 | void ViewMail::hide() | 381 | void ViewMail::hide() |
360 | { | 382 | { |
361 | QWidget::hide(); | 383 | QWidget::hide(); |
362 | 384 | ||
363 | if (_inLoop) | 385 | if (_inLoop) |
364 | { | 386 | { |
365 | _inLoop = false; | 387 | _inLoop = false; |
366 | qApp->exit_loop(); | 388 | qApp->exit_loop(); |
367 | 389 | ||
368 | } | 390 | } |
369 | 391 | ||
370 | } | 392 | } |
371 | 393 | ||
372 | void ViewMail::exec() | 394 | void ViewMail::exec() |
373 | { | 395 | { |
374 | show(); | 396 | show(); |
375 | 397 | ||
376 | if (!_inLoop) | 398 | if (!_inLoop) |
377 | { | 399 | { |
378 | _inLoop = true; | 400 | _inLoop = true; |
379 | qApp->enter_loop(); | 401 | qApp->enter_loop(); |
380 | } | 402 | } |
381 | 403 | ||
382 | } | 404 | } |
383 | 405 | ||
384 | QString ViewMail::deHtml(const QString &string) | 406 | QString ViewMail::deHtml(const QString &string) |
385 | { | 407 | { |
386 | QString string_ = string; | 408 | QString string_ = string; |
387 | string_.replace(QRegExp("&"), "&"); | 409 | string_.replace(QRegExp("&"), "&"); |
388 | string_.replace(QRegExp("<"), "<"); | 410 | string_.replace(QRegExp("<"), "<"); |
389 | string_.replace(QRegExp(">"), ">"); | 411 | string_.replace(QRegExp(">"), ">"); |
390 | string_.replace(QRegExp("\\n"), "<br>"); | 412 | string_.replace(QRegExp("\\n"), "<br>"); |
391 | return string_; | 413 | return string_; |
392 | } | 414 | } |
393 | 415 | ||
394 | void ViewMail::slotReply() | 416 | void ViewMail::slotReply() |
395 | { | 417 | { |
396 | if (!m_gotBody) | 418 | if (!m_gotBody) |
397 | { | 419 | { |
398 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); | 420 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); |
399 | return; | 421 | return; |
400 | } | 422 | } |
401 | 423 | ||
402 | QString rtext; | 424 | QString rtext; |
403 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 425 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
404 | .arg( m_mail[0] ) | 426 | .arg( m_mail[0] ) |
405 | .arg( m_mail[3] ); | 427 | .arg( m_mail[3] ); |
406 | 428 | ||
407 | QString text = m_mail[2]; | 429 | QString text = m_mail[2]; |
408 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 430 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
409 | QStringList::Iterator it; | 431 | QStringList::Iterator it; |
410 | for (it = lines.begin(); it != lines.end(); it++) | 432 | for (it = lines.begin(); it != lines.end(); it++) |
411 | { | 433 | { |
412 | rtext += "> " + *it + "\n"; | 434 | rtext += "> " + *it + "\n"; |
413 | } | 435 | } |
414 | rtext += "\n"; | 436 | rtext += "\n"; |
415 | 437 | ||
416 | QString prefix; | 438 | QString prefix; |
417 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 439 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
418 | else prefix = "Re: "; // no i18n on purpose | 440 | else prefix = "Re: "; // no i18n on purpose |
419 | 441 | ||
420 | Settings *settings = new Settings(); | 442 | Settings *settings = new Settings(); |
421 | ComposeMail composer( settings ,this, 0, true); | 443 | ComposeMail composer( settings ,this, 0, true); |
422 | if (m_recMail->Replyto().isEmpty()) { | 444 | if (m_recMail->Replyto().isEmpty()) { |
423 | composer.setTo( m_recMail->getFrom()); | 445 | composer.setTo( m_recMail->getFrom()); |
424 | } else { | 446 | } else { |
425 | composer.setTo( m_recMail->Replyto()); | 447 | composer.setTo( m_recMail->Replyto()); |
426 | } | 448 | } |
427 | composer.setSubject( prefix + m_mail[1] ); | 449 | composer.setSubject( prefix + m_mail[1] ); |
428 | composer.setMessage( rtext ); | 450 | composer.setMessage( rtext ); |
429 | composer.setInReplyTo(m_recMail->Msgid()); | 451 | composer.setInReplyTo(m_recMail->Msgid()); |
430 | 452 | ||
431 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) | 453 | if ( QDialog::Accepted == QPEApplication::execDialog( &composer ) ) |
432 | { | 454 | { |
433 | m_recMail->Wrapper()->answeredMail(m_recMail); | 455 | m_recMail->Wrapper()->answeredMail(m_recMail); |
434 | } | 456 | } |
435 | } | 457 | } |
436 | 458 | ||
437 | void ViewMail::slotForward() | 459 | void 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 | ||
472 | void ViewMail::slotDeleteMail( ) | 494 | void 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 | |||
504 | MailImageDlg::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 | |||
514 | MailImageDlg::~MailImageDlg() | ||
515 | { | ||
516 | } | ||
517 | |||
518 | void 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" | 14 | namespace Opie { namespace MM { class OImageScrollView; } } |
10 | #include <libmailwrapper/mailtypes.h> | ||
11 | |||
12 | 15 | ||
13 | class AttachItem : public QListViewItem | 16 | class AttachItem : public QListViewItem |
14 | { | 17 | { |
15 | public: | 18 | public: |
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 | ||
23 | private: | 26 | private: |
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 | ||
29 | class ViewMail : public ViewMailBase | 32 | class ViewMail : public ViewMailBase |
30 | { | 33 | { |
31 | Q_OBJECT | 34 | Q_OBJECT |
32 | 35 | ||
33 | public: | 36 | public: |
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 | ||
43 | protected: | 46 | protected: |
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 | ||
48 | protected slots: | 51 | protected 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 | ||
56 | private: | 59 | private: |
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 | ||
75 | class MailImageDlg:public Opie::Ui::ODialog | ||
76 | { | ||
77 | Q_OBJECT | ||
78 | public: | ||
79 | MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); | ||
80 | ~MailImageDlg(); | ||
81 | void setName(const QString&); | ||
82 | protected: | ||
83 | Opie::MM::OImageScrollView*m_imageview; | ||
84 | }; | ||
85 | |||
72 | #endif | 86 | #endif |