partNode::partNode( DwBodyPart* dwPart, int explicitType, int explicitSubType, bool deleteDwBodyPart ) : mRoot( 0 ), mNext( 0 ), mChild( 0 ), mWasProcessed( false ), mDwPart( dwPart ), mEncryptionState( KMMsgNotEncrypted ), mSignatureState( KMMsgNotSigned ), mMsgPartOk( false ), mEncodedOk( false ), mDeleteDwBodyPart( deleteDwBodyPart ), mMimePartTreeItem( 0 ), mBodyPartMemento( 0 ) { if ( explicitType != DwMime::kTypeUnknown ) { mType = explicitType; // this happens e.g. for the Root Node mSubType = explicitSubType; // representing the _whole_ message } else { // kdDebug(5006) << "\n partNode::partNode() explicitType == DwMime::kTypeUnknown\n" << endl; if(dwPart && dwPart->hasHeaders() && dwPart->Headers().HasContentType()) { mType = (!dwPart->Headers().ContentType().Type())?DwMime::kTypeUnknown:dwPart->Headers().ContentType().Type(); mSubType = dwPart->Headers().ContentType().Subtype(); } else { mType = DwMime::kTypeUnknown; mSubType = DwMime::kSubtypeUnknown; } } #ifdef DEBUG { DwString type, subType; DwTypeEnumToStr( mType, type ); DwSubtypeEnumToStr( mSubType, subType ); kdDebug(5006) << "\npartNode::partNode() " << type.c_str() << "/" << subType.c_str() << "\n" << endl; } #endif }
partNode* partNode::findType( int type, int subType, bool deep, bool wide ) { #ifndef NDEBUG DwString typeStr, subTypeStr; DwTypeEnumToStr( mType, typeStr ); DwSubtypeEnumToStr( mSubType, subTypeStr ); kdDebug(5006) << "partNode::findType() is looking at " << typeStr.c_str() << "/" << subTypeStr.c_str() << endl; #endif if( (mType != DwMime::kTypeUnknown) && ( (type == DwMime::kTypeUnknown) || (type == mType) ) && ( (subType == DwMime::kSubtypeUnknown) || (subType == mSubType) ) ) return this; if ( mChild && deep ) return mChild->findType( type, subType, deep, wide ); if ( mNext && wide ) return mNext->findType( type, subType, deep, wide ); return 0; }
void MultipartBodyPart::SetSubtype(int aSubtype) { DwSubtypeEnumToStr(aSubtype, mSubtype); }
QCString partNode::subTypeString() const { DwString s; DwSubtypeEnumToStr( subType(), s ); return s.c_str(); }
const KMail::BodyPartFormatter * KMail::BodyPartFormatter::createFor( int type, int subtype ) { DwString t, st; DwTypeEnumToStr( type, t ); DwSubtypeEnumToStr( subtype, st ); return createFor( t.c_str(), st.c_str() ); }