kmail

partnodebodypart.cpp
1 /*
2  partnodebodypart.cpp
3 
4  This file is part of KMail, the KDE mail client.
5  Copyright (c) 2004 Marc Mutz <mutz@kde.org>,
6  Ingo Kloecker <kloecker@kde.org>
7 
8  KMail is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  KMail is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22  In addition, as a special exception, the copyright holders give
23  permission to link the code of this program with any edition of
24  the TQt library by Trolltech AS, Norway (or with modified versions
25  of TQt that use the same license as TQt), and distribute linked
26  combinations including the two. You must obey the GNU General
27  Public License in all respects for all of the code used other than
28  TQt. If you modify this file, you may extend this exception to
29  your version of the file, but you are not obligated to do so. If
30  you do not wish to do so, delete this exception statement from
31  your version.
32 */
33 
34 #include "partnodebodypart.h"
35 
36 #include "partNode.h"
37 
38 #include <tqstring.h>
39 #include <tqcstring.h>
40 
41 static int serial = 0;
42 
43 KMail::PartNodeBodyPart::PartNodeBodyPart( partNode & n, const TQTextCodec * codec )
44  : KMail::Interface::BodyPart(), mPartNode( n ), mCodec( codec ),
45  mDefaultDisplay( KMail::Interface::BodyPart::None )
46 {}
47 
48 TQString KMail::PartNodeBodyPart::makeLink( const TQString & path ) const {
49  static const int utf8 = 106;
50  // FIXME: use a PRNG for the first arg, instead of a serial number
51  return TQString( "x-kmail:/bodypart/%1/%2/%3" )
52  .arg( serial++ ).arg( mPartNode.nodeId() )
53  .arg( KURL::encode_string_no_slash( path, utf8 ) );
54 }
55 
57  if ( mPartNode.type() != DwMime::kTypeText )
58  return TQString();
59  return mPartNode.msgPart().bodyToUnicode( mCodec );
60 }
61 
62 TQByteArray KMail::PartNodeBodyPart::asBinary() const {
63  return mPartNode.msgPart().bodyDecodedBinary();
64 }
65 
66 TQString KMail::PartNodeBodyPart::contentTypeParameter( const char * param ) const {
67  return mPartNode.contentTypeParameter( param );
68 }
69 
71  return mPartNode.msgPart().contentDescription();
72 }
73 
75  kdWarning( 5006 ) << "Sorry, not yet implemented: PartNodeBodyPart::contentDispositionParameter()" << endl;
76  return TQString();
77 }
78 
80  kdWarning( 5006 ) << "Sorry, not yet implemented: PartNodeBodyPart::contentDispositionParameter()" << endl;
81  return true;
82 }
83 
85  return mPartNode.bodyPartMemento( "__plugin__" );
86 }
87 
89  mPartNode.setBodyPartMemento( "__plugin__", memento );
90 }
91 
92 KMail::Interface::BodyPart::Display KMail::PartNodeBodyPart::defaultDisplay() const {
93  return mDefaultDisplay;
94 }
95 
96 void KMail::PartNodeBodyPart::setDefaultDisplay( KMail::Interface::BodyPart::Display d ){
97  mDefaultDisplay = d;
98 }
interface of classes that implement status for BodyPartFormatters.
Definition: bodypart.h:51
Interface::BodyPartMemento * memento() const
TQString contentDescription() const
TQString contentTypeParameter(const char *param) const
TQByteArray asBinary() const
TQString contentDispositionParameter(const char *param) const
BodyPart::Display defaultDisplay() const
void setBodyPartMemento(Interface::BodyPartMemento *memento)
TQString makeLink(const TQString &path) const
folderdiaquotatab.h
Definition: aboutdata.cpp:40