author | harlekin <harlekin> | 2003-12-13 21:49:53 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-13 21:49:53 (UTC) |
commit | 8290f1a524b6f0051e49f8045d24e508d46868e2 (patch) (unidiff) | |
tree | 6c2acfab918834961c82558224c28b00077bc86f | |
parent | c0e86973b0cd2d01163ccf60340c8d295aa645f4 (diff) | |
download | opie-8290f1a524b6f0051e49f8045d24e508d46868e2.zip opie-8290f1a524b6f0051e49f8045d24e508d46868e2.tar.gz opie-8290f1a524b6f0051e49f8045d24e508d46868e2.tar.bz2 |
possible to show all kind of text attachemnts now
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 10 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index c24d5d3..a73dac5 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -1,36 +1,37 @@ | |||
1 | #include <qtextbrowser.h> | 1 | #include <qtextbrowser.h> |
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <qaction.h> | 4 | #include <qaction.h> |
5 | #include <qpopupmenu.h> | 5 | #include <qpopupmenu.h> |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | #include <opie/ofiledialog.h> | 8 | #include <opie/ofiledialog.h> |
9 | 9 | ||
10 | #include "settings.h" | 10 | #include "settings.h" |
11 | #include "composemail.h" | 11 | #include "composemail.h" |
12 | #include "viewmail.h" | 12 | #include "viewmail.h" |
13 | #include "abstractmail.h" | ||
13 | 14 | ||
14 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num) | 15 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num) |
15 | : QListViewItem(parent,after),_partNum(num) | 16 | : QListViewItem(parent,after),_partNum(num) |
16 | { | 17 | { |
17 | setText(0, mime); | 18 | setText(0, mime); |
18 | setText(1, file); | 19 | setText(1, file); |
19 | setText(2, desc); | 20 | setText(2, desc); |
20 | } | 21 | } |
21 | 22 | ||
22 | void ViewMail::setBody( RecBody body ) { | 23 | void ViewMail::setBody( RecBody body ) { |
23 | 24 | ||
24 | m_body = body; | 25 | m_body = body; |
25 | m_mail[2] = body.Bodytext(); | 26 | m_mail[2] = body.Bodytext(); |
26 | attachbutton->setEnabled(body.Parts().count()>0); | 27 | attachbutton->setEnabled(body.Parts().count()>0); |
27 | attachments->setEnabled(body.Parts().count()>0); | 28 | attachments->setEnabled(body.Parts().count()>0); |
28 | if (body.Parts().count()==0) { | 29 | if (body.Parts().count()==0) { |
29 | return; | 30 | return; |
30 | } | 31 | } |
31 | AttachItem * curItem=0; | 32 | AttachItem * curItem=0; |
32 | QString type=body.Description().Type()+"/"+body.Description().Subtype(); | 33 | QString type=body.Description().Type()+"/"+body.Description().Subtype(); |
33 | QString desc; | 34 | QString desc; |
34 | double s = body.Description().Size(); | 35 | double s = body.Description().Size(); |
35 | int w; | 36 | int w; |
36 | w=0; | 37 | w=0; |
@@ -109,63 +110,64 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
109 | int ret=0; | 110 | int ret=0; |
110 | 111 | ||
111 | if ( item->text( 0 ).left( 4 ) == "text" ) { | 112 | if ( item->text( 0 ).left( 4 ) == "text" ) { |
112 | menu->insertItem( tr( "Show Text" ), 1 ); | 113 | menu->insertItem( tr( "Show Text" ), 1 ); |
113 | } | 114 | } |
114 | menu->insertItem( tr( "Save Attachemt" ), 0 ); | 115 | menu->insertItem( tr( "Save Attachemt" ), 0 ); |
115 | menu->insertSeparator(1); | 116 | menu->insertSeparator(1); |
116 | 117 | ||
117 | ret = menu->exec( point, 0 ); | 118 | ret = menu->exec( point, 0 ); |
118 | 119 | ||
119 | switch(ret) { | 120 | switch(ret) { |
120 | case 0: | 121 | case 0: |
121 | { MimeTypes types; | 122 | { MimeTypes types; |
122 | types.insert( "all", "*" ); | 123 | types.insert( "all", "*" ); |
123 | QString str = OFileDialog::getSaveFileName( 1, | 124 | QString str = OFileDialog::getSaveFileName( 1, |
124 | "/", item->text( 1 ) , types, 0 ); | 125 | "/", item->text( 1 ) , types, 0 ); |
125 | 126 | ||
126 | if( !str.isEmpty() ) { | 127 | if( !str.isEmpty() ) { |
127 | qDebug( " first we will need a MIME wrapper" ); | 128 | qDebug( " first we will need a MIME wrapper" ); |
128 | } | 129 | } |
129 | } | 130 | } |
130 | break ; | 131 | break ; |
131 | 132 | ||
132 | case 1: | 133 | case 1: |
133 | |||
134 | qDebug( QString( "Test selected" ).arg( ( ( AttachItem* )item )->Partnumber() ) ); | 134 | qDebug( QString( "Test selected" ).arg( ( ( AttachItem* )item )->Partnumber() ) ); |
135 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { | 135 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { |
136 | setText(); | 136 | setText(); |
137 | } else { | 137 | } else { |
138 | browser->setText( ( m_body.Parts()[( ( AttachItem* )item )->Partnumber() ] ).Identifier() ); | 138 | browser->setText( m_recMail.Wrapper()->fetchPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
139 | } | 139 | } |
140 | break; | 140 | break; |
141 | } | 141 | } |
142 | delete menu; | 142 | delete menu; |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | void ViewMail::setMail( RecMail mail ) { | 146 | void ViewMail::setMail( RecMail mail ) { |
147 | 147 | ||
148 | m_recMail = mail; | ||
149 | |||
148 | m_mail[0] = mail.getFrom(); | 150 | m_mail[0] = mail.getFrom(); |
149 | m_mail[1] = mail.getSubject(); | 151 | m_mail[1] = mail.getSubject(); |
150 | m_mail[3] = mail.getDate(); | 152 | m_mail[3] = mail.getDate(); |
151 | m_mail[4] = mail.Msgid(); | 153 | m_mail[4] = mail.Msgid(); |
152 | 154 | ||
153 | m_mail2[0] = mail.To(); | 155 | m_mail2[0] = mail.To(); |
154 | m_mail2[1] = mail.CC(); | 156 | m_mail2[1] = mail.CC(); |
155 | m_mail2[2] = mail.Bcc(); | 157 | m_mail2[2] = mail.Bcc(); |
156 | 158 | ||
157 | setText(); | 159 | setText(); |
158 | } | 160 | } |
159 | 161 | ||
160 | 162 | ||
161 | 163 | ||
162 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 164 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
163 | : ViewMailBase(parent, name, fl), _inLoop(false) | 165 | : ViewMailBase(parent, name, fl), _inLoop(false) |
164 | { | 166 | { |
165 | m_gotBody = false; | 167 | m_gotBody = false; |
166 | 168 | ||
167 | connect(reply, SIGNAL(activated()), SLOT(slotReply())); | 169 | connect(reply, SIGNAL(activated()), SLOT(slotReply())); |
168 | connect(forward, SIGNAL(activated()), SLOT(slotForward())); | 170 | connect(forward, SIGNAL(activated()), SLOT(slotForward())); |
169 | 171 | ||
170 | attachments->setEnabled(m_gotBody); | 172 | attachments->setEnabled(m_gotBody); |
171 | connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); | 173 | connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); |
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index 0e85839..bc12da1 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h | |||
@@ -24,33 +24,34 @@ class ViewMail : public ViewMailBase | |||
24 | 24 | ||
25 | public: | 25 | public: |
26 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal); | 26 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal); |
27 | ~ViewMail(); | 27 | ~ViewMail(); |
28 | 28 | ||
29 | void hide(); | 29 | void hide(); |
30 | void exec(); | 30 | void exec(); |
31 | void setMail( RecMail mail ); | 31 | void setMail( RecMail mail ); |
32 | void setBody( RecBody body ); | 32 | void setBody( RecBody body ); |
33 | 33 | ||
34 | protected: | 34 | protected: |
35 | QString deHtml(const QString &string); | 35 | QString deHtml(const QString &string); |
36 | 36 | ||
37 | protected slots: | 37 | protected slots: |
38 | void slotReply(); | 38 | void slotReply(); |
39 | void slotForward(); | 39 | void slotForward(); |
40 | void setText(); | 40 | void setText(); |
41 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); | 41 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | bool _inLoop; | 44 | bool _inLoop; |
45 | QString m_mailHtml; | 45 | QString m_mailHtml; |
46 | bool m_gotBody; | 46 | bool m_gotBody; |
47 | RecBody m_body; | 47 | RecBody m_body; |
48 | RecMail m_recMail; | ||
48 | 49 | ||
49 | // 0 from 1 subject 2 bodytext 3 date | 50 | // 0 from 1 subject 2 bodytext 3 date |
50 | QMap <int,QString> m_mail; | 51 | QMap <int,QString> m_mail; |
51 | // 0 to 1 cc 2 bcc | 52 | // 0 to 1 cc 2 bcc |
52 | QMap <int,QStringList> m_mail2; | 53 | QMap <int,QStringList> m_mail2; |
53 | 54 | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | #endif | 57 | #endif |