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
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
void applyFilters ()
void readOptions (QDomElement &elem)
void saveOptions (QDomDocument &doc, QDomElement &parent)
bool isSelected () const
QString decodeMailBody (QByteArray body, bool preferHTML) const
int showHeader (QString &account)

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
ShowListViewItemm_pItem
FilterElemm_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

Definition at line 62 of file showrecordelem.h.


Constructor & Destructor Documentation

ShowRecordElem::ShowRecordElem (  ) 

Constructor

Definition at line 26 of file showrecordelem.cpp.

References m_from, m_new, m_pFilter, m_pItem, m_size, and m_subject.

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

Definition at line 37 of file showrecordelem.cpp.

References m_from, m_new, m_nNumber, m_pFilter, m_pItem, m_size, m_subject, and m_uid.


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

Definition at line 77 of file showrecordelem.cpp.

References content(), date(), from(), m_header, scanHeader(), setContent(), setDate(), setFrom(), setSubject(), setTo(), subject(), and to().

Referenced by readOptions(), and ShowRecord::setHeader().

QString ShowRecordElem::header (  )  const

Returns the whole header.

Returns:
the mail header

Definition at line 240 of file showrecordelem.cpp.

References m_header.

Referenced by ShowRecord::getHeaderOf(), FilterRecord::matches(), and showHeader().

QString ShowRecordElem::from (  )  const

Returns the sender address.

Returns:
sender address

Definition at line 127 of file showrecordelem.cpp.

References Codecs::decodeRFC2047(), and m_from.

Referenced by ShowRecord::fillMailListView(), ShowRecord::getSenderOf(), FilterRecord::matches(), and setHeader().

QString ShowRecordElem::to (  )  const

Returns the addressee.

Returns:
the addressee

Definition at line 132 of file showrecordelem.cpp.

References Codecs::decodeRFC2047(), and m_to.

Referenced by ShowRecord::fillMailListView(), FilterRecord::matches(), and setHeader().

QString ShowRecordElem::subject (  )  const

Returns the subject.

Returns:
mail subject

Definition at line 137 of file showrecordelem.cpp.

References Codecs::decodeRFC2047(), and m_subject.

Referenced by ShowRecord::fillMailListView(), ShowRecord::getSelectedSubjects(), ShowRecord::getSubjectOf(), FilterRecord::matches(), ShowRecord::printMailList(), setHeader(), and showHeader().

QString ShowRecordElem::content (  )  const

Returns the stored content type.

Returns:
content type

Definition at line 285 of file showrecordelem.cpp.

References m_content.

Referenced by ShowRecord::fillMailListView(), and setHeader().

QString ShowRecordElem::date (  )  const

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

Returns:
the date

Definition at line 142 of file showrecordelem.cpp.

References m_unixDate.

Referenced by ShowRecord::fillMailListView(), ShowRecord::getDateOf(), and setHeader().

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

Definition at line 147 of file showrecordelem.cpp.

References m_unixDate.

Referenced by ShowRecord::fillMailListView().

void ShowRecordElem::setUIDL ( const QString &  uid  ) 

Sets the unique mail ID.

Parameters:
uid the ID

Definition at line 245 of file showrecordelem.cpp.

References m_uid.

Referenced by readOptions().

QString ShowRecordElem::uidl (  )  const

Returns the unique ID of this mail.

Returns:
UID

Definition at line 250 of file showrecordelem.cpp.

References m_uid.

Referenced by ShowRecord::getHeaderOf(), ShowRecord::getUIDsOfOldMails(), ShowRecord::hasMail(), ShowRecord::isNew(), ShowRecord::printMailList(), and ShowRecord::setHeader().

void ShowRecordElem::setSize ( int  size  ) 

Sets the size of the mail.

Parameters:
size Size

Definition at line 255 of file showrecordelem.cpp.

References m_size.

Referenced by readOptions(), and ShowRecord::setSize().

int ShowRecordElem::size (  )  const

Returns the mail size as numeric value.

Returns:
size of the mail

Definition at line 260 of file showrecordelem.cpp.

References m_size.

Referenced by ShowRecord::fillMailListView(), ShowRecord::getTotalSize(), FilterRecord::matches(), ShowRecord::printMailList(), and strSizePrefix().

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.

Definition at line 152 of file showrecordelem.cpp.

References m_size.

QString ShowRecordElem::strSizePrefix (  )  const

Returns the mails size as string with prefix

Definition at line 313 of file showrecordelem.cpp.

References m_size, and size().

Referenced by ShowRecord::getSizeOf().

void ShowRecordElem::setNew ( bool  isnew  ) 

Sets whether the mail is new or not.

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

Definition at line 265 of file showrecordelem.cpp.

References m_new.

Referenced by readOptions().

bool ShowRecordElem::isNew (  )  const

Returns whether the mail is new or not.

Returns:
TRUE - mail is new

FALSE - mail is not new

Definition at line 270 of file showrecordelem.cpp.

References m_new.

Referenced by ShowRecord::getNewMails(), ShowRecord::getNumberNewMails(), ShowRecord::getUIDsOfOldMails(), ShowRecord::isNew(), and ShowRecord::printMailList().

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

Definition at line 157 of file showrecordelem.cpp.

References m_new.

Referenced by ShowRecord::fillMailListView().

void ShowRecordElem::setNumber ( int  n  ) 

Sets the number of this mail.

Parameters:
n mail number

Definition at line 275 of file showrecordelem.cpp.

References m_nNumber.

Referenced by readOptions().

int ShowRecordElem::number (  )  const

Returns the number of this mail.

Returns:
mail number

Definition at line 280 of file showrecordelem.cpp.

References m_nNumber.

Referenced by ShowRecord::decodeMailBody(), ShowRecord::fillMailListView(), ShowRecord::getDateOf(), ShowRecord::getNewMails(), ShowRecord::getSelectedMails(), ShowRecord::getSenderOf(), ShowRecord::getSizeOf(), ShowRecord::getSubjectOf(), ShowRecord::printMailList(), ShowRecord::removeMail(), ShowRecord::setHeader(), and ShowRecord::setSize().

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

Definition at line 290 of file showrecordelem.cpp.

References m_pItem.

Referenced by ShowRecord::fillMailListView().

ShowListViewItem * ShowRecordElem::viewItem (  )  const

Returns the pointer to the corresponding list view item.

See also:
m_pItem

ShowListViewItem

Returns:
pointer to the item

Definition at line 295 of file showrecordelem.cpp.

References m_pItem.

void ShowRecordElem::applyFilters (  ) 

Searches for a matching filer in the filter list and when it has found one, will store a pointer to the filter and will highlight the corresponding list view entry. This is the only thing which a filter produces.

See also:
m_pFilter

Filter::matches

Definition at line 204 of file showrecordelem.cpp.

References m_pItem, Filter::matches(), and setFilter().

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

Definition at line 189 of file showrecordelem.cpp.

References setHeader(), setNew(), setNumber(), setSize(), and setUIDL().

Referenced by ShowRecord::readStoredMails().

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

Definition at line 165 of file showrecordelem.cpp.

References m_header, m_nNumber, m_size, and m_uid.

bool ShowRecordElem::isSelected (  )  const

Returns whether the mail is selected in the list view.

Returns:
TRUE - mail is selected

FALSE - mail is not selected

Definition at line 305 of file showrecordelem.cpp.

References m_pItem.

Referenced by ShowRecord::getSelectedMails(), ShowRecord::getSelectedSubjects(), ShowRecord::hasSelectedMails(), and ShowRecord::showSelectedHeaders().

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

Definition at line 334 of file showrecordelem.cpp.

References getBoundary(), getCharset(), and getTransferEncoding().

Referenced by ShowRecord::decodeMailBody().

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.

Definition at line 586 of file showrecordelem.cpp.

References cancelShowHeaders, continueShowHeaders, header(), and subject().

Referenced by ShowRecord::showSelectedHeaders().

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

Definition at line 53 of file showrecordelem.cpp.

References m_header.

Referenced by setHeader().

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

Sets the given string as sender address

Parameters:
from sender address

Definition at line 220 of file showrecordelem.cpp.

References m_from.

Referenced by setHeader().

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

Sets the given string as recipient address

Parameters:
to recipient address

Definition at line 225 of file showrecordelem.cpp.

References m_to.

Referenced by setHeader().

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

Sets the given string as subject

Parameters:
subject the mail subject

Definition at line 230 of file showrecordelem.cpp.

References m_subject.

Referenced by setHeader().

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

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

Parameters:
date the date

Definition at line 116 of file showrecordelem.cpp.

References m_unixDate.

Referenced by setHeader().

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

Sets the given string as content type.

Parameters:
content the content type

Definition at line 235 of file showrecordelem.cpp.

References m_content.

Referenced by setHeader().

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

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

See also:
applyFilters
Parameters:
filer pointer to the filter

Definition at line 300 of file showrecordelem.cpp.

References m_pFilter.

Referenced by applyFilters().

QString ShowRecordElem::getBoundary (  )  const [private]

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

Returns:
boundary

Definition at line 500 of file showrecordelem.cpp.

References m_content, and m_header.

Referenced by decodeMailBody().

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

Definition at line 529 of file showrecordelem.cpp.

References m_header.

Referenced by decodeMailBody().

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

Definition at line 558 of file showrecordelem.cpp.

References m_header.

Referenced by decodeMailBody().


Member Data Documentation

int const ShowRecordElem::continueShowHeaders [static]

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

Definition at line 71 of file showrecordelem.h.

Referenced by showHeader(), and ShowRecord::showSelectedHeaders().

int const ShowRecordElem::cancelShowHeaders [static]

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

Definition at line 77 of file showrecordelem.h.

Referenced by showHeader().

QCString ShowRecordElem::m_header [private]

Mail header; coded according RFC 2047

Definition at line 288 of file showrecordelem.h.

Referenced by getBoundary(), getCharset(), getTransferEncoding(), header(), saveOptions(), scanHeader(), and setHeader().

QCString ShowRecordElem::m_from [private]

The sender address; coded according RFC 2047

Definition at line 293 of file showrecordelem.h.

Referenced by from(), setFrom(), and ShowRecordElem().

QCString ShowRecordElem::m_to [private]

The addressee; coded according RFC 2047

Definition at line 298 of file showrecordelem.h.

Referenced by setTo(), and to().

QCString ShowRecordElem::m_subject [private]

The subject; coded according RFC 2047

Definition at line 303 of file showrecordelem.h.

Referenced by setSubject(), ShowRecordElem(), and subject().

QDateTime ShowRecordElem::m_unixDate [private]

The date on which the mail was sent

Definition at line 308 of file showrecordelem.h.

Referenced by date(), setDate(), and strUnixTime().

QCString ShowRecordElem::m_content [private]

The content type

Definition at line 313 of file showrecordelem.h.

Referenced by content(), getBoundary(), and setContent().

QString ShowRecordElem::m_uid [private]

The unique ID of the mail.

Definition at line 318 of file showrecordelem.h.

Referenced by saveOptions(), setUIDL(), ShowRecordElem(), and uidl().

int ShowRecordElem::m_size [private]

Size of the mail

Definition at line 323 of file showrecordelem.h.

Referenced by saveOptions(), setSize(), ShowRecordElem(), size(), strSize(), and strSizePrefix().

bool ShowRecordElem::m_new [private]

It is set to TRUE when the mail is new.

Definition at line 328 of file showrecordelem.h.

Referenced by isNew(), setNew(), ShowRecordElem(), and state().

int ShowRecordElem::m_nNumber [private]

The mail number of the account

Definition at line 333 of file showrecordelem.h.

Referenced by number(), saveOptions(), setNumber(), and ShowRecordElem().

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

Definition at line 340 of file showrecordelem.h.

Referenced by applyFilters(), isSelected(), setViewItem(), ShowRecordElem(), and viewItem().

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() ).

Definition at line 348 of file showrecordelem.h.

Referenced by setFilter(), and ShowRecordElem().


The documentation for this class was generated from the following files:
Generated on Thu Jul 5 19:36:09 2007 for kshowmail by  doxygen 1.5.0