#include <showrecordelem.h>
Public Member Functions | |
ShowRecordElem () | |
ShowRecordElem (int number, TQString &uid, bool isNew) | |
void | setHeader (const TQString &header) |
TQString | header () const |
TQString | from () const |
TQString | to () const |
TQString | subject () const |
TQString | content () const |
TQString | date () const |
TQString | strUnixTime () const |
TQDateTime | sentDateTime () const |
void | setUIDL (const TQString &uid) |
TQString | uidl () const |
void | setSize (int size) |
int | size () const |
TQString | strSize () const |
TQString | strSizePrefix () const |
void | setNew (bool isnew) |
bool | isNew () const |
TQString | state () const |
void | setNumber (int n) |
int | number () const |
void | setViewItem (ShowListViewItem *item) |
ShowListViewItem * | viewItem () const |
FilterAction_Type | applyHeaderFilter (HeaderFilter *filter, TQString account, TQString &mailbox, FilterLog *log=NULL) |
void | readOptions (TQDomElement &elem) |
void | saveOptions (TQDomDocument &doc, TQDomElement &parent) |
bool | isSelected () const |
TQString | decodeMailBody (TQByteArray body, bool preferHTML) const |
int | showHeader (TQString &account) |
void | writeToMoveLog (FilterLog *log, TQString account, TQString mailbox) |
void | writeToDeleteLog (FilterLog *log, TQString account) |
void | setMarkAtNextViewRefresh () |
Static Public Attributes | |
static const int | continueShowHeaders |
static const int | cancelShowHeaders |
Private Member Functions | |
TQCString | scanHeader (const TQString &item) const |
void | setFrom (const TQCString &from) |
void | setTo (const TQCString &to) |
void | setSubject (const TQCString &subject) |
void | setDate (const TQCString &date) |
void | setContent (const TQCString &content) |
void | setFilter (FilterElem *filter) |
TQString | getBoundary () const |
TQString | getCharset () const |
TQString | getTransferEncoding () const |
Private Attributes | |
TQCString | m_header |
TQCString | m_from |
TQCString | m_to |
TQCString | m_subject |
TQDateTime | m_unixDate |
TQCString | m_content |
TQString | 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, | |
TQString & | 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 TQString & | 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 |
TQString ShowRecordElem::header | ( | ) | const |
Returns the whole header.
TQString ShowRecordElem::from | ( | ) | const |
Returns the sender address.
TQString ShowRecordElem::to | ( | ) | const |
Returns the addressee.
TQString ShowRecordElem::subject | ( | ) | const |
Returns the subject.
TQString ShowRecordElem::content | ( | ) | const |
Returns the stored content type.
TQString ShowRecordElem::date | ( | ) | const |
Returns the date on which the mail was sent, formated to the current locale's conventions.
TQString 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
TQDateTime ShowRecordElem::sentDateTime | ( | ) | const |
Returns the date and time on which the mail was sent.
void ShowRecordElem::setUIDL | ( | const TQString & | uid | ) |
Sets the unique mail ID.
uid | the ID |
TQString 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.
TQString 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.
TQString 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
TQString 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, | |
TQString | account, | |||
TQString & | 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 TQString object in which the mailbox name shall be written if the action is MOVE | |
log | pointer to the filter log |
void ShowRecordElem::readOptions | ( | TQDomElement & | 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 | ( | TQDomDocument & | doc, | |
TQDomElement & | 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
TQString ShowRecordElem::decodeMailBody | ( | TQByteArray | 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 | ( | TQString & | 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, | |
TQString | account, | |||
TQString | 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, | |
TQString | 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.
TQCString ShowRecordElem::scanHeader | ( | const TQString & | 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 TQCString & | from | ) | [private] |
Sets the given string as sender address
from | sender address |
void ShowRecordElem::setTo | ( | const TQCString & | to | ) | [private] |
Sets the given string as recipient address
to | recipient address |
void ShowRecordElem::setSubject | ( | const TQCString & | subject | ) | [private] |
Sets the given string as subject
subject | the mail subject |
void ShowRecordElem::setDate | ( | const TQCString & | date | ) | [private] |
Converts the given string to a date-time value and stores it.
date | the date |
void ShowRecordElem::setContent | ( | const TQCString & | 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 |
TQString ShowRecordElem::getBoundary | ( | ) | const [private] |
Returns the boundary, if the mail has a multi part body. Otherwise it returns an empty string.
TQString 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.
TQString 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.
TQCString ShowRecordElem::m_header [private] |
Mail header; coded according RFC 2047
TQCString ShowRecordElem::m_from [private] |
The sender address; coded according RFC 2047
TQCString ShowRecordElem::m_to [private] |
The addressee; coded according RFC 2047
TQCString ShowRecordElem::m_subject [private] |
The subject; coded according RFC 2047
TQDateTime ShowRecordElem::m_unixDate [private] |
The date on which the mail was sent
TQCString ShowRecordElem::m_content [private] |
The content type
TQString 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() ).