-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 89530ab..9a37510 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -3,8 +3,9 @@ #include <qheader.h> #include <qtimer.h> #include <qlayout.h> #include <qmessagebox.h> +#include <qtextstream.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> @@ -92,8 +93,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) mailView = new QListView( view ); mailView->addColumn( tr( "" ) ); mailView->addColumn( tr( "Subject" ),QListView::Manual ); mailView->addColumn( tr( "Sender" ),QListView::Manual ); + mailView->addColumn( tr( "Size" ),QListView::Manual); mailView->addColumn( tr( "Date" )); mailView->setAllColumnsShowFocus(true); mailView->setSorting(-1); @@ -135,8 +137,9 @@ void MainWindow::slotAdjustColumns() mailView->setColumnWidth( 0, 10 ); mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); mailView->setColumnWidth( 2, 80 ); mailView->setColumnWidth( 3, 50 ); + mailView->setColumnWidth( 4, 50 ); } void MainWindow::slotShowFolders( bool show ) { @@ -201,15 +204,48 @@ void MailListViewItem::showEntry() { if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) { setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { - setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); + /* I think it looks nicer if there are not such a log of icons but only on mails + replied or new - Alwin*/ + //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); } else { setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); } + double s = mail_data.Msgsize(); + int w; + w=0; + + while (s>1024) { + s/=1024; + ++w; + if (w>=2) break; + } + + QString q=""; + QString fsize=""; + switch(w) { + case 1: + q="k"; + break; + case 2: + q="M"; + break; + default: + break; + } + + { + QTextOStream o(&fsize); + if (w>0) o.precision(2); else o.precision(0); + o.setf(QTextStream::fixed); + o << s << " " << q << "Byte"; + } + setText(1,mail_data.getSubject()); setText(2,mail_data.getFrom()); - setText(3,mail_data.getDate()); + setText(3,fsize); + setText(4,mail_data.getDate()); } void MailListViewItem::storeData(const RecMail&data) { |