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) (show 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
@@ -6,37 +6,39 @@ KO/Pi:
Added for the "dislplay one day" agenda mode
info in the caption and in the day lables:
Now it is displayed, if the selected day is from "day before yesterday"
to "day after tomorrow".
Made it possible to delete a Todo, which has sub-todos.
Fixed two small problems in the todo view.
Added missing German translation for filter edit and print dialog.
Made search dialog closeable by cancel key.
Made it possible to select in the date picker the (ligt grey )
dates of the prev./next month with the mouse.
OM/Pi:
"Delete mail" icon in main window now deletes all selected mails.
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
mail viewer when fetching them from the imap server directly to read them.
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.
********** VERSION 1.9.19 ************
Added a lot of missing translations to KA/Pi,
Added some missing translations to KO/Pi and OM/Pi.
Fixed some minor problems in KA/Pi + KO/Pi.
Fixed a crash when closing PwM/Pi.
Added German translation for PwM/Pi.
Made view change and Month View update faster in KO/Pi.
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h
index fcf33d1..79ed2e7 100644
--- a/kmicromail/accountview.h
+++ b/kmicromail/accountview.h
@@ -12,33 +12,33 @@ class AbstractMail;
class Account;
class IMAPviewItem;
class MHviewItem;
class AccountView : public QListView
{
Q_OBJECT
public:
AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
virtual ~AccountView();
virtual void populate( QList<Account> list );
virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail);
virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
virtual bool currentisDraft();
-
+ QValueList<MHviewItem*> allAccounts() { return mhAccounts;}
public slots:
virtual void refreshAll();
virtual void refresh(QListViewItem *item);
virtual void refreshCurrent();
virtual void slotHold(int, QListViewItem *,const QPoint&,int);
virtual void slotContextMenu(int id);
void setupFolderselect(Selectstore*sels);
signals:
void refreshMailview(const QValueList<RecMailP>& );
protected:
QListViewItem* m_currentItem;
QValueList<IMAPviewItem*> imapAccounts;
QValueList<MHviewItem*> mhAccounts;
};
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
@@ -17,32 +17,49 @@ RecMail::RecMail(const RecMail&old)
init();
copy_old(old);
// odebug << "Copy constructor RecMail" << oendl;
}
RecMail::~RecMail()
{
wrapper = 0;
}
static bool stringCompareRec( const QString& s1, const QString& s2 )
{
if ( s1.isEmpty() && s2.isEmpty() )
return true;
return s1 == 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 )
{
if ( !stringCompareRec( isodate, r1->isodate ) ) {
//qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1());
return false;
}
if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) {
//qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1());
return false;
}
//qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1());
if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) {
if ( r1->from.find ( from ) < 0 ) {
if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) {
//qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1());
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
@@ -42,32 +42,33 @@ public:
const QString&getDate()const{ return date; }
void setDate( const QString&a ) { date = a; }
const QString&getIsoDate()const{ return isodate; }
void setIsoDate( const QString&a ) { isodate = a; }
const QString&getFrom()const{ return from; }
void setFrom( const QString&a ) { from = a; }
const QString&getSubject()const { return subject; }
void setSubject( const QString&s ) { subject = s; }
const QString&getMbox()const{return mbox;}
void setMbox(const QString&box){mbox = box;}
void setMsgid(const QString&id){msg_id=id;}
const QString&Msgid()const{return msg_id;}
void setReplyto(const QString&reply){replyto=reply;}
const QString&Replyto()const{return replyto;}
void setMsgsize(unsigned int size){msg_size = size;}
const unsigned int Msgsize()const{return msg_size;}
+ const QString MsgsizeString()const;
void setTo(const QStringList&list);
const QStringList&To()const;
void setCC(const QStringList&list);
const QStringList&CC()const;
void setBcc(const QStringList&list);
const QStringList&Bcc()const;
void setInreply(const QStringList&list);
const QStringList&Inreply()const;
void setReferences(const QStringList&list);
const QStringList&References()const;
const QBitArray&getFlags()const{return msg_flags;}
void setFlags(const QBitArray&flags){msg_flags = flags;}
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index ffb835c..137c482 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -9,64 +9,56 @@
MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
:QListViewItem(parent,item),mail_data()
{
}
void MailListViewItem::showEntry()
{
if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
setPixmap( 0, SmallIcon ( "kmmsgreplied") );
} else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
/* I think it looks nicer if there are not such a log of icons but only on mails
replied or new - Alwin*/
//setPixmap( 0,SmallIcon ("kmmsgunseen") );
} else {
setPixmap( 0,SmallIcon ( "kmmsgnew") );
}
- 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
// 11.23
// 111.23
// 999.23 maxlen
+ QString fsort;
switch(fsize.length() ) {
- case 4:
+ case 6:
fsort = "00" + fsize ;
break;
- case 5:
+ case 7:
fsort = "0" + fsize ;
break;
default:
fsort = fsize ;
break;
}
- 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 );
}
setText(1,mail_data->getSubject());
setText(2,mail_data->getFrom());
mKeyMap.insert(4,mail_data->getIsoDate());
setText(4,mail_data->getDate());
if ( KOPrefs::instance()->mShowToField )
setText(5,mail_data->To()[0]);
}
void MailListViewItem::storeData(const RecMailP&data)
{
mail_data = data;
}
void MailListViewItem::setSortKey(int column,const QString &key)
{
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 6e54bf4..760e3b0 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -8,32 +8,33 @@
#include "koprefsdialog.h"
#include <kapplication.h>
#include <libkdepim/externalapphandler.h>
#include <libkdepim/kpimglobalprefs.h>
#ifdef MINIKDE_KDIALOG_H
#undef MINIKDE_KDIALOG_H
#endif
#include "settingsdialog.h"
#include "opiemail.h"
#include "editaccounts.h"
#include "composemail.h"
#include "mailistviewitem.h"
#include "viewmail.h"
#include "selectstore.h"
#include "selectsmtp.h"
#include "accountitem.h"
+#include "accountview.h"
#include "klocale.h"
#include <qmessagebox.h>
#include <qtimer.h>
#include <qcursor.h>
#include <qtextbrowser.h>
#include <qregexp.h>
#include <qpe/global.h>
#ifdef DESKTOP_VERSION
#include <qapplication.h>
#else
#include <qpe/qpeapplication.h>
#endif
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/mailtypes.h>
@@ -300,33 +301,68 @@ void OpieMail::replyMail()
composer.setInReplyTo( mail->Msgid());
composer.setCharset( body->getCharset() );
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
mail->Wrapper()->answeredMail(mail);
}
delete settings;
}
void OpieMail::closeViewMail(ViewMail * vm)
{
vm->hide();
}
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!");
+ }
}
void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
{
QListViewItem*item = mailView->currentItem();
if (!item ) {
closeViewMail(vm);
return;
}
RecMailP mail = ((MailListViewItem*)item)->data();
mail->Wrapper()->deleteMail( mail );
item = item->itemBelow();
if (!item ) {
closeViewMail(vm);
return;
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 767a369..726f540 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -364,34 +364,37 @@ void ViewMail::readConfig()
}
void ViewMail::setText()
{
viewSource->setText(i18n("View Source"));
sourceOn = false;
QString toString;
QString ccString;
QString bccString;
toString = m_mail2[0].join(",");
ccString = m_mail2[1].join(",");
bccString = m_mail2[2].join(",");
-
- 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
m_mailHtml = "<html><body>"
"<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
"<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
"</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
"<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
"<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
"<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] +
"</td></tr></table><font>";
if ( !m_showHtml )
{
browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
}
else