kmail
kmmsgpart.h
Go to the documentation of this file.00001 /* -*- mode: C++ -*- 00002 * kmail: KDE mail client 00003 * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 */ 00020 #ifndef kmmsgpart_h 00021 #define kmmsgpart_h 00022 00023 #include <kiconloader.h> 00024 00025 #include <QString> 00026 00027 template <typename T> 00028 class QList; 00029 class QTextCodec; 00030 00031 class KMMessagePart 00032 { 00033 public: 00034 KMMessagePart(); 00035 KMMessagePart( QDataStream & stream ); 00036 virtual ~KMMessagePart(); 00037 00039 void clear(); 00040 00043 void duplicate( const KMMessagePart & msgPart ); 00044 00046 QByteArray body(void) const; 00047 void setBody(const QByteArray &aStr); 00048 00052 void setBodyFromUnicode( const QString & str ); 00053 00056 QString bodyToUnicode(const QTextCodec* codec=0) const; 00057 00061 QByteArray bodyDecodedBinary(void) const; 00062 00065 QByteArray bodyDecoded(void) const; 00066 00076 void setBodyAndGuessCte(const QByteArray& aBuf, 00077 QList<int>& allowedCte, 00078 bool allow8Bit = false, 00079 bool willBeSigned = false); 00080 00083 void setBodyEncodedBinary(const QByteArray& aStr); 00084 00087 void setBodyEncoded( const QByteArray &aStr ); 00088 00093 void setMessageBody( const QByteArray &aBuf ); 00094 00096 int decodedSize() const; 00097 00101 QByteArray originalContentTypeStr(void) const 00102 { return mOriginalContentTypeStr; } 00103 00104 void setOriginalContentTypeStr( const QByteArray &txt ) 00105 { mOriginalContentTypeStr = txt; } 00106 00107 QByteArray typeStr() const { return mType; } 00108 void setTypeStr( const QByteArray & aStr ) { mType = aStr; } 00109 int type() const; 00110 void setType(int aType); 00112 QByteArray subtypeStr() const { return mSubtype; } 00113 void setSubtypeStr( const QByteArray & aStr ) { mSubtype = aStr; } 00114 int subtype() const; 00115 void setSubtype(int aSubtype); 00116 00118 QByteArray contentId() const { return mContentId; } 00119 void setContentId( const QByteArray & aStr ) { mContentId = aStr; } 00120 00124 void magicSetType(bool autoDecode=true); 00125 00128 QByteArray parameterAttribute(void) const; 00129 QString parameterValue(void) const; 00130 void setParameter(const QByteArray &attribute, const QString &value); 00131 00132 QByteArray additionalCTypeParamStr(void) const 00133 { 00134 return mAdditionalCTypeParamStr; 00135 } 00136 void setAdditionalCTypeParamStr( const QByteArray ¶m ) 00137 { 00138 mAdditionalCTypeParamStr = param; 00139 } 00140 00144 QString iconName( int size = KIconLoader::Desktop ) const; 00145 00149 QByteArray contentTransferEncodingStr(void) const; 00150 int contentTransferEncoding(void) const; 00151 void setContentTransferEncodingStr(const QByteArray &aStr); 00152 void setContentTransferEncoding(int aCte); 00153 00156 QByteArray cteStr(void) const { return contentTransferEncodingStr(); } 00157 int cte(void) const { return contentTransferEncoding(); } 00158 void setCteStr(const QByteArray& aStr) { setContentTransferEncodingStr(aStr); } 00159 void setCte(int aCte) { setContentTransferEncoding(aCte); } 00160 00161 00163 QString contentDescription() const; 00164 QByteArray contentDescriptionEncoded() const { return mContentDescription; } 00165 void setContentDescription(const QString &aStr); 00166 00168 QByteArray contentDisposition() const { return mContentDisposition; } 00169 void setContentDisposition( const QByteArray & cd ) { mContentDisposition = cd; } 00170 00172 QByteArray charset() const { return mCharset; } 00173 00175 void setCharset( const QByteArray & c ); 00176 00178 const QTextCodec * codec() const; 00179 00181 QString name() const { return mName; } 00182 void setName( const QString & name ) { mName = name; } 00183 00186 QString fileName(void) const; 00187 00189 QString partSpecifier() const { return mPartSpecifier; } 00190 00192 void setPartSpecifier( const QString & part ) { mPartSpecifier = part; } 00193 00195 bool isComplete() { return !mBody.isEmpty(); } 00196 00198 KMMessagePart* parent() { return mParent; } 00199 00201 void setParent( KMMessagePart* part ) { mParent = part; } 00202 00204 bool loadHeaders() { return mLoadHeaders; } 00205 00207 void setLoadHeaders( bool load ) { mLoadHeaders = load; } 00208 00210 bool loadPart() { return mLoadPart; } 00211 00213 void setLoadPart( bool load ) { mLoadPart = load; } 00214 00215 protected: 00216 QByteArray mOriginalContentTypeStr; 00217 QByteArray mType; 00218 QByteArray mSubtype; 00219 QByteArray mCte; 00220 QByteArray mContentDescription; 00221 QByteArray mContentDisposition; 00222 QByteArray mContentId; 00223 QByteArray mBody; 00224 QByteArray mAdditionalCTypeParamStr; 00225 QString mName; 00226 QByteArray mParameterAttribute; 00227 QString mParameterValue; 00228 QByteArray mCharset; 00229 QString mPartSpecifier; 00230 mutable int mBodyDecodedSize; 00231 KMMessagePart* mParent; 00232 bool mLoadHeaders; 00233 bool mLoadPart; 00234 }; 00235 00236 00237 #endif /*kmmsgpart_h*/
KDE 4.2 API Reference