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