summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-24 18:05:48 (UTC)
committer zautrix <zautrix>2005-01-24 18:05:48 (UTC)
commit77f93c632b66b5c8d92e4c63330362272ca1fc40 (patch) (side-by-side diff)
tree31f28656062c899b5368f13ab594ff6fa5c657fa
parent6c89efd80c1e94a0c070025d07c7a4c656f2a81e (diff)
downloadkdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.zip
kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.gz
kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.bz2
mail fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--kmicromail/accountview.h2
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp17
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h1
-rw-r--r--kmicromail/mailistviewitem.cpp24
-rw-r--r--kmicromail/opiemail.cpp38
-rw-r--r--kmicromail/viewmail.cpp7
7 files changed, 72 insertions, 21 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 2516b2a..42b36f1 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -21,3 +21,3 @@ Fixed the problem, that the state flag of imap mails was ignored.
Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
-to idecate that they are already seen.
+to indecate that they are already seen.
Fixed the problem that the body of some mails was not displayed in the
@@ -26,2 +26,4 @@ Made it (configurable) possible to show the "To:" field in the list view.
Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
+Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the
+local storage folder (specified in account setiings) of the account of the mail.
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:
virtual bool currentisDraft();
-
+ QValueList<MHviewItem*> allAccounts() { return mhAccounts;}
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 )
+const QString RecMail::MsgsizeString() const
+{
+
+ double s = msg_size;
+ int w = 0;
+ s/=1024;
+ if (s>999.0) {
+ s/=1024.0;
+ ++w;
+ }
+ QString fsize = QString::number( s, 'f', 2 );
+ if ( w == 0 ) {
+ fsize += "kB" ;
+ } else
+ fsize += "MB" ;
+ return fsize;
+}
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:
const unsigned int Msgsize()const{return msg_size;}
+ const QString MsgsizeString()const;
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()
}
- double s = mail_data->Msgsize();
- int w = 0;
- s/=1024;
- if (s>999.0) {
- s/=1024.0;
- ++w;
- }
- QString fsort;
- fsort.sprintf( "%.2f", s );
- QString fsize = QString::number( s, 'f', 2 );
+ QString fsize = mail_data->MsgsizeString();
// 1.23
@@ -38,7 +29,8 @@ void MailListViewItem::showEntry()
// 999.23 maxlen
+ QString fsort;
switch(fsize.length() ) {
- case 4:
+ case 6:
fsort = "00" + fsize ;
break;
- case 5:
+ case 7:
fsort = "0" + fsize ;
@@ -50,8 +42,8 @@ void MailListViewItem::showEntry()
}
- if ( w == 0 ) {
- setText(3, fsize + "kB" );
+ setText(3, fsize );
+ //qDebug("fsize *%s* ",fsize.latin1() );
+ //qDebug("fsort *%s* ",fsort.latin1() );
+ if ( fsize.right(2) == "kB" ) {
mKeyMap.insert(3, "k" + fsort);
- //setText(3, "kB" + fsort ); // test only
} else {
- //setText(3, fsize + "MB");
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 @@
#include "accountitem.h"
+#include "accountview.h"
#include "klocale.h"
@@ -315,3 +316,38 @@ void OpieMail::slotDownloadMail( )
{
- qDebug("slotDownloadMail( ) ");
+ QListViewItem*item = mailView->currentItem();
+ if (!item ) {
+ Global::statusMessage("Error: No item slected!");
+ return;
+ }
+ RecMailP mail = ((MailListViewItem*)item)->data();
+ Account * acc = mail->Wrapper()->getAccount();
+ if ( !acc ) {
+ Global::statusMessage("Mail is already stored locally!");
+ return;
+ }
+ QString lfName = acc->getLocalFolder();
+ //qDebug("local folder " + lfName );
+ if ( lfName.isEmpty() )
+ lfName = acc->getAccountName();
+ AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper();
+ //qDebug("target %d %d ",targetMail,mail->Wrapper() );
+ if ( targetMail == mail->Wrapper() ) {
+ Global::statusMessage("Mail is already locally stored!");
+ return;
+ }
+ if ( !targetMail->createMbox(lfName)) {
+ Global::statusMessage("Error creating folder!");
+ return;
+ }
+ Global::statusMessage("Fetching mail...please wait!");
+ qApp->processEvents();
+ encodedString*st = 0;
+ st = mail->Wrapper()->fetchRawBody(mail);
+ if ( st ) {
+ targetMail->storeMessage(st->Content(),st->Length(),lfName);
+ Global::statusMessage("Mail stored in "+ lfName);
+ delete st;
+ } else {
+ Global::statusMessage("Error: Cannot fetch mail!");
+ }
}
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()
-
- setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) );
+#ifdef DESKTOP_VERSION
+ setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) );
+#else
+ setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] );
+#endif