ShowRecordElem Class Reference

Represents a mail. More...

#include <showrecordelem.h>

List of all members.

Public Member Functions

 ShowRecordElem ()
 ShowRecordElem (int number, QString &uid, bool isNew)
void setHeader (const QString &header)
QString header () const
QString from () const
QString to () const
QString subject () const
QString content () const
QString date () const
QString strUnixTime () const
QDateTime sentDateTime () const
void setUIDL (const QString &uid)
QString uidl () const
void setSize (int size)
int size () const
QString strSize () const
QString strSizePrefix () const
void setNew (bool isnew)
bool isNew () const
QString state () const
void setNumber (int n)
int number () const
void setViewItem (ShowListViewItem *item)
ShowListViewItemviewItem () const
FilterAction_Type applyHeaderFilter (HeaderFilter *filter, QString account, QString &mailbox, FilterLog *log=NULL)
void readOptions (QDomElement &elem)
void saveOptions (QDomDocument &doc, QDomElement &parent)
bool isSelected () const
QString decodeMailBody (QByteArray body, bool preferHTML) const
int showHeader (QString &account)
void writeToMoveLog (FilterLog *log, QString account, QString mailbox)
void writeToDeleteLog (FilterLog *log, QString account)
void setMarkAtNextViewRefresh ()

Static Public Attributes

static const int continueShowHeaders
static const int cancelShowHeaders

Private Member Functions

QCString scanHeader (const QString &item) const
void setFrom (const QCString &from)
void setTo (const QCString &to)
void setSubject (const QCString &subject)
void setDate (const QCString &date)
void setContent (const QCString &content)
void setFilter (FilterElem *filter)
QString getBoundary () const
QString getCharset () const
QString getTransferEncoding () const

Private Attributes

QCString m_header
QCString m_from
QCString m_to
QCString m_subject
QDateTime m_unixDate
QCString m_content
QString m_uid
int m_size
bool m_new
int m_nNumber
bool markAtViewRefresh
ShowListViewItemm_pItem
FilterElem * m_pFilter


Detailed Description

Represents a mail.

It contains UID, Subject, From, To and date of the mail. Subject, From and To will be read out from the given header. It also contains pointer to the corresponding list view entry and maybe to a matching filter. All mail objects are held by ShowRecord.

See also:
ShowRecord

ConfigElem

Author:
Eggert Ehmke


Constructor & Destructor Documentation

ShowRecordElem::ShowRecordElem (  ) 

Constructor

ShowRecordElem::ShowRecordElem ( int  number,
QString &  uid,
bool  isNew 
)

Constructor

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


Member Function Documentation

void ShowRecordElem::setHeader ( const QString &  header  ) 

Sets the mail header and extracts From, To, Subject, Date and Content Type. All parts of the header are coded according RFC 2047.

Parameters:
header the mail header

QString ShowRecordElem::header (  )  const

Returns the whole header.

Returns:
the mail header

QString ShowRecordElem::from (  )  const

Returns the sender address.

Returns:
sender address

QString ShowRecordElem::to (  )  const

Returns the addressee.

Returns:
the addressee

QString ShowRecordElem::subject (  )  const

Returns the subject.

Returns:
mail subject

QString ShowRecordElem::content (  )  const

Returns the stored content type.

Returns:
content type

QString ShowRecordElem::date (  )  const

Returns the date on which the mail was sent, formated to the current locale's conventions.

Returns:
the date

QString ShowRecordElem::strUnixTime (  )  const

Returns the date on which the mail was sent. The format corresponds to the ISO 8601 extended specification for representations of dates and times, which is YYYY-MM-DDTHH:MM:SS

Returns:
the date

QDateTime ShowRecordElem::sentDateTime (  )  const

Returns the date and time on which the mail was sent.

Returns:
the date

void ShowRecordElem::setUIDL ( const QString &  uid  ) 

Sets the unique mail ID.

Parameters:
uid the ID

QString ShowRecordElem::uidl (  )  const

Returns the unique ID of this mail.

Returns:
UID

void ShowRecordElem::setSize ( int  size  ) 

Sets the size of the mail.

Parameters:
size Size

int ShowRecordElem::size (  )  const

Returns the mail size as numeric value.

Returns:
size of the mail

QString ShowRecordElem::strSize (  )  const

Returns the mail size as string. The String has a length of 8 and the number is right-aligned to allow sorting.

QString ShowRecordElem::strSizePrefix (  )  const

Returns the mails size as string with prefix

void ShowRecordElem::setNew ( bool  isnew  ) 

Sets whether the mail is new or not.

Parameters:
isnew TRUE - mail is new; FALSE - mail is not new

bool ShowRecordElem::isNew (  )  const

Returns whether the mail is new or not.

Returns:
TRUE - mail is new

FALSE - mail is not new

QString ShowRecordElem::state (  )  const

Returns whether the mail is new or not.

Returns:
localized String "new", if the mail is new

localized String "old", if the mail is not new

void ShowRecordElem::setNumber ( int  n  ) 

Sets the number of this mail.

Parameters:
n mail number

int ShowRecordElem::number (  )  const

Returns the number of this mail.

Returns:
mail number

void ShowRecordElem::setViewItem ( ShowListViewItem item  ) 

Sets the pointer to the corresponding list view item.

See also:
m_pItem

ShowListViewItem

Parameters:
item pointer to the corresponding item

ShowListViewItem * ShowRecordElem::viewItem (  )  const

Returns the pointer to the corresponding list view item.

See also:
m_pItem

ShowListViewItem

Returns:
pointer to the item

FilterAction_Type ShowRecordElem::applyHeaderFilter ( HeaderFilter filter,
QString  account,
QString &  mailbox,
FilterLog log = NULL 
)

Looks for a filter matching the mail header and returns the action recommend by this filter. If the action is MARK, it set markAtViewRefresh to True so the related view entry will be marked at the next view refresh.

Parameters:
filter pointer to the header filter
account name of the account
mailbox reference to a QString object in which the mailbox name shall be written if the action is MOVE
log pointer to the filter log
Returns:
recommend action
See also:
FilterAction_Type

HeaderFilter

markAtViewRefresh

void ShowRecordElem::readOptions ( QDomElement &  elem  ) 

Read a mail (header, size, uid and number) from the given DOM element and store it in this mail object. The element has to contains the attributes "uidl", "size", "number" and a child node called "header".

Parameters:
elem a DOM element which contains a mail

void ShowRecordElem::saveOptions ( QDomDocument &  doc,
QDomElement &  parent 
)

Creates a new DOM element in the given DOM document and add it to given DOM parent element

Parameters:
doc the DOM document in that all options are stored
parent the parent element (account) of the mail

bool ShowRecordElem::isSelected (  )  const

Returns whether the mail is selected in the list view.

Returns:
TRUE - mail is selected

FALSE - mail is not selected

QString ShowRecordElem::decodeMailBody ( QByteArray  body,
bool  preferHTML 
) const

Decodes the given mail body. 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 encoded mail (including header)
preferHTML decode HTML part if present
Returns:
decoded mail body

int ShowRecordElem::showHeader ( QString &  account  ) 

Shows the header in a dialog box.

Parameters:
account account name
Returns:
continueShowHeaders - the user has OK clicked. The invoking function will show the next header

cancelShowHeaders - the user has Cancel clicked. The invoking function will not show the next header.

void ShowRecordElem::writeToMoveLog ( FilterLog log,
QString  account,
QString  mailbox 
)

Writes this mail into the Move Log.

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

void ShowRecordElem::writeToDeleteLog ( FilterLog log,
QString  account 
)

Writes this mail into the Delete Log.

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

void ShowRecordElem::setMarkAtNextViewRefresh (  ) 

The mail will be marked at the next view refresh.

QCString ShowRecordElem::scanHeader ( const QString &  item  )  const [private]

Searches in the header for a line which starts with the given item. For example: scanHeader( "From") will find the line "From: Ulrich Weigelt <ulrich.weigelt@gmx.de>" and returns "Ulrich Weigelt <ulrich.weigelt@gmx.de>" Returns an empty string (""), if nothing was found.

Parameters:
item the search item
Returns:
the content of the found line

void ShowRecordElem::setFrom ( const QCString &  from  )  [private]

Sets the given string as sender address

Parameters:
from sender address

void ShowRecordElem::setTo ( const QCString &  to  )  [private]

Sets the given string as recipient address

Parameters:
to recipient address

void ShowRecordElem::setSubject ( const QCString &  subject  )  [private]

Sets the given string as subject

Parameters:
subject the mail subject

void ShowRecordElem::setDate ( const QCString &  date  )  [private]

Converts the given string to a date-time value and stores it.

Parameters:
date the date

void ShowRecordElem::setContent ( const QCString &  content  )  [private]

Sets the given string as content type.

Parameters:
content the content type

void ShowRecordElem::setFilter ( FilterElem *  filter  )  [private]

Sets the pointer to a matching filter. Used by applyFilters().

See also:
applyFilters
Parameters:
filter pointer to the filter

QString ShowRecordElem::getBoundary (  )  const [private]

Returns the boundary, if the mail has a multi part body. Otherwise it returns an empty string.

Returns:
boundary

QString ShowRecordElem::getCharset (  )  const [private]

Returns the char set of the content (e.g. iso-8859-1). If no char set is denoted, it will returns an empty string.

Returns:
charset

QString ShowRecordElem::getTransferEncoding (  )  const [private]

Returns the content transfer encoding of the content (e.g. quoted-printable). If no encoding is denoted, it will returns an empty string.

Returns:
content transfer encoding


Member Data Documentation

int const ShowRecordElem::continueShowHeaders [static]

Returned by showHeader(), if the user has clicked OK.

int const ShowRecordElem::cancelShowHeaders [static]

Returned by showHeader(), if the user has clicked Cancel.

QCString ShowRecordElem::m_header [private]

Mail header; coded according RFC 2047

QCString ShowRecordElem::m_from [private]

The sender address; coded according RFC 2047

QCString ShowRecordElem::m_to [private]

The addressee; coded according RFC 2047

QCString ShowRecordElem::m_subject [private]

The subject; coded according RFC 2047

QDateTime ShowRecordElem::m_unixDate [private]

The date on which the mail was sent

QCString ShowRecordElem::m_content [private]

The content type

QString ShowRecordElem::m_uid [private]

The unique ID of the mail.

int ShowRecordElem::m_size [private]

Size of the mail

bool ShowRecordElem::m_new [private]

It is set to TRUE when the mail is new.

int ShowRecordElem::m_nNumber [private]

The mail number of the account

bool ShowRecordElem::markAtViewRefresh [private]

TRUE - the mail shall be marked at the next mail view refresh. It will be set to True by applyHeaderFilter() if the recommend filter action is MARK. It is used by setViewItem(). This methode marks the related list entry and after then it set this variable to False.

ShowListViewItem* ShowRecordElem::m_pItem [private]

Pointer to the corresponding list view entry. Used to check whether the entry is highlighted and we have to process this mail.

See also:
ShowListViewItem

FilterElem* ShowRecordElem::m_pFilter [private]

This is a pointer to the filter, which matches this mail. If it is NULL, no filter matches. Will be set by applyFilters(). This pointer will just be used to count the deleted mails by this filter( see implementation of setDeleted() ).


The documentation for this class was generated from the following files:
Generated on Tue Apr 1 21:59:50 2008 for kshowmail.kdevelop by  doxygen 1.5.0