-rw-r--r-- | kmicromail/accountitem.cpp | 22 | ||||
-rw-r--r-- | kmicromail/accountview.cpp | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 67 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.h | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 64 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 18 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 23 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mboxwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/nntpwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.h | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 7 |
17 files changed, 207 insertions, 21 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 1698b40..7b9b881 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp @@ -87,21 +87,22 @@ QPopupMenu * POP3viewItem::getContextMenu() { QPopupMenu *m = new QPopupMenu(0); if (m) { if (!account->getOffline()) { m->insertItem(QObject::tr("Disconnect",contextName),0); m->insertItem(QObject::tr("Set offline",contextName),1); - m->insertItem(QObject::tr("Download messages",contextName),2); + m->insertItem(QObject::tr("Download new INBOX messages",contextName),2); } else { m->insertItem(QObject::tr("Set online",contextName),1); + m->insertItem(QObject::tr("Download new INBOX messages",contextName),2); } } return m; } void POP3viewItem::disconnect() { QListViewItem *child = firstChild(); @@ -132,16 +133,18 @@ void POP3viewItem::contextMenuSelected(int which) { case 0: disconnect(); break; case 1: setOnOffline(); break; case 2: // daunlood + if (account->getOffline()) + setOnOffline(); AccountView*bl = accountView(); if (!bl) return; AccountViewItem* in = findSubItem( "inbox" , 0); if ( ! in ) return; bl->downloadMailsInbox(in->getFolder() ,getWrapper()); setOnOffline(); break; @@ -508,20 +511,24 @@ QPopupMenu * IMAPviewItem::getContextMenu() { if (!account->getOffline()) { m->insertItem(QObject::tr("Refresh folder list",contextName),0); m->insertItem(QObject::tr("Create new folder",contextName),1); m->insertSeparator(); m->insertItem(QObject::tr("Disconnect",contextName),2); m->insertItem(QObject::tr("Set offline",contextName),3); + m->insertSeparator(); + m->insertItem(QObject::tr("Download new INBOX messages",contextName),4); } else { m->insertItem(QObject::tr("Set online",contextName),3); + m->insertSeparator(); + m->insertItem(QObject::tr("Download new INBOX messages",contextName),4); } } return m; } void IMAPviewItem::createNewFolder() { Newmdirdlg ndirdlg; @@ -565,16 +572,29 @@ void IMAPviewItem::contextMenuSelected(int id) removeChilds(); wrapper->logout(); } account->setOffline(!account->getOffline()); account->save(); SETPIX(PIXMAP_IMAPFOLDER); refreshFolders(false); break; + case 4: // daunlood + { + if (account->getOffline()) { + contextMenuSelected( 3 ); + } + AccountView*bl = accountView(); + if (!bl) return; + AccountViewItem* in = findSubItem( "inbox" , 0); + if ( ! in ) + return; + bl->downloadMailsInbox(in->getFolder(),getWrapper()); + } + break; default: break; } } RECBODYP IMAPviewItem::fetchBody(const RecMailP&) { return new RecBody(); diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 85523b1..de8c5bb 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp @@ -136,16 +136,17 @@ void AccountView::setupFolderselect(Selectstore*sels) if (imapAccounts[i]->offline()) continue; imapAccounts[i]->refreshFolders(false); sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); } } void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) { +#if 0 AbstractMail*targetMail = 0; QString targetFolder = ""; Selectstore sels; setupFolderselect(&sels); if (!sels.exec()) return; targetMail = sels.currentMail(); targetFolder = sels.currentFolder(); if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || @@ -157,19 +158,21 @@ void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromW { QMessageBox::critical(0,tr("Error creating new Folder"), tr("<center>Error while creating<br>new folder - breaking.</center>")); return; } int maxsize = 0; if ( sels.useSize->isChecked()) maxsize = sels.sizeSpinBox->value(); - fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); +#endif + fromWrapper->downloadNewMails( fromFolder, mhAccounts[0]->getWrapper()); refreshCurrent(); + } void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) { AbstractMail*targetMail = 0; QString targetFolder = ""; Selectstore sels; setupFolderselect(&sels); diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index f876235..374d606 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp @@ -5,16 +5,17 @@ #include "nntpwrapper.h" #include "mhwrapper.h" #include "mailtypes.h" #include <qpe/global.h> #include <qprogressbar.h> #include <qapplication.h> +#include <qmessagebox.h> #include <kdecore/kstandarddirs.h> #include <qfile.h> #include <qtextstream.h> #include <stdlib.h> #include <libetpan/mailmime_content.h> #include <libetpan/mailmime.h> @@ -153,16 +154,82 @@ void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); wid.raise(); qApp->processEvents(); RecMailP mail = (*target.at( iii )); deleteMail(mail); ++iii; } } + +void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) +{ + qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); + // get local folder + Account * acc = getAccount(); + if ( !acc ) return; + QString lfName = acc->getLocalFolder(); + if ( lfName.isEmpty() ) + lfName = acc->getAccountName(); + // create local folder + if ( !targetMail->createMbox(lfName)) + { + QMessageBox::critical(0,tr("Error creating new Folder"), + tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); + return; + } + QValueList<RecMailP> t; + listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); + if ( t.count() == 0 ) { + Global::statusMessage(tr("There are no new messages")); + return; + } + QValueList<RecMailP> e; + targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); + qDebug("target has mails %d ", e.count()); + QValueList<RecMailP> n; + int iii = 0; + int count = t.count(); + while (iii < count ) { + RecMailP r = (*t.at( iii )); + bool found = false; + int jjj = 0; + int countE = e.count(); + while (jjj < countE ) { + RecMailP re = (*e.at( jjj )); + if ( re->isEqual(r) ) { + found = true; + break; + } + ++jjj; + } + if ( found ) + qDebug("found "); + else + qDebug("NOT found "); + + if ( !found ) { + n.append( r ); + } + ++iii; + } + if ( n.count() == 0 ) { + Global::statusMessage(tr("There are no new messages")); + return; + } + mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); + + +#if 0 + QValueList<RecMailP> t; + listMessages(fromFolder->getName(),t, maxSizeInKb); + mvcpMailList( t,targetFolder,targetWrapper,moveit); +#endif + +} void AbstractMail::mvcpAllMails(const FolderP&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) { QValueList<RecMailP> t; listMessages(fromFolder->getName(),t, maxSizeInKb); mvcpMailList( t,targetFolder,targetWrapper,moveit); } diff --git a/kmicromail/libmailwrapper/abstractmail.h b/kmicromail/libmailwrapper/abstractmail.h index cae83f4..2069ca1 100644 --- a/kmicromail/libmailwrapper/abstractmail.h +++ b/kmicromail/libmailwrapper/abstractmail.h @@ -5,16 +5,19 @@ #include "maildefines.h" #include "settings.h" #include <qobject.h> #include <opie2/osmartpointer.h> #include "mailtypes.h" + +#include "mailwrapper.h" + class IMAPwrapper; class POP3wrapper; class Folder; class encodedString; struct folderStat; class AbstractMail:public QObject { @@ -33,33 +36,35 @@ public: virtual void deleteMail(const RecMailP&mail)=0; virtual void deleteMailList(const QValueList<RecMailP>&target); virtual void answeredMail(const RecMailP&mail)=0; virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0; virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target); virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0; virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; - + void downloadNewMails(const FolderP&fromFolder,AbstractMail*targetWrapper ); virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0); virtual void mvcpMailList(const QValueList<RecMailP>& t, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void cleanMimeCache(){}; /* mail box methods */ /* parameter is the box to create. * if the implementing subclass has prefixes, * them has to be appended automatic. */ virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0, const QString& delemiter="/",bool getsubfolder=false); virtual void logout()=0; + virtual Account* getAccount() = 0; + static AbstractMail* getWrapper(IMAPaccount *a); static AbstractMail* getWrapper(POP3account *a); static AbstractMail* getWrapper(NNTPaccount *a); /* mbox only! */ static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); static AbstractMail* getWrapper(Account*a); static QString defaultLocalfolder(); diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index 9614d53..2b04847 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -1,13 +1,16 @@ // CHANGED 2004-09-31 Lutz Rogowski #include "genericwrapper.h" #include <libetpan/libetpan.h> #include "mailtypes.h" +#include <kconfig.h> +#include <kglobal.h> +#include <kstandarddirs.h> using namespace Opie::Core; Genericwrapper::Genericwrapper() : AbstractMail() { bodyCache.clear(); m_storage = 0; @@ -19,16 +22,58 @@ Genericwrapper::~Genericwrapper() if (m_folder) { mailfolder_free(m_folder); } if (m_storage) { mailstorage_free(m_storage); } cleanMimeCache(); } +QString Genericwrapper::parseDateTime( mailimf_date_time *date ) +{ + static bool init = false ; + if ( ! init ) { + KConfig kon ( locateLocal( "config", "korganizerrc" ) ); + kon.setGroup("Locale"); + KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); + QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); + KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); + KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); + kon.setGroup("Time & Date"); + KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), + kon.readNumEntry( "DaylightsavingStart", 90), + kon.readNumEntry( "DaylightsavingEnd",304) ); + KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); + + init = true; + + } + QDateTime dt (QDate(date->dt_year,date->dt_month, date->dt_day ),QTime(date->dt_hour, date->dt_min, date->dt_sec ) ); + int off = KGlobal::locale()->localTimeOffset( dt ); + dt = dt.addSecs( off*60 ); + QString ret = KGlobal::locale()->formatDateTime( dt,true,true); + if ( off < 0 ) + ret += " -"; + else + ret += " +"; + ret += QString::number( off / 60 ); + ret += "h"; +#if 0 + char tmp[23]; + + // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", + // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); + snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", + date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); + + + return QString( tmp ); +#endif + return ret; +} void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) { if (!mime) { return; } mailmime_field*field = 0; mailmime_single_fields fields; @@ -237,27 +282,16 @@ RecBodyP Genericwrapper::parseMail( mailmessage * msg ) RecBodyP body = new RecBody(); memset(&fields, 0, sizeof(struct mailmime_single_fields)); err = mailmessage_get_bodystructure(msg,&mime); QValueList<int>recList; traverseBody(body,msg,mime,recList); return body; } -QString Genericwrapper::parseDateTime( mailimf_date_time *date ) -{ - char tmp[23]; - - // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", - // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); - snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", - date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); - - return QString( tmp ); -} QString Genericwrapper::parseAddressList( mailimf_address_list *list ) { QString result( "" ); bool first = true; if (list == 0) return result; for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { @@ -443,18 +477,24 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); } else { mail->setTo(mailbox); } if (single_fields.fld_cc) mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); if (single_fields.fld_bcc) mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); - if (single_fields.fld_orig_date) + if (single_fields.fld_orig_date) { mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); + char tmp[23]; + struct mailimf_date_time* date = single_fields.fld_orig_date->dt_date_time; + snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", + date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); + mail->setIsoDate( QString( tmp ) ); + } // crashes when accessing pop3 account? if (single_fields.fld_message_id) { mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); ; // odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; } if (single_fields.fld_reply_to) { QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); if (t.count()>0) { diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h index 235e116..244212f 100644 --- a/kmicromail/libmailwrapper/genericwrapper.h +++ b/kmicromail/libmailwrapper/genericwrapper.h @@ -37,24 +37,24 @@ public: virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part); virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part); virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part); virtual void cleanMimeCache(); virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;} virtual void logout(){}; virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; + static QString parseDateTime( mailimf_date_time *date ); protected: RecBodyP parseMail( mailmessage * msg ); QString parseMailboxList( mailimf_mailbox_list *list ); QString parseMailbox( mailimf_mailbox *box ); QString parseGroup( mailimf_group *group ); QString parseAddressList( mailimf_address_list *list ); - QString parseDateTime( mailimf_date_time *date ); void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime); static void fillParameters(RecPartP&target,clist*parameters); static QString getencoding(mailmime_mechanism*aEnc); virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0); QStringList parseInreplies(mailimf_in_reply_to * in_replies); diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 6faa524..5441a9b 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -2,16 +2,17 @@ #include <stdlib.h> #include <libetpan/libetpan.h> #include <qpe/global.h> #include <qapplication.h> #include "imapwrapper.h" #include "mailtypes.h" #include "logindialog.h" #include <qprogressbar.h> +#include "genericwrapper.h" using namespace Opie::Core; int IMAPwrapper::mMax = 0; int IMAPwrapper::mCurrent = 0; IMAPwrapper::IMAPwrapper( IMAPaccount *a ) : AbstractMail() { @@ -451,18 +452,33 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) continue; } if ( item->att_data.att_static == NULL ) continue; if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { mailimap_envelope * head = item->att_data.att_static->att_data.att_env; if ( head == NULL ) continue; - if ( head->env_date != NULL ) + if ( head->env_date != NULL ) { m->setDate(head->env_date); + struct mailimf_date_time result; + struct mailimf_date_time* date = &result; + struct mailimf_date_time **re = &date; + size_t length = m->getDate().length(); + size_t index = 0; + if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { + m->setDate( Genericwrapper::parseDateTime( date ) ); + char tmp[23]; + snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", + date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); + m->setIsoDate( QString( tmp ) ); + } else { + m->setIsoDate(head->env_date); + } + } if ( head->env_subject != NULL ) m->setSubject(convert_String((const char*)head->env_subject)); //m->setSubject(head->env_subject); if (head->env_from!=NULL) { addresslist = address_list_to_stringlist(head->env_from->frm_list); if (addresslist.count()) { m->setFrom(addresslist.first()); } diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h index db8ab5b..5535d8d 100644 --- a/kmicromail/libmailwrapper/imapwrapper.h +++ b/kmicromail/libmailwrapper/imapwrapper.h @@ -47,16 +47,17 @@ public: const QString& delemiter="/",bool getsubfolder=false); virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder); static void imap_progress( size_t current, size_t maximum ); virtual void logout(); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; + virtual Account* getAccount() { return account; }; protected: RecMail*parse_list_result(mailimap_msg_att*); void login(); bool start_tls(bool force=true); virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc=""); virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call); diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index d43bdc6..1a4ffd1 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp @@ -18,17 +18,40 @@ RecMail::RecMail(const RecMail&old) 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; +} + +bool RecMail::isEqual( RecMail* r1 ) +{ + if ( !stringCompareRec( isodate, r1->isodate ) ) { + // qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); + return false; + } + if ( !stringCompareRec( from, r1->from ) ) { + //qDebug("from *%s* *%s* ", from.latin1(), r1->from.latin1()); + return false; + } + if ( !stringCompareRec( subject, r1->subject ) ) { + //qDebug("sub "); + 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; diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h index c317880..020278d 100644 --- a/kmicromail/libmailwrapper/mailtypes.h +++ b/kmicromail/libmailwrapper/mailtypes.h @@ -30,21 +30,24 @@ class AbstractMail; 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;} @@ -67,17 +70,17 @@ public: const QBitArray&getFlags()const{return msg_flags;} void setFlags(const QBitArray&flags){msg_flags = flags;} void setWrapper(AbstractMail*wrapper); AbstractMail* Wrapper(); protected: - QString subject,date,from,mbox,msg_id,replyto; + 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); }; diff --git a/kmicromail/libmailwrapper/mboxwrapper.h b/kmicromail/libmailwrapper/mboxwrapper.h index 9731b85..d03940f 100644 --- a/kmicromail/libmailwrapper/mboxwrapper.h +++ b/kmicromail/libmailwrapper/mboxwrapper.h @@ -31,16 +31,17 @@ public: virtual RecBodyP fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target); virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; + virtual Account* getAccount() { return 0; }; protected: static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target); QString MBOXPath; QString MBOXName; }; #endif diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index cbc52d9..962dac0 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp @@ -60,16 +60,17 @@ void MHwrapper::clean_storage() MHwrapper::~MHwrapper() { clean_storage(); } void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) { + qDebug("MHwrapper::listMessages "); init_storage(); if (!m_storage) { return; } QString f = buildPath(mailbox); int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); if (r!=MAIL_NO_ERROR) { qDebug("listMessages: error selecting folder! "); diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h index 550824d..d1b7d1f 100644 --- a/kmicromail/libmailwrapper/mhwrapper.h +++ b/kmicromail/libmailwrapper/mhwrapper.h @@ -37,16 +37,17 @@ public: virtual RecBodyP fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target); virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; + virtual Account* getAccount() { return 0; }; public slots: /* for deleting maildirs we are using a system call */ virtual void oprocessStderr(Opie::Core::OProcess*, char *buffer, int ); virtual void processEnded(Opie::Core::OProcess *); protected: QString buildPath(const QString&p); QString MHPath; diff --git a/kmicromail/libmailwrapper/nntpwrapper.h b/kmicromail/libmailwrapper/nntpwrapper.h index 5d4e5ce..8c54f12 100644 --- a/kmicromail/libmailwrapper/nntpwrapper.h +++ b/kmicromail/libmailwrapper/nntpwrapper.h @@ -32,16 +32,17 @@ public: virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual RecBodyP fetchBody( const RecMailP &mail ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void logout(); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; static void nntp_progress( size_t current, size_t maximum ); + virtual Account* getAccount() { return account; }; protected: void login(); NNTPaccount *account; mailstorage* m_nntp; }; diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h index 7c70942..ebc2fc7 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.h +++ b/kmicromail/libmailwrapper/pop3wrapper.h @@ -29,16 +29,16 @@ public: virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual RecBodyP fetchBody( const RecMailP &mail ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void logout(); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; static void pop3_progress( size_t current, size_t maximum ); - + virtual Account* getAccount() { return account; }; protected: void login(); POP3account *account; mailstorage*m_pop3; }; #endif diff --git a/kmicromail/libmailwrapper/smtpwrapper.h b/kmicromail/libmailwrapper/smtpwrapper.h index 105cbf5..ec42b56 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.h +++ b/kmicromail/libmailwrapper/smtpwrapper.h @@ -22,16 +22,17 @@ class SMTPwrapper : public Generatemail public: SMTPwrapper(SMTPaccount * aSmtp); virtual ~SMTPwrapper(); bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); bool flushOutbox(); static progressMailSend*sendProgress; + virtual Account* getAccount() { return m_SmtpAccount; }; signals: void queuedMails( int ); protected: mailsmtp *m_smtp; SMTPaccount * m_SmtpAccount; diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index b92b0cf..484a635 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp @@ -48,21 +48,21 @@ void MailListViewItem::showEntry() } 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 ); + mKeyMap.insert(3, "M" +fsort ); } setText(1,mail_data->getSubject()); setText(2,mail_data->getFrom()); - +#if 0 QString date = mail_data->getDate(); int kom = date.find( ",")+2; if ( kom == 1 ) kom = 0; if ( date.mid(kom,1) == " ") ++kom; if ( date.mid(kom+1,1) == " " ) @@ -93,19 +93,22 @@ void MailListViewItem::showEntry() else if ( mon == "Oct" ) so = "10"; else if ( mon == "Nov" ) so = "11"; else if ( mon == "Dec" ) so = "12"; date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); } + //qDebug("insert Date %s ", date.latin1()); // if ( date.left(1) != "1" || date.left(1) != "2" ) // date = date.mid(5); mKeyMap.insert(4,date); +#endif + mKeyMap.insert(4,mail_data->getIsoDate()); setText(4,mail_data->getDate()); } void MailListViewItem::storeData(const RecMailP&data) { mail_data = data; } void MailListViewItem::setSortKey(int column,const QString &key) |