summaryrefslogtreecommitdiffabout
path: root/kmicromail/viewmail.cpp
authorzautrix <zautrix>2004-10-18 09:08:13 (UTC)
committer zautrix <zautrix>2004-10-18 09:08:13 (UTC)
commit56990d318b15eacf7d3cc7425ab62f68da099ddf (patch) (unidiff)
treeb2f021bd75bc6a08fa8fc51a07ce1755b8e4a95e /kmicromail/viewmail.cpp
parent1712d92ea25b220273859d985bc7211fa7a97a39 (diff)
downloadkdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.zip
kdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.tar.gz
kdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.tar.bz2
fix of tmp file path for desktop version
Diffstat (limited to 'kmicromail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/viewmail.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 6e560d7..32a3b7c 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -208,97 +208,101 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
208 if (!item ) 208 if (!item )
209 return; 209 return;
210 210
211 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 211 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
212 { 212 {
213 setText(); 213 setText();
214 return; 214 return;
215 } 215 }
216 QPopupMenu *menu = new QPopupMenu(); 216 QPopupMenu *menu = new QPopupMenu();
217 int ret=0; 217 int ret=0;
218 218
219 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 219 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
220 { 220 {
221 menu->insertItem( tr( "Show Text" ), 1 ); 221 menu->insertItem( tr( "Show Text" ), 1 );
222 } 222 }
223 if (item->text(0).left(6)=="image/") { 223 if (item->text(0).left(6)=="image/") {
224 menu->insertItem(tr("Display image preview"),2); 224 menu->insertItem(tr("Display image preview"),2);
225 } 225 }
226 menu->insertItem( tr( "Save Attachment" ), 0 ); 226 menu->insertItem( tr( "Save Attachment" ), 0 );
227 menu->insertSeparator(1); 227 menu->insertSeparator(1);
228 228
229 ret = menu->exec( point, 0 ); 229 ret = menu->exec( point, 0 );
230 230
231 switch(ret) 231 switch(ret)
232 { 232 {
233 case 0: 233 case 0:
234 { 234 {
235 //MimeTypes types; 235 //MimeTypes types;
236 //types.insert( "all", "*" ); 236 //types.insert( "all", "*" );
237 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); 237 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this );
238 238
239 if( !str.isEmpty() ) 239 if( !str.isEmpty() )
240 { 240 {
241 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 241 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
242 if (content) 242 if (content)
243 { 243 {
244 QFile output(str); 244 QFile output(str);
245 output.open(IO_WriteOnly); 245 output.open(IO_WriteOnly);
246 output.writeBlock(content->Content(),content->Length()); 246 output.writeBlock(content->Content(),content->Length());
247 output.close(); 247 output.close();
248 delete content; 248 delete content;
249 } 249 }
250 } 250 }
251 } 251 }
252 break ; 252 break ;
253 253
254 case 2: 254 case 2:
255 { 255 {
256#ifdef DESKTOP_VERSION
257 QString tmpfile = locateLocal( "tmp", "opiemail-image");
258#else
256 QString tmpfile = "/tmp/opiemail-image"; 259 QString tmpfile = "/tmp/opiemail-image";
260#endif
257 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 261 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
258 if (content) { 262 if (content) {
259 QFile output(tmpfile); 263 QFile output(tmpfile);
260 output.open(IO_WriteOnly); 264 output.open(IO_WriteOnly);
261 output.writeBlock(content->Content(),content->Length()); 265 output.writeBlock(content->Content(),content->Length());
262 output.close(); 266 output.close();
263 delete content; 267 delete content;
264 MailImageDlg iview(""); 268 MailImageDlg iview("");
265 iview.setName(tmpfile); 269 iview.setName(tmpfile);
266 KApplication::execDialog(&iview); 270 KApplication::execDialog(&iview);
267 output.remove(); 271 output.remove();
268 } 272 }
269 } 273 }
270 break; 274 break;
271 case 1: 275 case 1:
272 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 276 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
273 { 277 {
274 setText(); 278 setText();
275 } 279 }
276 else 280 else
277 { 281 {
278 if ( m_recMail->Wrapper() != 0l ) 282 if ( m_recMail->Wrapper() != 0l )
279 { // make sure that there is a wrapper , even after delete or simular actions 283 { // make sure that there is a wrapper , even after delete or simular actions
280 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 284 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
281 } 285 }
282 } 286 }
283 break; 287 break;
284 } 288 }
285 delete menu; 289 delete menu;
286} 290}
287 291
288 292
289void ViewMail::setMail(const RecMailP&mail ) 293void ViewMail::setMail(const RecMailP&mail )
290{ 294{
291 295
292 m_recMail = mail; 296 m_recMail = mail;
293 297
294 m_mail[0] = mail->getFrom(); 298 m_mail[0] = mail->getFrom();
295 m_mail[1] = mail->getSubject(); 299 m_mail[1] = mail->getSubject();
296 m_mail[3] = mail->getDate(); 300 m_mail[3] = mail->getDate();
297 m_mail[4] = mail->Msgid(); 301 m_mail[4] = mail->Msgid();
298 302
299 m_mail2[0] = mail->To(); 303 m_mail2[0] = mail->To();
300 m_mail2[1] = mail->CC(); 304 m_mail2[1] = mail->CC();
301 m_mail2[2] = mail->Bcc(); 305 m_mail2[2] = mail->Bcc();
302 306
303 setText(); 307 setText();
304} 308}