summaryrefslogtreecommitdiff
path: root/noncore/net/mail/viewmail.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/viewmail.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 68d3c51..48b71eb 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -14,10 +14,12 @@
#include "accountview.h"
-AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num)
+AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
+ const QString&fsize,int num)
: QListViewItem(parent,after),_partNum(num)
{
setText(0, mime);
- setText(1, file);
- setText(2, desc);
+ setText(1, desc);
+ setText(2, file);
+ setText(3, fsize);
}
@@ -33,5 +35,5 @@ if (body.Parts().count()==0) {
AttachItem * curItem=0;
QString type=body.Description().Type()+"/"+body.Description().Subtype();
-QString desc;
+QString desc,fsize;
double s = body.Description().Size();
int w;
@@ -62,5 +64,5 @@ default:
code is it will be destructed after finishing its small job.
*/
- QTextOStream o(&desc);
+ QTextOStream o(&fsize);
if (w>0) o.precision(2); else o.precision(0);
o.setf(QTextStream::fixed);
@@ -68,5 +70,5 @@ default:
}
-curItem=new AttachItem(attachments,curItem,type,"Mailbody",desc,-1);
+curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1);
QString filename = "";
for (unsigned int i = 0; i < body.Parts().count();++i) {
@@ -74,4 +76,5 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin();
for (;it!=body.Parts()[i].Parameters().end();++it) {
+ qDebug(it.key());
if (it.key().lower()=="name") {
filename=it.data();
@@ -96,20 +99,25 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
break;
}
- QTextOStream o(&desc);
+ QTextOStream o(&fsize);
if (w>0) o.precision(2); else o.precision(0);
o.setf(QTextStream::fixed);
o << s << " " << q << "Byte";
- curItem=new AttachItem(attachments,curItem,type,filename,desc,i);
+ desc = body.Parts()[i].Description();
+ curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i);
}
}
-void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int c ) {
+void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) {
if (!item )
return;
- QPopupMenu *menu = new QPopupMenu();
+ if ( ( ( AttachItem* )item )->Partnumber() == -1 ) {
+ setText();
+ return;
+ }
+ QPopupMenu *menu = new QPopupMenu();
int ret=0;
- if ( item->text( 0 ).left( 4 ) == "text" ) {
+ if ( item->text( 0 ).left( 5 ) == "text/" ) {
menu->insertItem( tr( "Show Text" ), 1 );
}
@@ -124,5 +132,5 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
types.insert( "all", "*" );
QString str = OFileDialog::getSaveFileName( 1,
- "/", item->text( 1 ) , types, 0 );
+ "/", item->text( 2 ) , types, 0 );
if( !str.isEmpty() ) {