author | alwin <alwin> | 2003-12-14 22:30:26 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-14 22:30:26 (UTC) |
commit | bdc60d27df0fa3a861e9117547fd2bed8a39661e (patch) (side-by-side diff) | |
tree | 8dba1e590e60443ec0aff14398da665d351b0aa4 | |
parent | 172c790df9004205eda2da25832cdc88fc6481ee (diff) | |
download | opie-bdc60d27df0fa3a861e9117547fd2bed8a39661e.zip opie-bdc60d27df0fa3a861e9117547fd2bed8a39661e.tar.gz opie-bdc60d27df0fa3a861e9117547fd2bed8a39661e.tar.bz2 |
-answered mails get another pic (checked in in pics/opiemail)
-if a description for an attachment exists it will displayed
-if mailbody is selected from list of attachments it will displayd without
menu
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 32 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/viewmailbase.cpp | 5 |
10 files changed, 64 insertions, 22 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 @@ -696,6 +696,9 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) free(t); } } + if (which->bd_description) { + target_part.setDescription(QString(which->bd_description)); + } target_part.setEncoding(encoding); target_part.setSize(which->bd_size); } @@ -760,7 +763,7 @@ void IMAPwrapper::answeredMail(const RecMail&mail) } 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 ); 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 @@ -696,6 +696,9 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) free(t); } } + if (which->bd_description) { + target_part.setDescription(QString(which->bd_description)); + } target_part.setEncoding(encoding); target_part.setSize(which->bd_size); } @@ -760,7 +763,7 @@ void IMAPwrapper::answeredMail(const RecMail&mail) } 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 ); 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 @@ -85,7 +85,7 @@ const QStringList& RecMail::Bcc()const } 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(); @@ -155,6 +155,16 @@ 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; 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 @@ -80,7 +80,7 @@ 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 */ @@ -98,6 +98,8 @@ public: 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); 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 @@ -85,7 +85,7 @@ const QStringList& RecMail::Bcc()const } 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(); @@ -155,6 +155,16 @@ 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; 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 @@ -80,7 +80,7 @@ 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 */ @@ -98,6 +98,8 @@ public: 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); 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 @@ -199,7 +199,9 @@ MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 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") ); 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 @@ -13,12 +13,14 @@ #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 ) { @@ -32,7 +34,7 @@ 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; w=0; @@ -61,18 +63,19 @@ default: 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(); } @@ -95,22 +98,27 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { 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; - 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 ); } menu->insertItem( tr( "Save Attachment" ), 0 ); @@ -123,7 +131,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int { 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" ); 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 @@ -11,7 +11,8 @@ 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: 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 @@ -55,8 +55,9 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) attachments->setMaximumHeight(90); attachments->setAllColumnsShowFocus(true); attachments->addColumn("Mime Type", 60); - attachments->addColumn(tr("Filename"), 100); - attachments->addColumn(tr("Size"), 80); + attachments->addColumn(tr("Description"), 100); + attachments->addColumn(tr("Filename"), 80); + attachments->addColumn(tr("Size"), 80); attachments->setSorting(-1); attachments->hide(); |