-rw-r--r-- | kmicromail/composemail.cpp | 24 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 73 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.h | 5 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 8 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 2 |
5 files changed, 71 insertions, 41 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index ca4f247..c1b58a4 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -45,4 +45,4 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m if ( mails.count() == 0) - QMessageBox::information( parentWidget(), tr( "Hint" ), - tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!" ), + QMessageBox::information( 0, tr( "Hint" ), + tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), tr( "Ok" ) ); @@ -75,10 +75,2 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m } - if ( smtpAccounts.count() > 0 ) { - fillValues( smtpAccountBox->currentItem() ); - } else { - QMessageBox::information( parentWidget(), tr( "Problem" ), - tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail." ), - tr( "Ok" ) ); - return; - } connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); @@ -93,2 +85,10 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m warnAttach = true; + if ( smtpAccounts.count() > 0 ) { + fillValues( smtpAccountBox->currentItem() ); + } else { + QMessageBox::information( 0, tr( "Problem" ), + tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), + tr( "Ok" ) ); + return; + } } @@ -322,4 +322,4 @@ void ComposeMail::reject() //qDebug("ComposeMail::reject() "); - int yesno = QMessageBox::warning(0,tr("Stop editing message"), - tr("Store message into drafts?"), + int yesno = QMessageBox::warning(0,tr("Store message?"), + tr("Store message into drafts?\n"), tr("Yes"), diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index b9b4cd9..1ca0ada 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp @@ -23,34 +23,38 @@ void MailListViewItem::showEntry() double s = mail_data->Msgsize(); - int w; - w=0; - - while (s>1024) { + int w = 0; s/=1024; + if (s>999.0) { + s/=1024.0; ++w; - if (w>=2) break; } - - QString q=""; - QString fsize=""; - switch(w) { - case 1: - q="k"; + QString fsort; + fsort.sprintf( "%.2f", s ); + QString fsize = QString::number( s, 'f', 2 ); + // 1.23 + // 11.23 + // 111.23 + // 999.23 maxlen + switch(fsize.length() ) { + case 4: + fsort = "00" + fsize ; break; - case 2: - q="M"; + case 5: + fsort = "0" + fsize ; break; default: + fsort = fsize ; break; - } - { - QTextOStream o(&fsize); - if (w>0) o.precision(2); else o.precision(0); - o.setf(QTextStream::fixed); - o << s << " " << q << "Byte"; } - + if ( w == 0 ) { + setText(3, fsize + "kB" ); + mKeyMap.insert(3, "k" + fsort); + //setText(3, "kB" + fsort ); // test only + } else { + //setText(3, fsize + "MB"); + mKeyMap.insert(4, "M" +fsort ); + } setText(1,mail_data->getSubject()); setText(2,mail_data->getFrom()); - setText(3,fsize); + QString date = mail_data->getDate(); @@ -93,3 +97,3 @@ void MailListViewItem::showEntry() so = "12"; - date = date.mid(7,4)+"-"+so+"-"+date.left(2)+" "+date.mid(12,14); + date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); } @@ -97,3 +101,4 @@ void MailListViewItem::showEntry() // date = date.mid(5); - setText(4,date); + mKeyMap.insert(4,date); + setText(4,mail_data->getDate()); } @@ -104,2 +109,24 @@ void MailListViewItem::storeData(const RecMailP&data) } +void MailListViewItem::setSortKey(int column,const QString &key) +{ + mKeyMap.insert(column,key); +} +QString MailListViewItem::key(int column, bool) const +{ + // to make is fast, we use here special cases + if ( column == 3 || column == 4 ) { + return *mKeyMap.find(column); + } + if ( column == 1 ) { + if ( text(1).left(4).lower() == "re: " ) + return text(1).mid(4); + + } + return text(column); + /* + QMap<int,QString>::ConstIterator it = mKeyMap.find(column); + if (it == mKeyMap.end()) return text(column); + else return *it; + */ +} diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h index d953d83..cf8040b 100644 --- a/kmicromail/mailistviewitem.h +++ b/kmicromail/mailistviewitem.h @@ -17,5 +17,8 @@ public: MAILLIB::ATYPE wrapperType(); - + QString key(int column, bool) const; + void setSortKey(int column,const QString &key); protected: RecMailP mail_data; + private: + QMap<int,QString> mKeyMap; }; diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 78377ea..ddc7b3e 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -97,3 +97,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) folderView->header()->hide(); - folderView->setRootIsDecorated( true ); + folderView->setRootIsDecorated( false ); folderView->addColumn( tr( "Mailbox" ) ); @@ -107,6 +107,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) mailView->addColumn( tr( "Size" ),QListView::Manual); - mailView->addColumn( tr( "Date" )); + mailView->addColumn( tr( "Date" ),QListView::Manual); mailView->setAllColumnsShowFocus(true); //mailView->setSorting(-1); - + mailView->setRootIsDecorated( false ); statusWidget = new StatusWidget( wrapperBox ); @@ -178,3 +178,3 @@ void MainWindow::slotAdjustColumns() mailView->setColumnWidth( 0, 10 ); - mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); + mailView->setColumnWidth( 1, 80 ); mailView->setColumnWidth( 2, 80 ); diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index b1992ec..bdbd93a 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -150,3 +150,3 @@ void OpieMail::slotSendQueued() { - QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); + QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); return; |