• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kmail

KMMsgBase Class Reference

#include <kmmsgbase.h>

Inheritance diagram for KMMsgBase:

Inheritance graph
[legend]

List of all members.


Detailed Description

Definition at line 93 of file kmmsgbase.h.


Public Types

enum  MsgPartType {
  MsgNoPart = 0, MsgFromPart = 1, MsgSubjectPart = 2, MsgToPart = 3,
  MsgReplyToIdMD5Part = 4, MsgIdMD5Part = 5, MsgXMarkPart = 6, MsgOffsetPart = 7,
  MsgLegacyStatusPart = 8, MsgSizePart = 9, MsgDatePart = 10, MsgFilePart = 11,
  MsgCryptoStatePart = 12, MsgMDNSentPart = 13, MsgReplyToAuxIdMD5Part = 14, MsgStrippedSubjectMD5Part = 15,
  MsgStatusPart = 16, MsgSizeServerPart = 17, MsgUIDPart = 18, MsgTagPart = 19
}

Public Member Functions

const uchar * asIndexString (int &len) const
void assign (const KMMsgBase *other)
virtual KMMsgAttachmentState attachmentState () const
QString cleanSubject () const
QString cleanSubject (const QStringList &prefixRegExps, bool replace, const QString &newPrefix) const
virtual time_t date (void) const =0
virtual QString dateStr (void) const
virtual bool dirty (void) const
virtual bool enableUndo ()
virtual KMMsgEncryptionState encryptionState () const =0
virtual QString fileName (void) const =0
virtual off_t folderOffset (void) const =0
QString forwardSubject () const
virtual QString fromStrip (void) const =0
off_t getLongPart (MsgPartType) const
virtual unsigned long getMsgSerNum () const
QString getStringPart (MsgPartType) const
virtual short indexLength () const
virtual off_t indexOffset () const
virtual void initStrippedSubjectMD5 ()=0
virtual bool isMessage (void) const
 KMMsgBase (const KMMsgBase &other)
 KMMsgBase (KMFolder *aParentFolder, off_t off, short len)
 KMMsgBase (KMFolder *p=0)
virtual KMMsgMDNSentState mdnSentState () const =0
const MessageStatus & messageStatus () const
virtual QString msgIdMD5 (void) const =0
virtual size_t msgSize (void) const =0
virtual size_t msgSizeServer (void) const =0
KMMsgBase & operator= (const KMMsgBase &other)
KMFolder * parent () const
QString replySubject () const
virtual QString replyToAuxIdMD5 () const =0
virtual QString replyToIdMD5 (void) const =0
virtual void setDate (time_t aUnixTime)=0
virtual void setDate (const QByteArray &aStrDate)
void setDirty (bool b)
virtual void setEnableUndo (bool enable)
virtual void setEncryptionState (const KMMsgEncryptionState, int idx=-1)
virtual void setEncryptionStateChar (QChar status, int idx=-1)
virtual void setFileName (const QString &filename)=0
virtual void setFolderOffset (off_t offs)=0
virtual void setIndexLength (short len)
virtual void setIndexOffset (off_t off)
virtual void setMDNSentState (KMMsgMDNSentState status, int idx=-1)
virtual void setMsgSize (size_t sz)=0
virtual void setMsgSizeServer (size_t sz)=0
void setParent (KMFolder *p)
virtual void setSignatureState (const KMMsgSignatureState, int idx=-1)
virtual void setSignatureStateChar (QChar status, int idx=-1)
virtual void setStatus (const char *statusField, const char *xstatusField=0)
virtual void setStatus (const MessageStatus &status, int idx=-1)
virtual void setSubject (const QString &)=0
virtual void setTagList (const KMMessageTagList &aTagList)
virtual void setTagList (const QString &aString)
virtual void setUID (ulong uid)=0
virtual void setXMark (const QString &)=0
virtual KMMsgSignatureState signatureState () const =0
virtual MessageStatus & status () const
KMFolderIndex * storage () const
virtual QString strippedSubjectMD5 () const =0
virtual QString subject (void) const =0
virtual bool subjectIsPrefixed () const =0
bool syncIndexString () const
virtual KMMessageTagList * tagList (void) const =0
virtual QString tagString (void) const =0
virtual void toggleStatus (const MessageStatus &status, int idx=-1)
virtual QString toStrip (void) const =0
virtual ulong UID (void) const =0
virtual QString xmark (void) const =0
virtual ~KMMsgBase ()

Static Public Member Functions

static QByteArray autoDetectCharset (const QByteArray &encoding, const QStringList &encodingList, const QString &text)
static QString base64EncodedMD5 (const char *aStr, int len=-1)
static QString base64EncodedMD5 (const QByteArray &aStr)
static QString base64EncodedMD5 (const QString &aStr, bool utf8=false)
static const QTextCodec * codecForName (const QByteArray &_str)
static QString decodeRFC2047String (const QByteArray &aStr, const QByteArray &prefCharset="")
static QString decodeRFC2231String (const QByteArray &aStr)
static QByteArray encodeRFC2047Quoted (const QByteArray &aStr, bool base64)
static QByteArray encodeRFC2047String (const QString &aStr, const QByteArray &charset)
static QByteArray encodeRFC2231String (const QString &aStr, const QByteArray &charset)
static QString encodingForName (const QString &descriptiveName)
static QByteArray extractRFC2231HeaderField (const QByteArray &aStr, const QByteArray &field)
static void readConfig ()
static QString replacePrefixes (const QString &str, const QStringList &prefixRegExps, bool replace, const QString &newPrefix)
static QString skipKeyword (const QString &str, QChar sepChar=':', bool *keywordFound=0)
static QString stripOffPrefixes (const QString &str)
static QStringList supportedEncodings (bool usAscii)
static QByteArray toUsAscii (const QString &_str, bool *ok=0)

Protected Attributes

bool mDirty
bool mEnableUndo
short mIndexLength
off_t mIndexOffset
KMFolder * mParent
MessageStatus mStatus
KMMessageTagList * mTagList

Member Enumeration Documentation

enum KMMsgBase::MsgPartType

Enumerator:
MsgNoPart 
MsgFromPart 
MsgSubjectPart 
MsgToPart 
MsgReplyToIdMD5Part 
MsgIdMD5Part 
MsgXMarkPart 
MsgOffsetPart 
MsgLegacyStatusPart 
MsgSizePart 
MsgDatePart 
MsgFilePart 
MsgCryptoStatePart 
MsgMDNSentPart 
MsgReplyToAuxIdMD5Part 
MsgStrippedSubjectMD5Part 
MsgStatusPart 
MsgSizeServerPart 
MsgUIDPart 
MsgTagPart 

Definition at line 387 of file kmmsgbase.h.


Constructor & Destructor Documentation

KMMsgBase::KMMsgBase ( KMFolder *  p = 0  ) 

Definition at line 77 of file kmmsgbase.cpp.

KMMsgBase::KMMsgBase ( KMFolder *  aParentFolder,
off_t  off,
short  len 
)

Definition at line 99 of file kmmsgbase.cpp.

KMMsgBase::~KMMsgBase (  )  [virtual]

Definition at line 122 of file kmmsgbase.cpp.

KMMsgBase::KMMsgBase ( const KMMsgBase &  other  ) 

Copy constructor that simply calls assign().

Definition at line 112 of file kmmsgbase.cpp.


Member Function Documentation

const uchar * KMMsgBase::asIndexString ( int &  len  )  const

Return contents as index string.

This string is of indexStringLength() size

Definition at line 1060 of file kmmsgbase.cpp.

void KMMsgBase::assign ( const KMMsgBase *  other  ) 

Copy all values from other to this object.

Definition at line 141 of file kmmsgbase.cpp.

KMMsgAttachmentState KMMsgBase::attachmentState (  )  const [virtual]

Return if the message has at least one attachment.

Definition at line 784 of file kmmsgbase.cpp.

QByteArray KMMsgBase::autoDetectCharset ( const QByteArray &  encoding,
const QStringList &  encodingList,
const QString &  text 
) [static]

Find out preferred charset for 'text'.

First encoding is tried and if that one is not suitable, the encodings in encodingList are tried.

Definition at line 725 of file kmmsgbase.cpp.

QString KMMsgBase::base64EncodedMD5 ( const char *  aStr,
int  len = -1 
) [static]

Definition at line 716 of file kmmsgbase.cpp.

QString KMMsgBase::base64EncodedMD5 ( const QByteArray &  aStr  )  [static]

Definition at line 711 of file kmmsgbase.cpp.

QString KMMsgBase::base64EncodedMD5 ( const QString &  aStr,
bool  utf8 = false 
) [static]

Calculate the base64 encoded md5sum (sans the trailing equal signs).

If utf8 is false, uses QString::toLatin1() to calculate the md5sum of, else uses QString::utf8()

Definition at line 703 of file kmmsgbase.cpp.

QString KMMsgBase::cleanSubject (  )  const

Return this mails subject, with all "forward" and "reply" prefixes removed.

Definition at line 1222 of file kmmsgbase.cpp.

QString KMMsgBase::cleanSubject ( const QStringList &  prefixRegExps,
bool  replace,
const QString &  newPrefix 
) const

Check for prefixes prefixRegExps in subject().

If none is found, newPrefix + ' ' is prepended to the subject and the resulting string is returned. If replace is true, any sequence of whitespace-delimited prefixes at the beginning of subject() is replaced by newPrefix

Definition at line 1229 of file kmmsgbase.cpp.

const QTextCodec * KMMsgBase::codecForName ( const QByteArray &  _str  )  [static]

Return a QTextCodec for the specified charset.

This function is a bit more tolerant, than QTextCodec::codecForName

Definition at line 352 of file kmmsgbase.cpp.

virtual time_t KMMsgBase::date ( void   )  const [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

QString KMMsgBase::dateStr ( void   )  const [virtual]

Reimplemented in KMMessage.

Definition at line 316 of file kmmsgbase.cpp.

QString KMMsgBase::decodeRFC2047String ( const QByteArray &  aStr,
const QByteArray &  prefCharset = "" 
) [static]

This function handles both encodings described in RFC2047: Base64 ("=?iso-8859-1?b?...?=") and quoted-printable.

Definition at line 438 of file kmmsgbase.cpp.

QString KMMsgBase::decodeRFC2231String ( const QByteArray &  aStr  )  [static]

Decode given string as described in RFC2231.

Definition at line 624 of file kmmsgbase.cpp.

virtual bool KMMsgBase::dirty ( void   )  const [inline, virtual]

Returns true if changed since last folder-sync.

Reimplemented in KMMsgInfo.

Definition at line 190 of file kmmsgbase.h.

virtual bool KMMsgBase::enableUndo (  )  [inline, virtual]

If undo for this message should be enabled.

Definition at line 328 of file kmmsgbase.h.

QByteArray KMMsgBase::encodeRFC2047Quoted ( const QByteArray &  aStr,
bool  base64 
) [static]

Helper function for encodeRFC2047String.

Definition at line 459 of file kmmsgbase.cpp.

QByteArray KMMsgBase::encodeRFC2047String ( const QString &  aStr,
const QByteArray &  charset 
) [static]

Encode given string as described in RFC2047: using quoted-printable.

Definition at line 469 of file kmmsgbase.cpp.

QByteArray KMMsgBase::encodeRFC2231String ( const QString &  aStr,
const QByteArray &  charset 
) [static]

Encode given string as described in RFC2231 (parameters in MIME headers).

Definition at line 561 of file kmmsgbase.cpp.

QString KMMsgBase::encodingForName ( const QString &  descriptiveName  )  [static]

Drop-in replacement for KCharsets::encodingForName().

The problem with the KCharsets function is that it returns "human-readable" encoding names like "ISO 8859-15" instead of valid encoding names like "ISO-8859-15". This function fixes this by replacing whitespace with a hyphen.

Definition at line 403 of file kmmsgbase.cpp.

virtual KMMsgEncryptionState KMMsgBase::encryptionState (  )  const [pure virtual]

Encryption status of the message.

Implemented in KMMessage, and KMMsgInfo.

QByteArray KMMsgBase::extractRFC2231HeaderField ( const QByteArray &  aStr,
const QByteArray &  field 
) [static]

Extract a given param from the RFC2231-encoded header field, in particular concatenate possibly multiple entries, which are given as paramname*0=.

.; paramname*1=..; ... or paramname*0*=..; paramname*1*=..; ... and return their value as one string. That string will still be encoded

Definition at line 660 of file kmmsgbase.cpp.

virtual QString KMMsgBase::fileName ( void   )  const [pure virtual]

Get/set msg filename.

Implemented in KMMessage, and KMMsgInfo.

virtual off_t KMMsgBase::folderOffset ( void   )  const [pure virtual]

Get/set offset in mail folder.

Implemented in KMMessage, and KMMsgInfo.

QString KMMsgBase::forwardSubject (  )  const

Return this mails subject, formatted for "forward" mails.

Definition at line 1238 of file kmmsgbase.cpp.

virtual QString KMMsgBase::fromStrip ( void   )  const [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

off_t KMMsgBase::getLongPart ( MsgPartType  t  )  const

access to long msgparts

Definition at line 912 of file kmmsgbase.cpp.

unsigned long KMMsgBase::getMsgSerNum (  )  const [virtual]

Returns the message serial number for the message.

Definition at line 768 of file kmmsgbase.cpp.

QString KMMsgBase::getStringPart ( MsgPartType  t  )  const

access to string msgparts

Definition at line 825 of file kmmsgbase.cpp.

virtual short KMMsgBase::indexLength (  )  const [inline, virtual]

Definition at line 241 of file kmmsgbase.h.

virtual off_t KMMsgBase::indexOffset (  )  const [inline, virtual]

Definition at line 236 of file kmmsgbase.h.

virtual void KMMsgBase::initStrippedSubjectMD5 (  )  [pure virtual]

Calculate strippedSubject.

Implemented in KMMessage, and KMMsgInfo.

bool KMMsgBase::isMessage ( void   )  const [virtual]

Returns true if object is a real message (not KMMsgInfo or KMMsgBase).

Reimplemented in KMMessage.

Definition at line 174 of file kmmsgbase.cpp.

virtual KMMsgMDNSentState KMMsgBase::mdnSentState (  )  const [pure virtual]

"MDN send" status of the message.

Implemented in KMMessage, and KMMsgInfo.

const MessageStatus & KMMsgBase::messageStatus (  )  const

Const reference to a status object of a message.

Definition at line 302 of file kmmsgbase.cpp.

virtual QString KMMsgBase::msgIdMD5 ( void   )  const [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

virtual size_t KMMsgBase::msgSize ( void   )  const [pure virtual]

Get/set size of message including the whole header in bytes.

Implemented in KMMessage, and KMMsgInfo.

virtual size_t KMMsgBase::msgSizeServer ( void   )  const [pure virtual]

Get/set size of message on server.

Implemented in KMMessage, and KMMsgInfo.

KMMsgBase & KMMsgBase::operator= ( const KMMsgBase &  other  ) 

Assignment operator that simply calls assign().

Definition at line 167 of file kmmsgbase.cpp.

KMFolder* KMMsgBase::parent ( void   )  const [inline]

Return owning folder.

Definition at line 110 of file kmmsgbase.h.

void KMMsgBase::readConfig ( void   )  [static]

Reads config settings from group "Composer" and sets all internal variables (e.g.

indent-prefix, etc.)

Reimplemented in KMMessage.

Definition at line 1146 of file kmmsgbase.cpp.

QString KMMsgBase::replacePrefixes ( const QString &  str,
const QStringList &  prefixRegExps,
bool  replace,
const QString &  newPrefix 
) [static]

Check for prefixes prefixRegExps in str.

If none is found, newPrefix + ' ' is prepended to str and the resulting string is returned. If replace is true, any sequence of whitespace-delimited prefixes at the beginning of str is replaced by newPrefix.

Definition at line 1171 of file kmmsgbase.cpp.

QString KMMsgBase::replySubject (  )  const

Return this mails subject, formatted for "reply" mails.

Definition at line 1243 of file kmmsgbase.cpp.

virtual QString KMMsgBase::replyToAuxIdMD5 (  )  const [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

virtual QString KMMsgBase::replyToIdMD5 ( void   )  const [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

virtual void KMMsgBase::setDate ( time_t  aUnixTime  )  [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

void KMMsgBase::setDate ( const QByteArray &  aStrDate  )  [virtual]

Set date.

Reimplemented in KMMessage.

Definition at line 309 of file kmmsgbase.cpp.

void KMMsgBase::setDirty ( bool  b  )  [inline]

Change dirty flag.

Definition at line 193 of file kmmsgbase.h.

virtual void KMMsgBase::setEnableUndo ( bool  enable  )  [inline, virtual]

Definition at line 329 of file kmmsgbase.h.

void KMMsgBase::setEncryptionState ( const   KMMsgEncryptionState,
int  idx = -1 
) [virtual]

Set encryption status of the message and mark dirty.

Optional optimization: idx may specify the index of this message within the parent folder.

Reimplemented in KMMessage, and KMMsgInfo.

Definition at line 240 of file kmmsgbase.cpp.

void KMMsgBase::setEncryptionStateChar ( QChar  status,
int  idx = -1 
) [virtual]

Set encryption status of the message and mark dirty.

Optional optimization: idx may specify the index of this message within the parent folder.

Definition at line 248 of file kmmsgbase.cpp.

virtual void KMMsgBase::setFileName ( const QString &  filename  )  [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

virtual void KMMsgBase::setFolderOffset ( off_t  offs  )  [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

virtual void KMMsgBase::setIndexLength ( short  len  )  [inline, virtual]

size in index file (or length of the data() in case of SQLite storage)

Definition at line 240 of file kmmsgbase.h.

virtual void KMMsgBase::setIndexOffset ( off_t  off  )  [inline, virtual]

offset into index file

Definition at line 235 of file kmmsgbase.h.

void KMMsgBase::setMDNSentState ( KMMsgMDNSentState  status,
int  idx = -1 
) [virtual]

Set "MDN sent" status of the message.

Reimplemented in KMMessage, and KMMsgInfo.

Definition at line 273 of file kmmsgbase.cpp.

virtual void KMMsgBase::setMsgSize ( size_t  sz  )  [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

virtual void KMMsgBase::setMsgSizeServer ( size_t  sz  )  [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

void KMMsgBase::setParent ( KMFolder *  p  )  [inline]

Set owning folder.

Definition at line 113 of file kmmsgbase.h.

void KMMsgBase::setSignatureState ( const   KMMsgSignatureState,
int  idx = -1 
) [virtual]

Set signature status of the message and mark dirty.

Optional optimization: idx may specify the index of this message within the parent folder.

Reimplemented in KMMessage, and KMMsgInfo.

Definition at line 265 of file kmmsgbase.cpp.

void KMMsgBase::setSignatureStateChar ( QChar  status,
int  idx = -1 
) [virtual]

Set signature status of the message and mark dirty.

Optional optimization: idx may specify the index of this message within the parent folder.

Definition at line 279 of file kmmsgbase.cpp.

void KMMsgBase::setStatus ( const char *  statusField,
const char *  xstatusField = 0 
) [virtual]

Reimplemented in KMMessage, and KMMsgInfo.

Definition at line 211 of file kmmsgbase.cpp.

virtual void KMMsgBase::setStatus ( const MessageStatus &  status,
int  idx = -1 
) [virtual]

Set status and mark dirty.

Optional optimization: idx may specify the index of this message within the parent folder.

virtual void KMMsgBase::setSubject ( const QString &   )  [pure virtual]

Set subject/from/date and xmark.

Implemented in KMMessage, and KMMsgInfo.

void KMMsgBase::setTagList ( const KMMessageTagList &  aTagList  )  [virtual]

Set the tag list to aTagList and set dirty.

Definition at line 1208 of file kmmsgbase.cpp.

void KMMsgBase::setTagList ( const QString &  aString  )  [virtual]

Split aString at commas and set the tag list to the resulting list and set dirty.

Definition at line 1203 of file kmmsgbase.cpp.

virtual void KMMsgBase::setUID ( ulong  uid  )  [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

virtual void KMMsgBase::setXMark ( const QString &   )  [pure virtual]

Implemented in KMMessage, and KMMsgInfo.

virtual KMMsgSignatureState KMMsgBase::signatureState (  )  const [pure virtual]

Signature status of the message.

Implemented in KMMessage, and KMMsgInfo.

QString KMMsgBase::skipKeyword ( const QString &  str,
QChar  sepChar = ':',
bool *  keywordFound = 0 
) [static]

Skip leading keyword if keyword has given character at it's end (e.g.

':' or ',') and skip the then following blanks (if any) too. If keywordFound is specified it will be true if a keyword was skipped and false otherwise.

Definition at line 324 of file kmmsgbase.cpp.

MessageStatus & KMMsgBase::status (  )  const [virtual]

Status object of the message.

Reimplemented in KMMessage, and KMMsgInfo.

Definition at line 296 of file kmmsgbase.cpp.