summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/imapwrapper.cpp5
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp5
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp12
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h4
-rw-r--r--noncore/net/mail/mailtypes.cpp12
-rw-r--r--noncore/net/mail/mailtypes.h4
-rw-r--r--noncore/net/mail/mainwindow.cpp4
-rw-r--r--noncore/net/mail/viewmail.cpp30
-rw-r--r--noncore/net/mail/viewmail.h3
-rw-r--r--noncore/net/mail/viewmailbase.cpp3
10 files changed, 62 insertions, 20 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index 0ce2c6c..ad95384 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -691,16 +691,19 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
default:
if (enc->enc_value) {
char*t=enc->enc_value;
encoding=QString(enc->enc_value);
enc->enc_value=0L;
free(t);
}
}
+ if (which->bd_description) {
+ target_part.setDescription(QString(which->bd_description));
+ }
target_part.setEncoding(encoding);
target_part.setSize(which->bd_size);
}
QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part)
{
return fetchPart(mail,part.Positionlist(),false);
}
@@ -755,17 +758,17 @@ void IMAPwrapper::answeredMail(const RecMail&mail)
const char *mb = mail.getMbox().latin1();
err = mailimap_select( m_imap, (char*)mb);
if ( err != MAILIMAP_NO_ERROR ) {
qDebug("error selecting mailbox for mark: %s",m_imap->imap_response);
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_answered());
- store_flags = mailimap_store_att_flags_new_set_flags(flist);
+ store_flags = mailimap_store_att_flags_new_add_flags(flist);
set = mailimap_set_new_single(mail.getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
qDebug("error marking mail: %s",m_imap->imap_response);
return;
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 0ce2c6c..ad95384 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -691,16 +691,19 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
default:
if (enc->enc_value) {
char*t=enc->enc_value;
encoding=QString(enc->enc_value);
enc->enc_value=0L;
free(t);
}
}
+ if (which->bd_description) {
+ target_part.setDescription(QString(which->bd_description));
+ }
target_part.setEncoding(encoding);
target_part.setSize(which->bd_size);
}
QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part)
{
return fetchPart(mail,part.Positionlist(),false);
}
@@ -755,17 +758,17 @@ void IMAPwrapper::answeredMail(const RecMail&mail)
const char *mb = mail.getMbox().latin1();
err = mailimap_select( m_imap, (char*)mb);
if ( err != MAILIMAP_NO_ERROR ) {
qDebug("error selecting mailbox for mark: %s",m_imap->imap_response);
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_answered());
- store_flags = mailimap_store_att_flags_new_set_flags(flist);
+ store_flags = mailimap_store_att_flags_new_add_flags(flist);
set = mailimap_set_new_single(mail.getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
qDebug("error marking mail: %s",m_imap->imap_response);
return;
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
index 94f5d6f..8d9b247 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.cpp
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -80,17 +80,17 @@ void RecMail::setBcc(const QStringList&list)
}
const QStringList& RecMail::Bcc()const
{
return bcc;
}
RecPart::RecPart()
- : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0),m_size(0)
+ : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
{
m_Parameters.clear();
m_poslist.clear();
}
RecPart::~RecPart()
{
}
@@ -150,16 +150,26 @@ const QString& RecPart::Encoding()const
return m_encoding;
}
void RecPart::setEncoding(const QString&encoding)
{
m_encoding = encoding;
}
+const QString& RecPart::Description()const
+{
+ return m_description;
+}
+
+void RecPart::setDescription(const QString&desc)
+{
+ m_description = desc;
+}
+
void RecPart::setParameters(const part_plist_t&list)
{
m_Parameters = list;
}
const part_plist_t& RecPart::Parameters()const
{
return m_Parameters;
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h
index 9ef762d..7d7bebc 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.h
+++ b/noncore/net/mail/libmailwrapper/mailtypes.h
@@ -75,17 +75,17 @@ protected:
void copy_old(const RecMail&old);
};
typedef QMap<QString,QString> part_plist_t;
class RecPart
{
protected:
- QString m_type,m_subtype,m_identifier,m_encoding;
+ QString m_type,m_subtype,m_identifier,m_encoding,m_description;
unsigned int m_lines,m_size;
part_plist_t m_Parameters;
/* describes the position in the mail */
QValueList<int> m_poslist;
public:
RecPart();
virtual ~RecPart();
@@ -93,16 +93,18 @@ public:
const QString&Type()const;
void setType(const QString&type);
const QString&Subtype()const;
void setSubtype(const QString&subtype);
const QString&Identifier()const;
void setIdentifier(const QString&identifier);
const QString&Encoding()const;
void setEncoding(const QString&encoding);
+ const QString&Description()const;
+ void setDescription(const QString&desc);
void setLines(unsigned int lines);
const unsigned int Lines()const;
void setSize(unsigned int size);
const unsigned int Size()const;
void setParameters(const part_plist_t&list);
const part_plist_t&Parameters()const;
diff --git a/noncore/net/mail/mailtypes.cpp b/noncore/net/mail/mailtypes.cpp
index 94f5d6f..8d9b247 100644
--- a/noncore/net/mail/mailtypes.cpp
+++ b/noncore/net/mail/mailtypes.cpp
@@ -80,17 +80,17 @@ void RecMail::setBcc(const QStringList&list)
}
const QStringList& RecMail::Bcc()const
{
return bcc;
}
RecPart::RecPart()
- : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0),m_size(0)
+ : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
{
m_Parameters.clear();
m_poslist.clear();
}
RecPart::~RecPart()
{
}
@@ -150,16 +150,26 @@ const QString& RecPart::Encoding()const
return m_encoding;
}
void RecPart::setEncoding(const QString&encoding)
{
m_encoding = encoding;
}
+const QString& RecPart::Description()const
+{
+ return m_description;
+}
+
+void RecPart::setDescription(const QString&desc)
+{
+ m_description = desc;
+}
+
void RecPart::setParameters(const part_plist_t&list)
{
m_Parameters = list;
}
const part_plist_t& RecPart::Parameters()const
{
return m_Parameters;
diff --git a/noncore/net/mail/mailtypes.h b/noncore/net/mail/mailtypes.h
index 9ef762d..7d7bebc 100644
--- a/noncore/net/mail/mailtypes.h
+++ b/noncore/net/mail/mailtypes.h
@@ -75,17 +75,17 @@ protected:
void copy_old(const RecMail&old);
};
typedef QMap<QString,QString> part_plist_t;
class RecPart
{
protected:
- QString m_type,m_subtype,m_identifier,m_encoding;
+ QString m_type,m_subtype,m_identifier,m_encoding,m_description;
unsigned int m_lines,m_size;
part_plist_t m_Parameters;
/* describes the position in the mail */
QValueList<int> m_poslist;
public:
RecPart();
virtual ~RecPart();
@@ -93,16 +93,18 @@ public:
const QString&Type()const;
void setType(const QString&type);
const QString&Subtype()const;
void setSubtype(const QString&subtype);
const QString&Identifier()const;
void setIdentifier(const QString&identifier);
const QString&Encoding()const;
void setEncoding(const QString&encoding);
+ const QString&Description()const;
+ void setDescription(const QString&desc);
void setLines(unsigned int lines);
const unsigned int Lines()const;
void setSize(unsigned int size);
const unsigned int Size()const;
void setParameters(const part_plist_t&list);
const part_plist_t&Parameters()const;
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index fae3e97..8e2132e 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -194,17 +194,19 @@ void MainWindow::slotDeleteMail()
MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
:QListViewItem(parent,item),mail_data()
{
}
void MailListViewItem::showEntry()
{
- if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
+ if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) {
+ setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgreplied") );
+ } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
} else {
setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") );
}
setText(1,mail_data.getSubject());
setText(2,mail_data.getFrom());
setText(3,mail_data.getDate());
}
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
@@ -8,36 +8,38 @@
#include <opie/ofiledialog.h>
#include "settings.h"
#include "composemail.h"
#include "viewmail.h"
#include "abstractmail.h"
#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);
}
void ViewMail::setBody( RecBody body ) {
m_body = body;
m_mail[2] = body.Bodytext();
attachbutton->setEnabled(body.Parts().count()>0);
attachments->setEnabled(body.Parts().count()>0);
if (body.Parts().count()==0) {
return;
}
AttachItem * curItem=0;
QString type=body.Description().Type()+"/"+body.Description().Subtype();
-QString desc;
+QString desc,fsize;
double s = body.Description().Size();
int w;
w=0;
while (s>1024) {
s/=1024;
++w;
if (w>=2) break;
@@ -56,28 +58,29 @@ default:
}
{
/* I did not found a method to make a CONTENT reset on a QTextStream
so I use this construct that the stream will re-constructed in each
loop. To let it work, the textstream is packed into a own area of
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);
o << s << " " << q << "Byte";
}
-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) {
type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype();
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();
}
}
s = body.Parts()[i].Size();
w = 0;
while (s>1024) {
s/=1024;
@@ -90,45 +93,50 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
break;
case 2:
q="M";
break;
default:
q="";
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;
+ 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 );
}
menu->insertItem( tr( "Save Attachment" ), 0 );
menu->insertSeparator(1);
ret = menu->exec( point, 0 );
switch(ret) {
case 0:
{ MimeTypes types;
types.insert( "all", "*" );
QString str = OFileDialog::getSaveFileName( 1,
- "/", item->text( 1 ) , types, 0 );
+ "/", item->text( 2 ) , types, 0 );
if( !str.isEmpty() ) {
qDebug( "first we will need a MIME wrapper" );
}
}
break ;
case 1:
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index 765464c..dd7f854 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -6,17 +6,18 @@
#include <qstringlist.h>
#include "viewmailbase.h"
#include "mailtypes.h"
class AttachItem : public QListViewItem
{
public:
- AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num);
+ AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
+ const QString&fsize,int num);
int Partnumber() { return _partNum; }
private:
int _partNum;
};
class ViewMail : public ViewMailBase
{
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp
index 38f92b4..0c7f671 100644
--- a/noncore/net/mail/viewmailbase.cpp
+++ b/noncore/net/mail/viewmailbase.cpp
@@ -50,17 +50,18 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
QVBox *view = new QVBox(this);
setCentralWidget(view);
attachments = new QListView(view);
attachments->setMinimumHeight(90);
attachments->setMaximumHeight(90);
attachments->setAllColumnsShowFocus(true);
attachments->addColumn("Mime Type", 60);
- attachments->addColumn(tr("Filename"), 100);
+ attachments->addColumn(tr("Description"), 100);
+ attachments->addColumn(tr("Filename"), 80);
attachments->addColumn(tr("Size"), 80);
attachments->setSorting(-1);
attachments->hide();
browser = new QTextBrowser(view);
// openDiag = new OpenDiag(view);
// openDiag->hide();