#include <showrecordelem.h>
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) |
ShowListViewItem * | viewItem () 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 |
ShowListViewItem * | m_pItem |
FilterElem * | m_pFilter |
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.
ShowRecordElem::ShowRecordElem | ( | ) |
Constructor
ShowRecordElem::ShowRecordElem | ( | int | number, | |
QString & | uid, | |||
bool | isNew | |||
) |
Constructor
number | number of the mail on the server | |
uid | Unique ID of the mail | |
isNew | TRUE - mail is new; FALSE - mail is not new |
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.
header | the mail header |
QString ShowRecordElem::header | ( | ) | const |
Returns the whole header.
QString ShowRecordElem::from | ( | ) | const |
Returns the sender address.
QString ShowRecordElem::to | ( | ) | const |
Returns the addressee.
QString ShowRecordElem::subject | ( | ) | const |
Returns the subject.
QString ShowRecordElem::content | ( | ) | const |
Returns the stored content type.
QString ShowRecordElem::date | ( | ) | const |
Returns the date on which the mail was sent, formated to the current locale's conventions.
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
QDateTime ShowRecordElem::sentDateTime | ( | ) | const |
Returns the date and time on which the mail was sent.
void ShowRecordElem::setUIDL | ( | const QString & | uid | ) |
Sets the unique mail ID.
uid | the ID |
QString ShowRecordElem::uidl | ( | ) | const |
Returns the unique ID of this mail.
void ShowRecordElem::setSize | ( | int | size | ) |
Sets the size of the mail.
size | Size |
int ShowRecordElem::size | ( | ) | const |
Returns the mail size as numeric value.
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.
isnew | TRUE - mail is new; FALSE - mail is not new |
bool ShowRecordElem::isNew | ( | ) | const |
Returns whether the mail is new or not.
FALSE - mail is not new
QString ShowRecordElem::state | ( | ) | const |
Returns whether the mail is new or not.
localized String "old", if the mail is not new
void ShowRecordElem::setNumber | ( | int | n | ) |
Sets the number of this mail.
n | mail number |
int ShowRecordElem::number | ( | ) | const |
Returns the number of this mail.
void ShowRecordElem::setViewItem | ( | ShowListViewItem * | item | ) |
Sets the pointer to the corresponding list view item.
item | pointer to the corresponding item |
ShowListViewItem * ShowRecordElem::viewItem | ( | ) | const |
Returns the pointer to the corresponding list view 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.
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 |
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".
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
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.
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.
body | the encoded mail (including header) | |
preferHTML | decode HTML part if present |
int ShowRecordElem::showHeader | ( | QString & | account | ) |
Shows the header in a dialog box.
account | account name |
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.
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.
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.
item | the search item |
void ShowRecordElem::setFrom | ( | const QCString & | from | ) | [private] |
Sets the given string as sender address
from | sender address |
void ShowRecordElem::setTo | ( | const QCString & | to | ) | [private] |
Sets the given string as recipient address
to | recipient address |
void ShowRecordElem::setSubject | ( | const QCString & | subject | ) | [private] |
Sets the given string as subject
subject | the mail subject |
void ShowRecordElem::setDate | ( | const QCString & | date | ) | [private] |
Converts the given string to a date-time value and stores it.
date | the date |
void ShowRecordElem::setContent | ( | const QCString & | content | ) | [private] |
Sets the given string as content type.
content | the content type |
void ShowRecordElem::setFilter | ( | FilterElem * | filter | ) | [private] |
Sets the pointer to a matching filter. Used by applyFilters().
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.
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.
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.
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.
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() ).