00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MAILLIST_H
00019 #define MAILLIST_H
00020
00021 class MailList;
00022
00023
00024 #include <QtCore/QObject>
00025 #include <QDomElement>
00026 #include <QPointer>
00027
00028
00029 #include <klocale.h>
00030
00031
00032 #include "mail.h"
00033 #include "types.h"
00034 #include "corruptdataexception.h"
00035 #include "account.h"
00036 #include "headerfilter.h"
00037 #include "filterlog.h"
00038
00039 using namespace Types;
00040
00047 class MailList : public QObject
00048 {
00049 Q_OBJECT
00050
00051 public:
00052
00059 MailList( QPointer<Account> account, QObject* parent );
00060
00064 ~MailList();
00065
00073 Mail* addMail( long number, const QString& unid, bool isNew );
00074
00078 void print() const;
00079
00086 bool hasMail( QString uid );
00087
00094 bool isNew( QString uid ) const;
00095
00101 void setSize( long number, long size );
00102
00107 Types::MailNumberList_Type getNewMails();
00108
00114 void setHeader( int number, QStringList header );
00115
00121 void setHeader( QString unid, QStringList header );
00122
00127 QStringList getUIDsOfOldMails();
00128
00135 QStringList getHeaderOf( QString unid ) throw( CorruptDataException );
00136
00141 int getNumberMails() const;
00142
00147 QPointer<Account> getAccount() const;
00148
00158 void applyHeaderFilter( HeaderFilter* filter, QString account, MailNumberList_Type& deleteList, MailToDownloadMap_Type& downloadList, int& nmbIgnoredMails, FilterLog* log = NULL );
00159
00164 void removeMail( int number );
00165
00172 void saveMails( QDomDocument& doc, QDomElement& parent );
00173
00179 QString getSenderOf( int number ) const;
00180
00186 QString getDateOf( int number ) const;
00187
00193 QString getSizeOf( int number ) const;
00194
00200 QString getSubjectOf( int number ) const;
00201
00207 QString getCharsetFromHeaderOf( int number ) const;
00208
00221 QStringList decodeMailBody( const QStringList& body, int number, bool preferHTML ) const;
00222
00230 void writeToMoveLog( FilterLog* log, int number, QString account, QString mailbox );
00231
00238 void writeToDeleteLog( FilterLog* log, int number, QString account );
00239
00244 void setMarkAtNextViewRefresh( int number );
00245
00250 int getNumberNewMails();
00251
00256 long getTotalSize();
00257
00264 void readStoredMails( QDomElement& parent );
00265
00270 QList<Mail> getAllMails() const;
00271
00272 private:
00273
00277 QList<Mail*> mails;
00278
00282 QPointer<Account> acc;
00283
00284
00285 };
00286
00287 #endif // MAILLIST_H