kmail Library API Documentation

kmmsgpart.h

00001 /* part of a mime multi-part message
00002  * Author: Stefan Taferner <taferner@alpin.or.at>
00003  */
00004 #ifndef kmmsgpart_h
00005 #define kmmsgpart_h
00006 
00007 #include <qstring.h>
00008 #include <qcstring.h>
00009 #include <qdict.h>
00010 
00011 template <typename T>
00012 class QValueList;
00013 class QTextCodec;
00014 
00015 class KMMessagePart
00016 {
00017 public:
00018   KMMessagePart();
00019   KMMessagePart( QDataStream & stream );
00020   virtual ~KMMessagePart();
00021 
00023   void clear();
00024 
00027   void duplicate( const KMMessagePart & msgPart );
00028 
00030   QCString body(void) const;
00031   void setBody(const QCString &aStr);
00032 
00036   void setBodyFromUnicode( const QString & str );
00037 
00040   QString bodyToUnicode(const QTextCodec* codec=0) const;
00041 
00045   virtual QByteArray bodyDecodedBinary(void) const;
00046 
00049   virtual QCString bodyDecoded(void) const;
00050 
00060   virtual void setBodyAndGuessCte(const QByteArray& aBuf,
00061                   QValueList<int>& allowedCte,
00062                   bool allow8Bit = false,
00063                                   bool willBeSigned = false);
00065   virtual void setBodyAndGuessCte(const QCString& aBuf,
00066                   QValueList<int>& allowedCte,
00067                   bool allow8Bit = false,
00068                                   bool willBeSigned = false);
00069 
00072   virtual void setBodyEncodedBinary(const QByteArray& aStr);
00073 
00076   virtual void setBodyEncoded(const QCString& aStr);
00077 
00082   void setMessageBody( const QByteArray & aBuf );
00083 
00085   virtual int decodedSize(void) const;
00086 
00090   QCString originalContentTypeStr(void) const { return mOriginalContentTypeStr; }
00091   void setOriginalContentTypeStr( const QCString& txt )
00092   {
00093     mOriginalContentTypeStr = txt;
00094   }
00095   QCString typeStr() const { return mType; }
00096   void setTypeStr( const QCString & aStr ) { mType = aStr; }
00097   int type() const;
00098   void setType(int aType);
00100   QCString subtypeStr() const { return mSubtype; }
00101   void setSubtypeStr( const QCString & aStr ) { mSubtype = aStr; }
00102   int subtype() const;
00103   void setSubtype(int aSubtype);
00104 
00108   void magicSetType(bool autoDecode=TRUE);
00109 
00112   QCString parameterAttribute(void) const;
00113   QString parameterValue(void) const;
00114   void setParameter(const QCString &attribute, const QString &value);
00115 
00116   QCString additionalCTypeParamStr(void) const
00117   {
00118     return mAdditionalCTypeParamStr;
00119   }
00120   void setAdditionalCTypeParamStr( const QCString &param )
00121   {
00122     mAdditionalCTypeParamStr = param;
00123   }
00124 
00128   QString iconName(const QString &mimeType = QString::null) const;
00129 
00133   QCString contentTransferEncodingStr(void) const;
00134   int  contentTransferEncoding(void) const;
00135   void setContentTransferEncodingStr(const QCString &aStr);
00136   void setContentTransferEncoding(int aCte);
00137 
00140   QCString cteStr(void) const { return contentTransferEncodingStr(); }
00141   int cte(void) const { return contentTransferEncoding(); }
00142   void setCteStr(const QCString& aStr) { setContentTransferEncodingStr(aStr); }
00143   void setCte(int aCte) { setContentTransferEncoding(aCte); }
00144 
00145 
00147   QString contentDescription() const;
00148   QCString contentDescriptionEncoded() const { return mContentDescription; }
00149   void setContentDescription(const QString &aStr);
00150 
00152   QCString contentDisposition() const { return mContentDisposition; }
00153   void setContentDisposition( const QCString & cd ) { mContentDisposition = cd; }
00154 
00156   QCString charset() const { return mCharset; }
00157 
00159   void setCharset( const QCString & c );
00160 
00162   const QTextCodec * codec() const;
00163 
00165   QString name() const { return mName; }
00166   void setName( const QString & name ) { mName = name; }
00167 
00170   QString fileName(void) const;
00171 
00173   QString partSpecifier() const { return mPartSpecifier; }
00174 
00176   void setPartSpecifier( const QString & part ) { mPartSpecifier = part; }
00177 
00179   bool isComplete() { return (!mBody.isNull()); }
00180 
00182   KMMessagePart* parent() { return mParent; }
00183 
00185   void setParent( KMMessagePart* part ) { mParent = part; }
00186 
00188   bool loadHeaders() { return mLoadHeaders; }
00189 
00191   void setLoadHeaders( bool load ) { mLoadHeaders = load; }
00192 
00194   bool loadPart() { return mLoadPart; }
00195 
00197   void setLoadPart( bool load ) { mLoadPart = load; }
00198 
00199 protected:
00200   QCString mOriginalContentTypeStr;
00201   QCString mType;
00202   QCString mSubtype;
00203   QCString mCte;
00204   QCString mContentDescription;
00205   QCString mContentDisposition;
00206   QByteArray mBody;
00207   QCString mAdditionalCTypeParamStr;
00208   QString mName;
00209   QCString mParameterAttribute;
00210   QString mParameterValue;
00211   QCString mCharset;
00212   QString mPartSpecifier;
00213   mutable int mBodyDecodedSize;
00214   KMMessagePart* mParent;
00215   bool mLoadHeaders;
00216   bool mLoadPart;
00217 };
00218 
00219 
00220 #endif /*kmmsgpart_h*/
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jan 31 15:55:05 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003