partNode.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef PARTNODE_H
00033 #define PARTNODE_H
00034
00035 #include "kmmsgpart.h"
00036 #include "kmmsgbase.h"
00037 #include "kmmessage.h"
00038
00039 #include <mimelib/mimepp.h>
00040 #include <mimelib/body.h>
00041 #include <mimelib/utility.h>
00042
00043 #include <kio/global.h>
00044 #include <kdebug.h>
00045
00046 class KMMimePartTreeItem;
00047 class KMMimePartTree;
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 class partNode
00062 {
00063 public:
00064 enum CryptoType { CryptoTypeUnknown,
00065 CryptoTypeNone,
00066 CryptoTypeInlinePGP,
00067 CryptoTypeOpenPgpMIME,
00068 CryptoTypeSMIME,
00069 CryptoType3rdParty };
00070
00071 private:
00072 partNode();
00073
00074 int calcNodeIdOrFindNode( int& curId, const partNode* calcNode,
00075 int findId, partNode** findNode );
00076
00077 public:
00078 partNode( DwBodyPart* dwPart,
00079 int explicitType = DwMime::kTypeUnknown,
00080 int explicitSubType = DwMime::kSubtypeUnknown,
00081 bool deleteDwBodyPart = false );
00082
00083 partNode( bool deleteDwBodyPart,
00084 DwBodyPart* dwPart );
00085
00086 ~partNode();
00087
00088 void dump( int chars=0 ) const;
00089
00090 void buildObjectTree( bool processSiblings=true );
00091
00092 DwBodyPart* dwPart() const {
00093 return mDwPart;
00094 }
00095
00096 void setDwPart( DwBodyPart* part ) {
00097 mDwPart = part;
00098 mMsgPartOk = false;
00099 }
00100
00101 KMMessagePart& msgPart() const {
00102 if( !mMsgPartOk ) {
00103 KMMessage::bodyPart(mDwPart, &mMsgPart);
00104 mMsgPartOk = true;
00105 }
00106 return mMsgPart;
00107 }
00108
00109 const QCString & encodedBody();
00110
00111 void setType( int type ) {
00112 mType = type;
00113 }
00114
00115 void setSubType( int subType ) {
00116 mSubType = subType;
00117 }
00118
00119 int type() const {
00120 return mType;
00121 }
00122
00123 QCString typeString() const;
00124
00125 int subType() const {
00126 return mSubType;
00127 }
00128
00129 QCString subTypeString() const;
00130
00131 bool hasType( int type ) {
00132 return mType == type;
00133 }
00134
00135 bool hasSubType( int subType ) {
00136 return mSubType == subType;
00137 }
00138
00139 void setCryptoType( CryptoType cryptoType ) {
00140 mCryptoType = cryptoType;
00141 }
00142
00143 CryptoType cryptoType() const {
00144 return mCryptoType;
00145 }
00146
00147
00148
00149 CryptoType firstCryptoType() const ;
00150
00151 void setEncryptionState( KMMsgEncryptionState state ) {
00152 mEncryptionState = state;
00153 }
00154 KMMsgEncryptionState encryptionState() const {
00155 return mEncryptionState;
00156 }
00157
00158
00159 KMMsgEncryptionState overallEncryptionState() const ;
00160
00161
00162 KMMsgSignatureState overallSignatureState() const ;
00163
00164 void setSignatureState( KMMsgSignatureState state ) {
00165 mSignatureState = state;
00166 }
00167 KMMsgSignatureState signatureState() const {
00168 return mSignatureState;
00169 }
00170
00171 int nodeId();
00172
00173 partNode* findId( int id );
00174
00175 partNode* findType( int type, int subType, bool deep=true, bool wide=true );
00176
00177 partNode* findTypeNot( int type, int subType, bool deep=true,
00178 bool wide=true );
00179
00180 void fillMimePartTree( KMMimePartTreeItem* parentItem,
00181 KMMimePartTree* mimePartTree,
00182 QString labelDescr = QString::null,
00183 QString labelCntType = QString::null,
00184 QString labelEncoding = QString::null,
00185 KIO::filesize_t size=0,
00186 bool revertOrder = false );
00187
00188 void adjustDefaultType( partNode* node );
00189
00190 void setNext( partNode* next ) {
00191 mNext = next;
00192 if( mNext ){
00193 mNext->mRoot = mRoot;
00194 adjustDefaultType( mNext );
00195 }
00196 }
00197
00198 void setFirstChild( partNode* child ) {
00199 mChild = child;
00200 if( mChild ) {
00201 mChild->mRoot = this;
00202 adjustDefaultType( mChild );
00203 }
00204 }
00205
00206 void setProcessed( bool processed, bool recurse ) {
00207 mWasProcessed = processed;
00208 if ( recurse ) {
00209 if( mChild )
00210 mChild->setProcessed( processed, true );
00211 if( mNext )
00212 mNext->setProcessed( processed, true );
00213 }
00214 }
00215
00216 void setMimePartTreeItem( KMMimePartTreeItem* item ) {
00217 mMimePartTreeItem = item;
00218 }
00219
00220 KMMimePartTreeItem* mimePartTreeItem() {
00221 return mMimePartTreeItem;
00222 }
00223
00224 void setFromAddress( const QString& address ) {
00225 mFromAddress = address;
00226 }
00227
00228 bool isAttachment() const;
00229
00230 bool hasContentDispositionInline() const;
00231
00232 const QString& trueFromAddress() const;
00233
00234 partNode * parentNode() const { return mRoot; }
00235 partNode * nextSibling() const { return mNext; }
00236 partNode * firstChild() const { return mChild; }
00237 bool processed() const { return mWasProcessed; }
00238
00239 private:
00240 partNode* mRoot;
00241 partNode* mNext;
00242 partNode* mChild;
00243 bool mWasProcessed;
00244 private:
00245 DwBodyPart* mDwPart;
00246 mutable KMMessagePart mMsgPart;
00247 QCString mEncodedBody;
00248 QString mFromAddress;
00249 int mType;
00250 int mSubType;
00251 CryptoType mCryptoType;
00252 KMMsgEncryptionState mEncryptionState;
00253 KMMsgSignatureState mSignatureState;
00254 mutable bool mMsgPartOk;
00255 bool mEncodedOk;
00256 bool mDeleteDwBodyPart;
00257 KMMimePartTreeItem* mMimePartTreeItem;
00258 };
00259
00260 #endif
This file is part of the documentation for kmail Library Version 3.2.2.