summaryrefslogtreecommitdiffabout
path: root/kmicromail
Side-by-side diff
Diffstat (limited to 'kmicromail') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/composemail.cpp24
-rw-r--r--kmicromail/mailistviewitem.cpp73
-rw-r--r--kmicromail/mailistviewitem.h5
-rw-r--r--kmicromail/mainwindow.cpp8
-rw-r--r--kmicromail/opiemail.cpp2
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
@@ -44,6 +44,6 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
QString defmail = con.preferredEmail();
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" ) );
if (defmail.length()!=0) {
@@ -74,12 +74,4 @@ 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) ) );
connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
@@ -92,4 +84,12 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
mMail = 0;
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;
+ }
}
void ComposeMail::saveAsDraft()
@@ -321,6 +321,6 @@ 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"),
tr("No"));
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index b9b4cd9..1ca0ada 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -22,36 +22,40 @@ 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();
@@ -92,9 +96,10 @@ void MailListViewItem::showEntry()
else if ( mon == "Dec" )
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);
}
// if ( date.left(1) != "1" || date.left(1) != "2" )
// date = date.mid(5);
- setText(4,date);
+ mKeyMap.insert(4,date);
+ setText(4,mail_data->getDate());
}
@@ -103,4 +108,26 @@ void MailListViewItem::storeData(const RecMailP&data)
mail_data = 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;
+ */
+}
const RecMailP& MailListViewItem::data()const
diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h
index d953d83..cf8040b 100644
--- a/kmicromail/mailistviewitem.h
+++ b/kmicromail/mailistviewitem.h
@@ -16,7 +16,10 @@ public:
void showEntry();
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
@@ -96,5 +96,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
folderView = new AccountView( split );
folderView->header()->hide();
- folderView->setRootIsDecorated( true );
+ folderView->setRootIsDecorated( false );
folderView->addColumn( tr( "Mailbox" ) );
@@ -106,8 +106,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
mailView->addColumn( tr( "Sender" ),QListView::Manual );
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 );
statusWidget->hide();
@@ -177,5 +177,5 @@ void MainWindow::slotAdjustColumns()
mailView->setColumnWidth( 0, 10 );
- mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
+ mailView->setColumnWidth( 1, 80 );
mailView->setColumnWidth( 2, 80 );
mailView->setColumnWidth( 3, 50 );
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index b1992ec..bdbd93a 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -149,5 +149,5 @@ void OpieMail::slotSendQueued()
if (smtpList.count()==0)
{
- QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
+ QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
return;
}