#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 |
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 |
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 |
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.
Definition at line 62 of file showrecordelem.h.
ShowRecordElem::ShowRecordElem | ( | ) |
ShowRecordElem::ShowRecordElem | ( | int | number, | |
QString & | uid, | |||
bool | isNew | |||
) |
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 |
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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".
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
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.
bool ShowRecordElem::isSelected | ( | ) | const |
Returns whether the mail is selected in the list view.
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.
body | the encoded mail (including header) | |
preferHTML | decode HTML part if present |
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.
account | account name |
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.
item | the search item |
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
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
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
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.
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.
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().
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.
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.
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.
Definition at line 558 of file showrecordelem.cpp.
References m_header.
Referenced by decodeMailBody().
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.
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.
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().