MailList Class Reference

List of Mails. More...

#include <maillist.h>

List of all members.

Public Member Functions

 MailList (QPointer< Account > account, QObject *parent)
 ~MailList ()
MailaddMail (long number, const QString &unid, bool isNew)
void print () const
bool hasMail (QString uid)
bool isNew (QString uid) const
void setSize (long number, long size)
Types::MailNumberList_Type getNewMails ()
void setHeader (int number, QStringList header)
void setHeader (QString unid, QStringList header)
QStringList getUIDsOfOldMails ()
QStringList getHeaderOf (QString unid) throw ( CorruptDataException )
int getNumberMails () const
QPointer< AccountgetAccount () const
void applyHeaderFilter (HeaderFilter *filter, QString account, MailNumberList_Type &deleteList, MailToDownloadMap_Type &downloadList, int &nmbIgnoredMails, FilterLog *log=NULL)
void removeMail (int number)
void saveMails (QDomDocument &doc, QDomElement &parent)
QString getSenderOf (int number) const
QString getDateOf (int number) const
QString getSizeOf (int number) const
QString getSubjectOf (int number) const
QString getCharsetFromHeaderOf (int number) const
QStringList decodeMailBody (const QStringList &body, int number, bool preferHTML) const
void writeToMoveLog (FilterLog *log, int number, QString account, QString mailbox)
void writeToDeleteLog (FilterLog *log, int number, QString account)
void setMarkAtNextViewRefresh (int number)
int getNumberNewMails ()
long getTotalSize ()
void readStoredMails (QDomElement &parent)
QList< MailgetAllMails () const


Detailed Description

List of Mails.

Used in class Account.

See also:
Account

Definition at line 47 of file maillist.h.


Constructor & Destructor Documentation

MailList::MailList ( QPointer< Account account,
QObject *  parent 
)

Constructor

Parameters:
account pointer to the parent account
parent parent object
See also:
addMail

Definition at line 20 of file maillist.cpp.

MailList::~MailList (  ) 

Destructor

Definition at line 25 of file maillist.cpp.


Member Function Documentation

Mail * MailList::addMail ( long  number,
const QString &  unid,
bool  isNew 
)

Creates a mail object and adds it to the list

Parameters:
number number of the mail on the server
unid Unique ID of the mail
isNew TRUE - mail is new; FALSE - mail is not new
Returns:
appended mail

Definition at line 37 of file maillist.cpp.

void MailList::print (  )  const

Prints all data of this mail list to stdout

Definition at line 48 of file maillist.cpp.

bool MailList::hasMail ( QString  uid  ) 

Returns whether there is mail with the given uid in the list.

Parameters:
uid UID of the mail
Returns:
TRUE - mail is in the list

FALSE - mail is not in the list

Definition at line 59 of file maillist.cpp.

bool MailList::isNew ( QString  uid  )  const

Returns whether the given mail is new.

Parameters:
uid UID of the mail
Returns:
TRUE - mail is new

FALSE - mail is not new or mail doesn't exist

Definition at line 78 of file maillist.cpp.

void MailList::setSize ( long  number,
long  size 
)

Sets the size of a mail.

Parameters:
number number of the mail
size mail size

Definition at line 100 of file maillist.cpp.

Types::MailNumberList_Type MailList::getNewMails (  ) 

Returns the numbers of mails which are marked as new.

Returns:
numbers of the new mails

Definition at line 119 of file maillist.cpp.

void MailList::setHeader ( int  number,
QStringList  header 
)

Sets the header of the given mail.

Parameters:
number number of the mail
header the header

Definition at line 138 of file maillist.cpp.

void MailList::setHeader ( QString  unid,
QStringList  header 
)

Sets the header of the mail with the given UID.

Parameters:
unid UID
header mail header

Definition at line 198 of file maillist.cpp.

QStringList MailList::getUIDsOfOldMails (  ) 

Returns a list of the UIDs of all old mails.

Returns:
UIDs of all old mails

Definition at line 158 of file maillist.cpp.

QStringList MailList::getHeaderOf ( QString  unid  )  throw ( CorruptDataException )

Returns the header of the mail with the given UID.

Parameters:
unid UID
Returns:
mail header
Exceptions:
CorruptDataException 

Definition at line 177 of file maillist.cpp.

int MailList::getNumberMails (  )  const

Returns the number of mails.

Returns:
number of mails

Definition at line 216 of file maillist.cpp.

QPointer< Account > MailList::getAccount (  )  const

Returns a pointer to the account which this list holds.

Returns:
account

Definition at line 221 of file maillist.cpp.

void MailList::applyHeaderFilter ( HeaderFilter filter,
QString  account,
MailNumberList_Type &  deleteList,
MailToDownloadMap_Type &  downloadList,
int &  nmbIgnoredMails,
FilterLog log = NULL 
)

Apply the filters to the mails in this list.

Parameters:
filter pointer to the header filter
account name of this account
deleteList reference to a list in which this methode writes the numbers of mails to delete
downloadList reference to a list in which this methode writes the number of mails to download
nmbIgnoredMails reference to an integer in which it writes the number of ignored mails
log pointer to the filter log

Definition at line 226 of file maillist.cpp.

void MailList::removeMail ( int  number  ) 

Removes the mail which has the given number.

Parameters:
number number of the mail which will be removed

Definition at line 267 of file maillist.cpp.

void MailList::saveMails ( QDomDocument &  doc,
QDomElement &  parent 
)

Saves all stored mails into the given DOM document inside the given account element.

Parameters:
doc DOM document in that all options are stored
parent account element

Definition at line 282 of file maillist.cpp.

QString MailList::getSenderOf ( int  number  )  const

Returns the sender of the mail with the given number.

Parameters:
number mail number
Returns:
sender

Definition at line 294 of file maillist.cpp.

QString MailList::getDateOf ( int  number  )  const

Returns the date of sent of the mail with the given number.

Parameters:
number mail number
Returns:
date

Definition at line 315 of file maillist.cpp.

QString MailList::getSizeOf ( int  number  )  const

Returns the size of the mail with the given number.

Parameters:
number mail number
Returns:
size

Definition at line 337 of file maillist.cpp.

QString MailList::getSubjectOf ( int  number  )  const

Returns the subject of the mail with the given number.

Parameters:
number mail number
Returns:
subject

Definition at line 359 of file maillist.cpp.

QString MailList::getCharsetFromHeaderOf ( int  number  )  const

Returns the charset of the mail with the given number.

Parameters:
number mail number
Returns:
charset

Definition at line 381 of file maillist.cpp.

QStringList MailList::decodeMailBody ( const QStringList &  body,
int  number,
bool  preferHTML 
) const

Decodes the given mail body by the appropriate mail object. The mail object has to do this job, because it has stored the mail header and therefore it knows the content type and encoding of the mail. It decodes just the text or html part of the body. The rest of it will be rejected.

Parameters:
body the whole mail (including header)
number number of the downloaded mail
preferHTML decode HTML part if present
Returns:
decoded mail body

Definition at line 403 of file maillist.cpp.

void MailList::writeToMoveLog ( FilterLog log,
int  number,
QString  account,
QString  mailbox 
)

Writes the mail into the Move Log.

Parameters:
log pointer to the log
number number of the mail
account name of the account
mailbox name of the mailbox

Definition at line 425 of file maillist.cpp.

void MailList::writeToDeleteLog ( FilterLog log,
int  number,
QString  account 
)

Writes the mail into the Delete Log.

Parameters:
log pointer to the log
number number of the mail
account name of the account

Definition at line 463 of file maillist.cpp.

void MailList::setMarkAtNextViewRefresh ( int  number  ) 

The given mail will be marked at the next view refresh.

Parameters:
number number of the mail

Definition at line 444 of file maillist.cpp.

int MailList::getNumberNewMails (  ) 

Returns the number of new mails.

Returns:
number of new mails

Definition at line 482 of file maillist.cpp.

long MailList::getTotalSize (  ) 

Returns the total size (bytes) of all mails.

Returns:
total size

Definition at line 499 of file maillist.cpp.

void MailList::readStoredMails ( QDomElement &  parent  ) 

Reads out all mails stored inside the given account element, creates objects from class Mail and stores them in this list. All old items will be removed.

Parameters:
parent account element (DOM element)

Definition at line 515 of file maillist.cpp.

QList< Mail > MailList::getAllMails (  )  const

Returns a list which contains the pointers to all mails.

Returns:
all mails

Definition at line 548 of file maillist.cpp.


The documentation for this class was generated from the following files:

Generated on Tue May 18 19:43:53 2010 for KShowmail by  doxygen 1.5.6