KMIME Library
kmime_message.h
00001 /* 00002 kmime_message.h 00003 00004 KMime, the KDE Internet mail/usenet news message library. 00005 Copyright (c) 2001 the KMime authors. 00006 See file AUTHORS for details 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00023 #ifndef __KMIME_MESSAGE_H__ 00024 #define __KMIME_MESSAGE_H__ 00025 00026 #include "kmime_export.h" 00027 #include "kmime_content.h" 00028 #include "kmime_headers.h" 00029 #include "boolflags.h" 00030 00031 #include <QtCore/QMetaType> 00032 00033 namespace boost { 00034 template <typename T> class shared_ptr; 00035 } 00036 00037 namespace KMime { 00038 00039 class MessagePrivate; 00040 00081 class KMIME_EXPORT Message : public Content 00082 { 00083 public: 00087 typedef QList<KMime::Message*> List; 00088 00092 typedef boost::shared_ptr<Message> Ptr; 00093 00097 Message(); 00098 00102 ~Message(); 00103 00104 /* reimpl */ 00105 virtual void parse(); 00106 00107 /* reimpl */ 00108 virtual void clear(); 00109 00110 /* reimpl */ 00111 virtual KDE_DEPRECATED KMime::Headers::Base *getHeaderByType( const char *type ); 00112 00113 /* reimpl */ 00114 virtual KMime::Headers::Base *headerByType( const char *type ); 00115 00116 /* reimpl */ 00117 virtual void setHeader( KMime::Headers::Base *h ); 00118 00119 /* reimpl */ 00120 virtual bool removeHeader( const char *type ); 00121 00122 // KDE5: Why are these virtual? 00127 virtual KMime::Headers::MessageID *messageID( bool create = true ); 00128 00133 virtual KMime::Headers::Subject *subject( bool create = true ); 00134 00139 virtual KMime::Headers::Date *date( bool create = true ); 00140 00145 virtual KMime::Headers::From *from( bool create = true ); 00146 00151 virtual KMime::Headers::Organization *organization( bool create = true ); 00152 00157 virtual KMime::Headers::ReplyTo *replyTo( bool create = true ); 00158 00163 virtual KMime::Headers::To *to( bool create = true ); 00164 00169 virtual KMime::Headers::Cc *cc( bool create = true ); 00170 00175 virtual KMime::Headers::Bcc *bcc( bool create = true ); 00176 00181 virtual KMime::Headers::References *references( bool create = true ); 00182 00187 virtual KMime::Headers::UserAgent *userAgent( bool create = true ); 00188 00193 virtual KMime::Headers::InReplyTo *inReplyTo( bool create = true ); 00194 00199 virtual KMime::Headers::Sender *sender( bool create = true ); 00200 00201 /* reimpl */ 00202 virtual bool isTopLevel() const; 00203 00213 Content* mainBodyPart( const QByteArray &type = QByteArray() ); 00214 00218 static QString mimeType(); 00219 00220 protected: 00221 /* reimpl */ 00222 virtual QByteArray assembleHeaders(); 00223 00224 // @cond PRIVATE 00225 explicit Message( MessagePrivate *d ); 00226 // @endcond 00227 00228 private: 00229 Q_DECLARE_PRIVATE( Message ) 00230 00231 }; // class Message 00232 00233 } // namespace KMime 00234 00235 #define KMIME_MESSAGE_METATYPE_DEFINED 1 00236 Q_DECLARE_METATYPE(KMime::Message*) 00237 00238 #endif // __KMIME_MESSAGE_H__