-rw-r--r-- | kmicromail/accountview.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 17 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 24 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 38 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 7 |
6 files changed, 69 insertions, 20 deletions
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h index fcf33d1..79ed2e7 100644 --- a/kmicromail/accountview.h +++ b/kmicromail/accountview.h | |||
@@ -27,3 +27,3 @@ public: | |||
27 | virtual bool currentisDraft(); | 27 | virtual bool currentisDraft(); |
28 | 28 | QValueList<MHviewItem*> allAccounts() { return mhAccounts;} | |
29 | public slots: | 29 | public slots: |
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index 89150ad..96d55e6 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp | |||
@@ -32,2 +32,19 @@ static bool stringCompareRec( const QString& s1, const QString& s2 ) | |||
32 | 32 | ||
33 | const QString RecMail::MsgsizeString() const | ||
34 | { | ||
35 | |||
36 | double s = msg_size; | ||
37 | int w = 0; | ||
38 | s/=1024; | ||
39 | if (s>999.0) { | ||
40 | s/=1024.0; | ||
41 | ++w; | ||
42 | } | ||
43 | QString fsize = QString::number( s, 'f', 2 ); | ||
44 | if ( w == 0 ) { | ||
45 | fsize += "kB" ; | ||
46 | } else | ||
47 | fsize += "MB" ; | ||
48 | return fsize; | ||
49 | } | ||
33 | bool RecMail::isEqual( RecMail* r1 ) | 50 | bool RecMail::isEqual( RecMail* r1 ) |
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h index 32d92c0..39c0bac 100644 --- a/kmicromail/libmailwrapper/mailtypes.h +++ b/kmicromail/libmailwrapper/mailtypes.h | |||
@@ -57,2 +57,3 @@ public: | |||
57 | const unsigned int Msgsize()const{return msg_size;} | 57 | const unsigned int Msgsize()const{return msg_size;} |
58 | const QString MsgsizeString()const; | ||
58 | 59 | ||
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index ffb835c..137c482 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -24,12 +24,3 @@ void MailListViewItem::showEntry() | |||
24 | } | 24 | } |
25 | double s = mail_data->Msgsize(); | 25 | QString fsize = mail_data->MsgsizeString(); |
26 | int w = 0; | ||
27 | s/=1024; | ||
28 | if (s>999.0) { | ||
29 | s/=1024.0; | ||
30 | ++w; | ||
31 | } | ||
32 | QString fsort; | ||
33 | fsort.sprintf( "%.2f", s ); | ||
34 | QString fsize = QString::number( s, 'f', 2 ); | ||
35 | // 1.23 | 26 | // 1.23 |
@@ -38,7 +29,8 @@ void MailListViewItem::showEntry() | |||
38 | // 999.23 maxlen | 29 | // 999.23 maxlen |
30 | QString fsort; | ||
39 | switch(fsize.length() ) { | 31 | switch(fsize.length() ) { |
40 | case 4: | 32 | case 6: |
41 | fsort = "00" + fsize ; | 33 | fsort = "00" + fsize ; |
42 | break; | 34 | break; |
43 | case 5: | 35 | case 7: |
44 | fsort = "0" + fsize ; | 36 | fsort = "0" + fsize ; |
@@ -50,8 +42,8 @@ void MailListViewItem::showEntry() | |||
50 | } | 42 | } |
51 | if ( w == 0 ) { | 43 | setText(3, fsize ); |
52 | setText(3, fsize + "kB" ); | 44 | //qDebug("fsize *%s* ",fsize.latin1() ); |
45 | //qDebug("fsort *%s* ",fsort.latin1() ); | ||
46 | if ( fsize.right(2) == "kB" ) { | ||
53 | mKeyMap.insert(3, "k" + fsort); | 47 | mKeyMap.insert(3, "k" + fsort); |
54 | //setText(3, "kB" + fsort ); // test only | ||
55 | } else { | 48 | } else { |
56 | //setText(3, fsize + "MB"); | ||
57 | mKeyMap.insert(3, "M" +fsort ); | 49 | mKeyMap.insert(3, "M" +fsort ); |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 6e54bf4..760e3b0 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -23,2 +23,3 @@ | |||
23 | #include "accountitem.h" | 23 | #include "accountitem.h" |
24 | #include "accountview.h" | ||
24 | #include "klocale.h" | 25 | #include "klocale.h" |
@@ -315,3 +316,38 @@ void OpieMail::slotDownloadMail( ) | |||
315 | { | 316 | { |
316 | qDebug("slotDownloadMail( ) "); | 317 | QListViewItem*item = mailView->currentItem(); |
318 | if (!item ) { | ||
319 | Global::statusMessage("Error: No item slected!"); | ||
320 | return; | ||
321 | } | ||
322 | RecMailP mail = ((MailListViewItem*)item)->data(); | ||
323 | Account * acc = mail->Wrapper()->getAccount(); | ||
324 | if ( !acc ) { | ||
325 | Global::statusMessage("Mail is already stored locally!"); | ||
326 | return; | ||
327 | } | ||
328 | QString lfName = acc->getLocalFolder(); | ||
329 | //qDebug("local folder " + lfName ); | ||
330 | if ( lfName.isEmpty() ) | ||
331 | lfName = acc->getAccountName(); | ||
332 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); | ||
333 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); | ||
334 | if ( targetMail == mail->Wrapper() ) { | ||
335 | Global::statusMessage("Mail is already locally stored!"); | ||
336 | return; | ||
337 | } | ||
338 | if ( !targetMail->createMbox(lfName)) { | ||
339 | Global::statusMessage("Error creating folder!"); | ||
340 | return; | ||
341 | } | ||
342 | Global::statusMessage("Fetching mail...please wait!"); | ||
343 | qApp->processEvents(); | ||
344 | encodedString*st = 0; | ||
345 | st = mail->Wrapper()->fetchRawBody(mail); | ||
346 | if ( st ) { | ||
347 | targetMail->storeMessage(st->Content(),st->Length(),lfName); | ||
348 | Global::statusMessage("Mail stored in "+ lfName); | ||
349 | delete st; | ||
350 | } else { | ||
351 | Global::statusMessage("Error: Cannot fetch mail!"); | ||
352 | } | ||
317 | } | 353 | } |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 767a369..726f540 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -379,4 +379,7 @@ void ViewMail::setText() | |||
379 | 379 | ||
380 | 380 | #ifdef DESKTOP_VERSION | |
381 | setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); | 381 | setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) ); |
382 | #else | ||
383 | setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] ); | ||
384 | #endif | ||
382 | 385 | ||