- Main Page
- Namespaces
- Classes
- Files
- Directories

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ShowRecordElem Class Reference

Represents a mail. More...

`#include <showrecordelem.h>`

List of all members.

## 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

## 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,
|  | TQString & | 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 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.

Parameters:

  | header | the mail header

TQString ShowRecordElem::header | ( |  | ) | const

Returns the whole header.

Returns:
  the mail header

TQString ShowRecordElem::from | ( |  | ) | const

Returns the sender address.

Returns:
  sender address

TQString ShowRecordElem::to | ( |  | ) | const

Returns the addressee.

Returns:
  the addressee

TQString ShowRecordElem::subject | ( |  | ) | const

Returns the subject.

Returns:
  mail subject

TQString ShowRecordElem::content | ( |  | ) | const

Returns the stored content type.

Returns:
  content type

TQString ShowRecordElem::date | ( |  | ) | const

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

Returns:
  the date

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

Returns:
  the date

TQDateTime ShowRecordElem::sentDateTime | ( |  | ) | const

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

Returns:
  the date

void ShowRecordElem::setUIDL | ( | const TQString & | uid | ) |

Sets the unique mail ID.

Parameters:

  | uid | the ID

TQString 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

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.

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

TQString 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,
|  | 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.

Parameters:

  | 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

Returns:
  recommend action

See also:
  FilterAction_Type

  HeaderFilter

  markAtViewRefresh

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".

Parameters:

  | 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

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

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.

Parameters:

  | body | the encoded mail (including header)
  | preferHTML | decode HTML part if present

Returns:
  decoded mail body

int ShowRecordElem::showHeader | ( | TQString & | 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,
|  | TQString | account,
|  | TQString | 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,
|  | TQString | 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.

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.

Parameters:

  | item | the search item

Returns:
  the content of the found line

void ShowRecordElem::setFrom | ( | const TQCString & | from | ) | `[private]`

Sets the given string as sender address

Parameters:

  | from | sender address

void ShowRecordElem::setTo | ( | const TQCString & | to | ) | `[private]`

Sets the given string as recipient address

Parameters:

  | to | recipient address

void ShowRecordElem::setSubject | ( | const TQCString & | subject | ) | `[private]`

Sets the given string as subject

Parameters:

  | subject | the mail subject

void ShowRecordElem::setDate | ( | const TQCString & | date | ) | `[private]`

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

Parameters:

  | date | the date

void ShowRecordElem::setContent | ( | const TQCString & | 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

TQString ShowRecordElem::getBoundary | ( |  | ) | const`[private]`

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

Returns:
  boundary

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.

Returns:
  charset

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.

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.

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.

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:

- Daten/Documents/programmieren/kshowmail/kshowmail/kshowmail/showrecordelem.h
- Daten/Documents/programmieren/kshowmail/kshowmail/kshowmail/showrecordelem.cpp