summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-09 14:59:26 (UTC)
committer alwin <alwin>2005-03-09 14:59:26 (UTC)
commit8e618d7a6d195cb737946e89370d5c60f92e8f86 (patch) (unidiff)
treea4cfada2c0420fb40c483ace4dc2a6fce4258d6a
parent84f237fb3b83400a031bf7c2d3025f78c02f28a8 (diff)
downloadopie-8e618d7a6d195cb737946e89370d5c60f92e8f86.zip
opie-8e618d7a6d195cb737946e89370d5c60f92e8f86.tar.gz
opie-8e618d7a6d195cb737946e89370d5c60f92e8f86.tar.bz2
small bugfix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/viewmail.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 5206220..a89393c 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -167,64 +167,65 @@ void ViewMail::setBody(const RecBodyP&body )
167 case 2: 167 case 2:
168 q="M"; 168 q="M";
169 break; 169 break;
170 default: 170 default:
171 q=""; 171 q="";
172 break; 172 break;
173 } 173 }
174 QTextOStream o(&fsize); 174 QTextOStream o(&fsize);
175 if (w>0) o.precision(2); else o.precision(0); 175 if (w>0) o.precision(2); else o.precision(0);
176 o.setf(QTextStream::fixed); 176 o.setf(QTextStream::fixed);
177 o << s << " " << q << "Byte"; 177 o << s << " " << q << "Byte";
178 desc = body->Parts()[i]->Description(); 178 desc = body->Parts()[i]->Description();
179 parentItem = searchParent(body->Parts()[i]->Positionlist()); 179 parentItem = searchParent(body->Parts()[i]->Positionlist());
180 if (parentItem) 180 if (parentItem)
181 { 181 {
182 AttachItem*temp = lastChild(parentItem); 182 AttachItem*temp = lastChild(parentItem);
183 if (temp) curItem = temp; 183 if (temp) curItem = temp;
184 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 184 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
185 attachments->setRootIsDecorated(true); 185 attachments->setRootIsDecorated(true);
186 curItem = parentItem; 186 curItem = parentItem;
187 } 187 }
188 else 188 else
189 { 189 {
190 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 190 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
191 } 191 }
192 } 192 }
193} 193}
194 194
195 195
196void ViewMail::slotShowHtml( bool state ) 196void ViewMail::slotShowHtml( bool state )
197{ 197{
198 m_showHtml = state; 198 m_showHtml = state;
199 m_lasttextpart=-2;
199 setMainText(); 200 setMainText();
200} 201}
201 202
202void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 203void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
203{ 204{
204 if (!item ) 205 if (!item )
205 return; 206 return;
206 207
207 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 208 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
208 { 209 {
209 setMainText(); 210 setMainText();
210 return; 211 return;
211 } 212 }
212 QPopupMenu *menu = new QPopupMenu(); 213 QPopupMenu *menu = new QPopupMenu();
213 int ret=0; 214 int ret=0;
214 215
215 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 216 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
216 { 217 {
217 menu->insertItem( tr( "Show Text" ), 1 ); 218 menu->insertItem( tr( "Show Text" ), 1 );
218 } 219 }
219 if (item->text(0).left(6)=="image/") { 220 if (item->text(0).left(6)=="image/") {
220 menu->insertItem(tr("Display image preview"),2); 221 menu->insertItem(tr("Display image preview"),2);
221 } 222 }
222 menu->insertItem( tr( "Save Attachment" ), 0 ); 223 menu->insertItem( tr( "Save Attachment" ), 0 );
223 menu->insertSeparator(1); 224 menu->insertSeparator(1);
224 225
225 ret = menu->exec( point, 0 ); 226 ret = menu->exec( point, 0 );
226 227
227 switch(ret) 228 switch(ret)
228 { 229 {
229 case 0: 230 case 0:
230 { 231 {
@@ -302,64 +303,65 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
302 browser->show(); 303 browser->show();
303 } 304 }
304 if (m_lasttextpart == ( ( AttachItem* )item )->Partnumber() ) return; 305 if (m_lasttextpart == ( ( AttachItem* )item )->Partnumber() ) return;
305 m_lasttextpart = ( ( AttachItem* )item )->Partnumber(); 306 m_lasttextpart = ( ( AttachItem* )item )->Partnumber();
306 QString s = m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );; 307 QString s = m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );;
307 if (item->text(0).right(4)!="html") { 308 if (item->text(0).right(4)!="html") {
308 s = QString("<html><body>\n<font face=fixed>%1</font></body></html>").arg(QStyleSheet::convertFromPlainText(s)); 309 s = QString("<html><body>\n<font face=fixed>%1</font></body></html>").arg(QStyleSheet::convertFromPlainText(s));
309 } 310 }
310 browser->setText(s); 311 browser->setText(s);
311 } 312 }
312 } 313 }
313 break; 314 break;
314 } 315 }
315 delete menu; 316 delete menu;
316} 317}
317 318
318 319
319void ViewMail::setMail(const RecMailP&mail ) 320void ViewMail::setMail(const RecMailP&mail )
320{ 321{
321 322
322 m_recMail = mail; 323 m_recMail = mail;
323 324
324 m_mail[0] = mail->getFrom(); 325 m_mail[0] = mail->getFrom();
325 m_mail[1] = mail->getSubject(); 326 m_mail[1] = mail->getSubject();
326 m_mail[3] = mail->getStringDate(); 327 m_mail[3] = mail->getStringDate();
327 m_mail[4] = mail->Msgid(); 328 m_mail[4] = mail->Msgid();
328 329
329 m_mail2[0] = mail->To(); 330 m_mail2[0] = mail->To();
330 m_mail2[1] = mail->CC(); 331 m_mail2[1] = mail->CC();
331 m_mail2[2] = mail->Bcc(); 332 m_mail2[2] = mail->Bcc();
332 333
333 setCaption(tr("E-Mail by %1").arg( m_mail[0] ) ); 334 setCaption(tr("E-Mail by %1").arg( m_mail[0] ) );
335 m_lasttextpart=-2;
334 setMainText(); 336 setMainText();
335} 337}
336 338
337 339
338 340
339ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 341ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
340 : ViewMailBase(parent, name, fl), _inLoop(false) 342 : ViewMailBase(parent, name, fl), _inLoop(false)
341{ 343{
342 m_gotBody = false; 344 m_gotBody = false;
343 deleted = false; 345 deleted = false;
344 346
345 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 347 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
346 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 348 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
347 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 349 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
348 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 350 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
349 connect( showPicsInline, SIGNAL( toggled(bool) ), SLOT( slotImageInline(bool) ) ); 351 connect( showPicsInline, SIGNAL( toggled(bool) ), SLOT( slotImageInline(bool) ) );
350 352
351 attachments->setEnabled(m_gotBody); 353 attachments->setEnabled(m_gotBody);
352 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 354 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
353 m_lastdlg = 0; 355 m_lastdlg = 0;
354 _icounter = 0; 356 _icounter = 0;
355 m_lastimagepart = -1; 357 m_lastimagepart = -1;
356 m_lasttextpart = -2; 358 m_lasttextpart = -2;
357 359
358 readConfig(); 360 readConfig();
359 attachments->setSorting(-1); 361 attachments->setSorting(-1);
360} 362}
361 363
362void ViewMail::slotImageInline(bool how) 364void ViewMail::slotImageInline(bool how)
363{ 365{
364 Config cfg( "mail" ); 366 Config cfg( "mail" );
365 cfg.writeEntry( "showPicsInline", how); 367 cfg.writeEntry( "showPicsInline", how);