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
KDateTime getDateTimeOf (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, bool &isHTML) const
void writeToMoveLog (FilterLog *log, int number, QString account, QString mailbox)
void writeToDeleteLog (FilterLog *log, int number, QString account, KindOfMailDeleting kindDelete)
void setMarkAtNextViewRefresh (int number)
int getNumberNewMails ()
long getTotalSize ()
void readStoredMails (QDomElement &parent)
QList< MailgetAllMails () const

Private Attributes

QList< Mail * > mails
QPointer< Accountacc

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
Parameters:
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
Parameters:
unid Unique ID of the mail
Parameters:
isNew TRUE - mail is new; FALSE - mail is not new
Returns:
appended mail

Definition at line 37 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
Parameters:
account name of this account
Parameters:
deleteList reference to a list in which this methode writes the numbers of mails to delete
Parameters:
downloadList reference to a list in which this methode writes the number of mails to download
Parameters:
nmbIgnoredMails reference to an integer in which it writes the number of ignored mails
Parameters:
log pointer to the filter log

Definition at line 226 of file maillist.cpp.

QStringList MailList::decodeMailBody ( const QStringList &  body,
int  number,
bool  preferHTML,
bool &  isHTML 
) 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)
Parameters:
number number of the downloaded mail
Parameters:
preferHTML decode HTML part if present
Parameters:
isHTML will be set on true, if the returned body is HTML formatted; otherwise false
Returns:
decoded mail body

Definition at line 425 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.

QList< Mail > MailList::getAllMails (  )  const

Returns a list which contains the pointers to all mails.

Returns:
all mails

Definition at line 570 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 403 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.

KDateTime MailList::getDateTimeOf ( int  number  )  const

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

Parameters:
number mail number
Returns:
date

Definition at line 337 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.

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.

int MailList::getNumberMails (  )  const

Returns the number of mails.

Returns:
number of mails

Definition at line 216 of file maillist.cpp.

int MailList::getNumberNewMails (  ) 

Returns the number of new mails.

Returns:
number of new mails

Definition at line 504 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::getSizeOf ( int  number  )  const

Returns the size of the mail with the given number.

Parameters:
number mail number
Returns:
size

Definition at line 359 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 381 of file maillist.cpp.

long MailList::getTotalSize (  ) 

Returns the total size (bytes) of all mails.

Returns:
total size

Definition at line 521 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.

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::print (  )  const

Prints all data of this mail list to stdout

Definition at line 48 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 537 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
Parameters:
parent account element

Definition at line 282 of file maillist.cpp.

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

Sets the header of the mail with the given UID.

Parameters:
unid UID
Parameters:
header mail header

Definition at line 198 of file maillist.cpp.

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

Sets the header of the given mail.

Parameters:
number number of the mail
Parameters:
header the header

Definition at line 138 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 466 of file maillist.cpp.

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

Sets the size of a mail.

Parameters:
number number of the mail
Parameters:
size mail size

Definition at line 100 of file maillist.cpp.

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

Writes the mail into the Delete Log.

Parameters:
log pointer to the log
Parameters:
number number of the mail
Parameters:
account name of the account
Parameters:
kindDelete kind of mail deleting (by filter or manual)

Definition at line 485 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
Parameters:
number number of the mail
Parameters:
account name of the account
Parameters:
mailbox name of the mailbox

Definition at line 447 of file maillist.cpp.


Member Data Documentation

QPointer<Account> MailList::acc [private]

Pointer to the parent account

Definition at line 291 of file maillist.h.

QList<Mail*> MailList::mails [private]

List of mails

Definition at line 286 of file maillist.h.


The documentation for this class was generated from the following files:
Generated on Sun Mar 13 15:27:10 2011 for KShowmail by  doxygen 1.6.3