author | zautrix <zautrix> | 2005-01-24 18:05:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-24 18:05:48 (UTC) |
commit | 77f93c632b66b5c8d92e4c63330362272ca1fc40 (patch) (side-by-side diff) | |
tree | 31f28656062c899b5368f13ab594ff6fa5c657fa | |
parent | 6c89efd80c1e94a0c070025d07c7a4c656f2a81e (diff) | |
download | kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.zip kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.gz kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.bz2 |
mail fixes
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-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 |
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 @@ -1,90 +1,92 @@ Info about the changes in new versions of KDE-Pim/Pi ********** VERSION 1.9.20 ************ 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. ********** VERSION 1.9.18 ************ FYI: The VERSION 1.9.17 was a testing release only. Please read the changelog of VERSION 1.9.17 as well. Cleaned up the syncing config dialog. Added sync config options for date range for events. Added sync config options for filters on incoming data. Added sync config options for filters on outgoing data. Please read the updated SyncHowTo about the new filter settings. These filter settings make it now possible to sync with shared calendars without writing back private or confidential data (via the outgoing filters). To sync only with particular parts of a shared calendar, the incoming filter settings can be used. An example can be found in the SyncHowTo. Same for shared addressbooks. Added a setting for the global kdepim data storage. Usually the data is stored in (yourhomedir/kdepim). Now you can set in the Global config dialog TAB, subTAB "Data storage path" a directory where all the kdepim data is stored. That makes it easy to save all kdepim data on a SD card on the Z, for example. KO/Pi: The timeedit input has a pulldown list for times. If opened, this pulldown list should now has the right time highlighted. Added the possibility to exclude events/todos/journals in a filter. You should exclude journals, if you do not want them to sync with a public calendar. KA/Pi: Added the possibility to in/exclude public/private/confidential contacts to a filter. If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... Added printing of card view and details view on desktop. Printing of list view is not working... Added button for removing pictures in contact editor. Parsing data fix of KA/Pi version 1.9.17. Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. Fixed some syncing merging problems. ********** VERSION 1.9.17 ************ KO/Pi: Fixed that tooltips were not updated after moving an item in agenda view. Fixed a bug in sorting start date for recurring events in list view. Changed the left button in todo viewer from "Agenda" to "Set completed". This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h index fcf33d1..79ed2e7 100644 --- a/kmicromail/accountview.h +++ b/kmicromail/accountview.h @@ -1,46 +1,46 @@ #ifndef ACCOUNTVIEW_H #define ACCOUNTVIEW_H #include <qlistview.h> #include <qlist.h> #include <opie2/osmartpointer.h> #include <libmailwrapper/mailtypes.h> class Selectstore; class Folder; 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; }; #endif 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 @@ -1,96 +1,113 @@ #include "mailtypes.h" //#include <opie2/odebug.h> #include <stdlib.h> using namespace Opie::Core; RecMail::RecMail() :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) { init(); } RecMail::RecMail(const RecMail&old) :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) { 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()); return false; } } } return true; } void RecMail::copy_old(const RecMail&old) { subject = old.subject; date = old.date; mbox = old.mbox; msg_id = old.msg_id; msg_size = old.msg_size; msg_number = old.msg_number; from = old.from; msg_flags = old.msg_flags; to = old.to; cc = old.cc; bcc = old.bcc; wrapper = old.wrapper; in_reply_to = old.in_reply_to; references = old.references; replyto = old.replyto; } void RecMail::init() { to.clear(); cc.clear(); bcc.clear(); in_reply_to.clear(); references.clear(); wrapper = 0; } void RecMail::setWrapper(AbstractMail*awrapper) { wrapper = awrapper; } AbstractMail* RecMail::Wrapper() { return wrapper; } void RecMail::setTo(const QStringList&list) { 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 @@ -1,121 +1,122 @@ #ifndef __MAIL_TYPES_H #define __MAIL_TYPES_H #define FLAG_ANSWERED 0 #define FLAG_FLAGGED 1 #define FLAG_DELETED 2 #define FLAG_SEEN 3 #define FLAG_DRAFT 4 #define FLAG_RECENT 5 #include <opie2/osmartpointer.h> #include <qbitarray.h> #include <qstring.h> #include <qstringlist.h> #include <qmap.h> #include <qvaluelist.h> class AbstractMail; /* a class to describe mails in a mailbox */ /* Attention! From programmers point of view it would make sense to store the mail body into this class, too. But: not from the point of view of the device. Mailbodies can be real large. So we request them when needed from the mail-wrapper class direct from the server itself (imap) or from a file-based cache (pop3?) So there is no interface "const QString&body()" but you should make a request to the mailwrapper with this class as parameter to get the body. Same words for the attachments. */ class RecMail:public Opie::Core::ORefCount { public: RecMail(); RecMail(const RecMail&old); virtual ~RecMail(); bool isEqual( RecMail* r1 ); const unsigned int getNumber()const{return msg_number;} void setNumber(unsigned int number){msg_number=number;} 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;} void setWrapper(AbstractMail*wrapper); AbstractMail* Wrapper(); // public for debugging QString subject,date,isodate,from,mbox,msg_id,replyto; protected: //QString subject,date,isodate,from,mbox,msg_id,replyto; unsigned int msg_number,msg_size; QBitArray msg_flags; QStringList to,cc,bcc,in_reply_to,references; AbstractMail*wrapper; void init(); void copy_old(const RecMail&old); }; typedef Opie::Core::OSmartPointer<RecMail> RecMailP; typedef QMap<QString,QString> part_plist_t; class RecPart:public Opie::Core::ORefCount { protected: QString m_type,m_subtype,m_identifier,m_encoding,m_description; unsigned int m_lines,m_size; part_plist_t m_Parameters; /* describes the position in the mail */ QValueList<int> m_poslist; public: RecPart(); RecPart(const RecPart&); virtual ~RecPart(); const QString&Type()const; void setType(const QString&type); const QString&Subtype()const; void setSubtype(const QString&subtype); const QString&Identifier()const; void setIdentifier(const QString&identifier); const QString&Encoding()const; void setEncoding(const QString&encoding); const QString&Description()const; void setDescription(const QString&desc); void setLines(unsigned int lines); const unsigned int Lines()const; void setSize(unsigned int size); const unsigned int Size()const; diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index ffb835c..137c482 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp @@ -1,103 +1,95 @@ // CHANGED 2004-08-06 Lutz Rogowski #include "mailistviewitem.h" #include <libmailwrapper/abstractmail.h> #include <qtextstream.h> #include <kiconloader.h> #include "koprefs.h" //#include <qpe/resource.h> 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) { 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 { return mail_data; } MAILLIB::ATYPE MailListViewItem::wrapperType() { if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; return mail_data->Wrapper()->getType(); } diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 6e54bf4..760e3b0 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -1,87 +1,88 @@ // CHANGED 2004-09-31 Lutz Rogowski // CHANGED 2004-08-06 Lutz Rogowski #define protected public #include <qwidget.h> #undef protected #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> #include <libmailwrapper/abstractmail.h> #include "koprefs.h" //using namespace Opie::Core; OpieMail::OpieMail( QWidget *parent, const char *name ) : MainWindow( parent, name) //, WStyle_ContextHelp ) { settings = new Settings(); tb = 0; setIcon(SmallIcon( "kmicromail" ) ); folderView->populate( settings->getAccounts() ); } OpieMail::~OpieMail() { if (settings) delete settings; if ( tb ) delete tb; } void OpieMail::appMessage(const QCString &msg, const QByteArray &data) { } #include <stdlib.h> void OpieMail::message(const QCString &msg, const QByteArray &data) { // copied from old mail2 static int ii = 0; //qDebug("QCOP CALL ############################# %d ", ii); //QString mess ( msg ); //qDebug("Message = %s ",mess.latin1()); ++ii; //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); mPendingEmail = QString::null; mPendingName = QString::null; if (msg == "writeMail(QString,QString)") { //qDebug("writeMail(QString,QString) "); QDataStream stream(data,IO_ReadOnly); stream >> mPendingName >> mPendingEmail; // removing the whitespaces at beginning and end is needed! QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); } else if (msg == "newMail()") @@ -252,129 +253,164 @@ void OpieMail::slotEditSettings() void OpieMail::slotEditAccounts() { EditAccounts eaDialog( settings, this, 0, true ); eaDialog.slotAdjustColumns(); #ifndef DESKTOP_VERSION eaDialog.showMaximized(); #endif eaDialog.exec(); if ( settings ) delete settings; settings = new Settings(); folderView->populate( settings->getAccounts() ); } void OpieMail::replyMail() { QListViewItem*item = mailView->currentItem(); if (!item) return; RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); QString rtext; rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose .arg( mail->getFrom()) .arg( mail->getDate()); QString text = body->Bodytext(); QStringList lines = QStringList::split(QRegExp("\\n"), text); QStringList::Iterator it; for (it = lines.begin(); it != lines.end(); it++) { rtext += "> " + *it + "\n"; } rtext += "\n"; QString prefix; if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; else prefix = "Re: "; // no i18n on purpose Settings *settings = new Settings(); ComposeMail composer( settings ,this, 0, true); if (mail->Replyto().isEmpty()) { composer.setTo( mail->getFrom()); } else { composer.setTo( mail->Replyto()); } composer.setSubject( prefix + mail->getSubject()); composer.setMessage( rtext ); 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; } mailView->setCurrentItem(item); mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); vm->setBody( body ); vm->setMail( mail ); } void OpieMail::displayNextMail(ViewMail * vm) { QListViewItem*item = mailView->currentItem(); if (!item) return; ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); item = item->itemBelow(); if (!item) { vm->setCaption(i18n("End of List" )); return; } mailView->setCurrentItem(item); RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); vm->setBody( body ); vm->setMail( mail ); } void OpieMail::displayMail() { QListViewItem*item = mailView->currentItem(); if (!item) return; RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); ViewMail readMail( this,"", Qt::WType_Modal ); readMail.setBody( body ); readMail.setMail( mail ); #ifndef DESKTOP_VERSION readMail.showMaximized(); #else readMail.resize( 640, 480); #endif connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); readMail.exec(); if ( readMail.deleted ) { folderView->refreshCurrent(); } else diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 767a369..726f540 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp @@ -316,130 +316,133 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int void ViewMail::setMail(const RecMailP&mail ) { m_recMail = mail; m_mail[0] = mail->getFrom(); m_mail[1] = mail->getSubject(); m_mail[3] = mail->getDate(); m_mail[4] = mail->Msgid(); m_mail2[0] = mail->To(); m_mail2[1] = mail->CC(); m_mail2[2] = mail->Bcc(); setText(); } ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; deleted = false; sourceOn = false; connect( reply, SIGNAL(activated()), SLOT(slotReply())); connect( forward, SIGNAL(activated()), SLOT(slotForward())); connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); attachments->setEnabled(m_gotBody); connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); readConfig(); attachments->setSorting(-1); } void ViewMail::readConfig() { setFont ( KOPrefs::instance()->mReadFont ); m_showHtml = KOPrefs::instance()->mViewAsHtml; showHtml->setOn( m_showHtml ); } 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 { browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); } // remove later in favor of a real handling m_gotBody = true; } ViewMail::~ViewMail() { m_recMail->Wrapper()->cleanMimeCache(); hide(); } void ViewMail::hide() { QWidget::hide(); if (_inLoop) { _inLoop = false; qApp->exit_loop(); } } void ViewMail::exec() { show(); if (!_inLoop) { _inLoop = true; qApp->enter_loop(); } } QString ViewMail::deHtml(const QString &string) { QString string_ = string; string_.replace(QRegExp("&"), "&"); string_.replace(QRegExp("<"), "<"); string_.replace(QRegExp(">"), ">"); string_.replace(QRegExp("\\n"), "<br>"); return string_; } |