-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 56 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 2 |
3 files changed, 59 insertions, 5 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index f0a915d..560715c 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -167,4 +167,4 @@ void MainWindow::displayMail(QListViewItem*item) | |||
167 | 167 | ||
168 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * after ) | 168 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
169 | :QListViewItem(parent,after),mail_data() | 169 | :QListViewItem(parent,item),mail_data() |
170 | { | 170 | { |
@@ -193 +193,3 @@ const RecMail& MailListViewItem::data()const | |||
193 | } | 193 | } |
194 | |||
195 | |||
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 39c9820..c24d5d3 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -4,4 +4,7 @@ | |||
4 | #include <qaction.h> | 4 | #include <qaction.h> |
5 | #include <qpopupmenu.h> | ||
5 | #include <qapplication.h> | 6 | #include <qapplication.h> |
6 | 7 | ||
8 | #include <opie/ofiledialog.h> | ||
9 | |||
7 | #include "settings.h" | 10 | #include "settings.h" |
@@ -18,5 +21,5 @@ AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mi | |||
18 | 21 | ||
19 | |||
20 | void ViewMail::setBody( RecBody body ) { | 22 | void ViewMail::setBody( RecBody body ) { |
21 | 23 | ||
24 | m_body = body; | ||
22 | m_mail[2] = body.Bodytext(); | 25 | m_mail[2] = body.Bodytext(); |
@@ -54,3 +57,3 @@ default: | |||
54 | /* I did not found a method to make a CONTENT reset on a QTextStream | 57 | /* I did not found a method to make a CONTENT reset on a QTextStream |
55 | so I use this construct that the stream will re-constructed in each | 58 | so I use this construct that the stream will re-constructed in each |
56 | loop. To let it work, the textstream is packed into a own area of | 59 | loop. To let it work, the textstream is packed into a own area of |
@@ -100,2 +103,44 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { | |||
100 | 103 | ||
104 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int c ) { | ||
105 | if (!item ) | ||
106 | return; | ||
107 | |||
108 | QPopupMenu *menu = new QPopupMenu(); | ||
109 | int ret=0; | ||
110 | |||
111 | if ( item->text( 0 ).left( 4 ) == "text" ) { | ||
112 | menu->insertItem( tr( "Show Text" ), 1 ); | ||
113 | } | ||
114 | menu->insertItem( tr( "Save Attachemt" ), 0 ); | ||
115 | menu->insertSeparator(1); | ||
116 | |||
117 | ret = menu->exec( point, 0 ); | ||
118 | |||
119 | switch(ret) { | ||
120 | case 0: | ||
121 | { MimeTypes types; | ||
122 | types.insert( "all", "*" ); | ||
123 | QString str = OFileDialog::getSaveFileName( 1, | ||
124 | "/", item->text( 1 ) , types, 0 ); | ||
125 | |||
126 | if( !str.isEmpty() ) { | ||
127 | qDebug( " first we will need a MIME wrapper" ); | ||
128 | } | ||
129 | } | ||
130 | break ; | ||
131 | |||
132 | case 1: | ||
133 | |||
134 | qDebug( QString( "Test selected" ).arg( ( ( AttachItem* )item )->Partnumber() ) ); | ||
135 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { | ||
136 | setText(); | ||
137 | } else { | ||
138 | browser->setText( ( m_body.Parts()[( ( AttachItem* )item )->Partnumber() ] ).Identifier() ); | ||
139 | } | ||
140 | break; | ||
141 | } | ||
142 | delete menu; | ||
143 | } | ||
144 | |||
145 | |||
101 | void ViewMail::setMail( RecMail mail ) { | 146 | void ViewMail::setMail( RecMail mail ) { |
@@ -125,2 +170,4 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | |||
125 | attachments->setEnabled(m_gotBody); | 170 | attachments->setEnabled(m_gotBody); |
171 | connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); | ||
172 | |||
126 | } | 173 | } |
@@ -174,3 +221,5 @@ void ViewMail::hide() | |||
174 | qApp->exit_loop(); | 221 | qApp->exit_loop(); |
175 | } | 222 | |
223 | } | ||
224 | |||
176 | } | 225 | } |
@@ -185,2 +234,3 @@ void ViewMail::exec() | |||
185 | } | 234 | } |
235 | |||
186 | } | 236 | } |
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index b497434..0e85839 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h | |||
@@ -40,2 +40,3 @@ protected slots: | |||
40 | void setText(); | 40 | void setText(); |
41 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); | ||
41 | 42 | ||
@@ -45,2 +46,3 @@ private: | |||
45 | bool m_gotBody; | 46 | bool m_gotBody; |
47 | RecBody m_body; | ||
46 | 48 | ||