diff --git a/messageviewer/src/viewer/bodypartformatter.cpp b/messageviewer/src/viewer/bodypartformatter.cpp index b3344214..0e08b96c 100644 --- a/messageviewer/src/viewer/bodypartformatter.cpp +++ b/messageviewer/src/viewer/bodypartformatter.cpp @@ -1,300 +1,227 @@ /* -*- c++ -*- bodypartformatter.cpp This file is part of KMail, the KDE mail client. Copyright (c) 2003 Marc Mutz KMail is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. KMail is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #include "messageviewer_debug.h" #include "viewer/bodypartformatterfactory_p.h" #include "viewer/attachmentstrategy.h" #include "interfaces/bodypartformatter.h" #include "interfaces/bodypart.h" #include "viewer/objecttreeparser.h" #include "messagepart.h" #include using namespace MessageViewer; namespace { class AnyTypeBodyPartFormatter : public MessageViewer::Interface::BodyPartFormatter { static const AnyTypeBodyPartFormatter *self; public: Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE { qCDebug(MESSAGEVIEWER_LOG) << "Acting as a Interface::BodyPartFormatter!"; return AsIcon; } // unhide the overload with three arguments using MessageViewer::Interface::BodyPartFormatter::format; bool process(ObjectTreeParser *, KMime::Content *, ProcessResult &result) const { result.setNeverDisplayInline(true); return false; } static const MessageViewer::Interface::BodyPartFormatter *create() { if (!self) { self = new AnyTypeBodyPartFormatter(); } return self; } }; const AnyTypeBodyPartFormatter *AnyTypeBodyPartFormatter::self = 0; class ImageTypeBodyPartFormatter : public MessageViewer::Interface::BodyPartFormatter { static const ImageTypeBodyPartFormatter *self; public: Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE { return AsIcon; } // unhide the overload with three arguments using MessageViewer::Interface::BodyPartFormatter::format; bool process(ObjectTreeParser *, KMime::Content *, ProcessResult &result) const { result.setIsImage(true); return false; } static const MessageViewer::Interface::BodyPartFormatter *create() { if (!self) { self = new ImageTypeBodyPartFormatter(); } return self; } }; const ImageTypeBodyPartFormatter *ImageTypeBodyPartFormatter::self = 0; class MessageRfc822BodyPartFormatter : public MessageViewer::Interface::BodyPartFormatter { static const MessageRfc822BodyPartFormatter *self; public: MessagePart::Ptr process(Interface::BodyPart *) const; MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; using MessageViewer::Interface::BodyPartFormatter::format; static const MessageViewer::Interface::BodyPartFormatter *create(); }; const MessageRfc822BodyPartFormatter *MessageRfc822BodyPartFormatter::self; const MessageViewer::Interface::BodyPartFormatter *MessageRfc822BodyPartFormatter::create() { if (!self) { self = new MessageRfc822BodyPartFormatter(); } return self; } MessagePart::Ptr MessageRfc822BodyPartFormatter::process(Interface::BodyPart *part) const { const KMime::Message::Ptr message = part->content()->bodyAsMessage(); return MessagePart::Ptr(new EncapsulatedRfc822MessagePart(part->objectTreeParser(), part->content(), message)); } MessageViewer::Interface::BodyPartFormatter::Result MessageRfc822BodyPartFormatter::format(Interface::BodyPart *part, HtmlWriter *writer) const { Q_UNUSED(writer) const ObjectTreeParser *otp = part->objectTreeParser(); const MessagePart::Ptr mp = process(part); if (mp && !otp->attachmentStrategy()->inlineNestedMessages() && !otp->showOnlyOneMimePart()) { return Failed; } else { mp->html(true); return Ok; } } -class MultiPartSignedBodyPartFormatter - : public MessageViewer::Interface::BodyPartFormatter -{ -public: - MessagePart::Ptr process(const Interface::BodyPart &part) const; - MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; - using MessageViewer::Interface::BodyPartFormatter::format; - static const MessageViewer::Interface::BodyPartFormatter *create(); -private: - static const MultiPartSignedBodyPartFormatter *self; -}; - -const MultiPartSignedBodyPartFormatter *MultiPartSignedBodyPartFormatter::self; - -const MessageViewer::Interface::BodyPartFormatter *MultiPartSignedBodyPartFormatter::create() -{ - if (!self) { - self = new MultiPartSignedBodyPartFormatter(); - } - return self; -} - -MessagePart::Ptr MultiPartSignedBodyPartFormatter::process(const Interface::BodyPart &part) const -{ - return part.objectTreeParser()->processMultiPartSignedSubtype(part.content(), *part.processResult()); -} - -MessageViewer::Interface::BodyPartFormatter::Result MultiPartSignedBodyPartFormatter::format(Interface::BodyPart *part, HtmlWriter *writer) const -{ - Q_UNUSED(writer) - MessagePart::Ptr mp = process(*part); - if (!mp.isNull()) { - mp->html(false); - return Ok; - } - - return Failed; -} - -class MultiPartEncryptedBodyPartFormatter - : public MessageViewer::Interface::BodyPartFormatter -{ -public: - MessagePart::Ptr process(const Interface::BodyPart &part) const; - MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; - using MessageViewer::Interface::BodyPartFormatter::format; - static const MessageViewer::Interface::BodyPartFormatter *create(); -private: - static const MultiPartEncryptedBodyPartFormatter *self; -}; - -const MultiPartEncryptedBodyPartFormatter *MultiPartEncryptedBodyPartFormatter::self; - -const MessageViewer::Interface::BodyPartFormatter *MultiPartEncryptedBodyPartFormatter::create() -{ - if (!self) { - self = new MultiPartEncryptedBodyPartFormatter(); - } - return self; -} - -MessagePart::Ptr MultiPartEncryptedBodyPartFormatter::process(const Interface::BodyPart &part) const -{ - return part.objectTreeParser()->processMultiPartEncryptedSubtype(part.content(), *part.processResult()); -} - -MessageViewer::Interface::BodyPartFormatter::Result MultiPartEncryptedBodyPartFormatter::format(Interface::BodyPart *part, HtmlWriter *writer) const -{ - Q_UNUSED(writer) - MessagePart::Ptr mp = process(*part); - if (!mp.isNull()) { - mp->html(false); - return Ok; - } - - return Failed; -} - #define CREATE_BODY_PART_FORMATTER(subtype) \ class subtype##BodyPartFormatter \ : public MessageViewer::Interface::BodyPartFormatter \ { \ static const subtype##BodyPartFormatter *self; \ public: \ MessagePart::Ptr process(const Interface::BodyPart &part) const; \ MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; \ using MessageViewer::Interface::BodyPartFormatter::format; \ static const MessageViewer::Interface::BodyPartFormatter *create(); \ }; \ \ const subtype##BodyPartFormatter *subtype##BodyPartFormatter::self; \ \ const MessageViewer::Interface::BodyPartFormatter *subtype##BodyPartFormatter::create() { \ if ( !self ) { \ self = new subtype##BodyPartFormatter(); \ } \ return self; \ } \ MessagePart::Ptr subtype##BodyPartFormatter::process(const Interface::BodyPart &part) const { \ return part.objectTreeParser()->process##subtype##Subtype(part.content(), *part.processResult()); \ } \ \ MessageViewer::Interface::BodyPartFormatter::Result subtype##BodyPartFormatter::format(Interface::BodyPart *part, HtmlWriter *writer) const { \ Q_UNUSED(writer) \ MessagePart::Ptr mp = process(*part);\ if (!mp.isNull()) {\ mp->html(false);\ return Ok;\ }\ return Failed;\ } CREATE_BODY_PART_FORMATTER(TextPlain) +CREATE_BODY_PART_FORMATTER(Mailman) CREATE_BODY_PART_FORMATTER(TextHtml) CREATE_BODY_PART_FORMATTER(ApplicationPkcs7Mime) CREATE_BODY_PART_FORMATTER(MultiPartMixed) CREATE_BODY_PART_FORMATTER(MultiPartAlternative) +CREATE_BODY_PART_FORMATTER(MultiPartSigned) +CREATE_BODY_PART_FORMATTER(MultiPartEncrypted) typedef TextPlainBodyPartFormatter ApplicationPgpBodyPartFormatter; #undef CREATE_BODY_PART_FORMATTER } // anon namespace // FIXME: port some more BodyPartFormatters to Interface::BodyPartFormatters void BodyPartFormatterFactoryPrivate::messageviewer_create_builtin_bodypart_formatters(BodyPartFormatterFactoryPrivate::TypeRegistry *reg) { if (!reg) { return; } - (*reg)["application"]["octet-stream"] = AnyTypeBodyPartFormatter::create(); - (*reg)["application"]["pgp"] = ApplicationPgpBodyPartFormatter::create(); - (*reg)["application"]["pkcs7-mime"] = ApplicationPkcs7MimeBodyPartFormatter::create(); - (*reg)["application"]["x-pkcs7-mime"] = ApplicationPkcs7MimeBodyPartFormatter::create(); - (*reg)["application"]["*"] = AnyTypeBodyPartFormatter::create(); - - (*reg)["text"]["plain"] = TextPlainBodyPartFormatter::create(); - (*reg)["text"]["html"] = TextHtmlBodyPartFormatter::create(); - (*reg)["text"]["rtf"] = AnyTypeBodyPartFormatter::create(); - (*reg)["text"]["vcard"] = AnyTypeBodyPartFormatter::create(); - (*reg)["text"]["x-vcard"] = AnyTypeBodyPartFormatter::create(); - (*reg)["text"]["*"] = TextPlainBodyPartFormatter::create(); - - (*reg)["image"]["*"] = ImageTypeBodyPartFormatter::create(); - - (*reg)["message"]["rfc822"] = MessageRfc822BodyPartFormatter::create(); - (*reg)["message"]["*"] = AnyTypeBodyPartFormatter::create(); - - (*reg)["multipart"]["alternative"] = MultiPartAlternativeBodyPartFormatter::create(); - (*reg)["multipart"]["encrypted"] = MultiPartEncryptedBodyPartFormatter::create(); - (*reg)["multipart"]["signed"] = MultiPartSignedBodyPartFormatter::create(); - (*reg)["multipart"]["*"] = MultiPartMixedBodyPartFormatter::create(); - (*reg)["*"]["*"] = AnyTypeBodyPartFormatter::create(); + (*reg)["application"].insert(std::make_pair("octet-stream", AnyTypeBodyPartFormatter::create())); + (*reg)["application"].insert(std::make_pair("pgp", ApplicationPgpBodyPartFormatter::create())); + (*reg)["application"].insert(std::make_pair("pkcs7-mime", ApplicationPkcs7MimeBodyPartFormatter::create())); + (*reg)["application"].insert(std::make_pair("x-pkcs7-mime", ApplicationPkcs7MimeBodyPartFormatter::create())); + (*reg)["application"].insert(std::make_pair("*", AnyTypeBodyPartFormatter::create())); + + (*reg)["text"].insert(std::make_pair("html", TextHtmlBodyPartFormatter::create())); + (*reg)["text"].insert(std::make_pair("rtf", AnyTypeBodyPartFormatter::create())); + (*reg)["text"].insert(std::make_pair("vcard", AnyTypeBodyPartFormatter::create())); + (*reg)["text"].insert(std::make_pair("x-vcard", AnyTypeBodyPartFormatter::create())); + (*reg)["text"].insert(std::make_pair("plain", MailmanBodyPartFormatter::create())); + (*reg)["text"].insert(std::make_pair("plain", TextPlainBodyPartFormatter::create())); + (*reg)["text"].insert(std::make_pair("*", MailmanBodyPartFormatter::create())); + (*reg)["text"].insert(std::make_pair("*", TextPlainBodyPartFormatter::create())); + + (*reg)["image"].insert(std::make_pair("*", ImageTypeBodyPartFormatter::create())); + + (*reg)["message"].insert(std::make_pair("rfc822", MessageRfc822BodyPartFormatter::create())); + (*reg)["message"].insert(std::make_pair("*", AnyTypeBodyPartFormatter::create())); + + (*reg)["multipart"].insert(std::make_pair("alternative", MultiPartAlternativeBodyPartFormatter::create())); + (*reg)["multipart"].insert(std::make_pair("encrypted", MultiPartEncryptedBodyPartFormatter::create())); + (*reg)["multipart"].insert(std::make_pair("signed", MultiPartSignedBodyPartFormatter::create())); + (*reg)["multipart"].insert(std::make_pair("*", MultiPartMixedBodyPartFormatter::create())); + (*reg)["*"].insert(std::make_pair("*", AnyTypeBodyPartFormatter::create())); } diff --git a/messageviewer/src/viewer/bodypartformatterfactory.cpp b/messageviewer/src/viewer/bodypartformatterfactory.cpp index a4c7d2cf..fc5c1d34 100644 --- a/messageviewer/src/viewer/bodypartformatterfactory.cpp +++ b/messageviewer/src/viewer/bodypartformatterfactory.cpp @@ -1,213 +1,256 @@ /* bodypartformatterfactory.cpp This file is part of KMail, the KDE mail client. Copyright (c) 2004 Marc Mutz , Ingo Kloecker KMail is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. KMail is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #include "bodypartformatterfactory.h" #include "bodypartformatterfactory_p.h" #include "messageviewer_debug.h" #include "interfaces/bodypartformatter.h" #include "pluginloader.h" #include "urlhandlermanager.h" // KDE // Qt #include #include #include using namespace MessageViewer::BodyPartFormatterFactoryPrivate; using namespace MessageViewer; namespace { DEFINE_PLUGIN_LOADER(BodyPartFormatterPluginLoader, Interface::BodyPartFormatterPlugin, "create_bodypart_formatter_plugin", "messageviewer/plugins/bodypartformatter/") } BodyPartFormatterFactory *BodyPartFormatterFactory::mSelf = 0; const BodyPartFormatterFactory *BodyPartFormatterFactory::instance() { if (!mSelf) { mSelf = new BodyPartFormatterFactory(); } return mSelf; } BodyPartFormatterFactory::BodyPartFormatterFactory() { mSelf = this; } BodyPartFormatterFactory::~BodyPartFormatterFactory() { mSelf = 0; } static TypeRegistry *all = 0; static void insertBodyPartFormatter(const char *type, const char *subtype, const Interface::BodyPartFormatter *formatter) { if (!type || !*type || !subtype || !*subtype || !formatter || !all) { return; } TypeRegistry::iterator type_it = all->find(type); if (type_it == all->end()) { qCDebug(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: instantiating new Subtype Registry for \"" << type << "\""; type_it = all->insert(std::make_pair(type, SubtypeRegistry())).first; assert(type_it != all->end()); } SubtypeRegistry &subtype_reg = type_it->second; SubtypeRegistry::iterator subtype_it = subtype_reg.find(subtype); if (subtype_it != subtype_reg.end()) { qCDebug(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: overwriting previously registered formatter for \"" << type << "/" << subtype << "\""; - subtype_reg.erase(subtype_it); subtype_it = subtype_reg.end(); + qDebug() << "BodyPartFormatterFactory: overwriting previously registered formatter for \"" + << type << "/" << subtype << "\""; + //subtype_reg.erase(subtype_it); subtype_it = subtype_reg.end(); } subtype_reg.insert(std::make_pair(subtype, formatter)); } static void loadPlugins() { const BodyPartFormatterPluginLoader *pl = BodyPartFormatterPluginLoader::instance(); if (!pl) { qCWarning(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: cannot instantiate plugin loader!"; return; } const QStringList types = pl->types(); + qDebug() << "BodyPartFormatterFactory: found" << types.size() << "plugins."; qCDebug(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: found" << types.size() << "plugins."; for (QStringList::const_iterator it = types.begin(); it != types.end(); ++it) { const Interface::BodyPartFormatterPlugin *plugin = pl->createForName(*it); if (!plugin) { qCWarning(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: plugin" << *it << "is not valid!"; continue; } const Interface::BodyPartFormatter *bfp; for (int i = 0; (bfp = plugin->bodyPartFormatter(i)); ++i) { const char *type = plugin->type(i); if (!type || !*type) { qCWarning(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: plugin" << *it << "returned empty type specification for index" << i; break; } const char *subtype = plugin->subtype(i); if (!subtype || !*subtype) { qCWarning(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: plugin" << *it << "returned empty subtype specification for index" << i; break; } + qDebug() << "plugin for " << type << subtype; insertBodyPartFormatter(type, subtype, bfp); } const Interface::BodyPartURLHandler *handler; for (int i = 0; (handler = plugin->urlHandler(i)); ++i) { URLHandlerManager::instance()->registerHandler(handler); } } } static void setup() { if (!all) { all = new TypeRegistry(); messageviewer_create_builtin_bodypart_formatters(all); loadPlugins(); } } -const Interface::BodyPartFormatter *BodyPartFormatterFactory::createFor(const char *type, const char *subtype) const +const SubtypeRegistry &BodyPartFormatterFactory::subtypeRegistry(const char* type) const +{ + if (!type || !*type) { + type = "*"; //krazy:exclude=doublequote_chars + } + + setup(); + assert(all); + + if (all->empty()) { + return SubtypeRegistry(); + } + + TypeRegistry::const_iterator type_it = all->find(type); + if (type_it == all->end()) { + type_it = all->find("*"); + } + if (type_it == all->end()) { + return SubtypeRegistry(); + } + + const SubtypeRegistry &subtype_reg = type_it->second; + if (subtype_reg.empty()) { + return SubtypeRegistry(); + } + return subtype_reg; +} + + +SubtypeRegistry::const_iterator BodyPartFormatterFactory::createForIterator(const char* type, const char* subtype) const { if (!type || !*type) { type = "*"; //krazy:exclude=doublequote_chars } if (!subtype || !*subtype) { subtype = "*"; //krazy:exclude=doublequote_chars } setup(); assert(all); if (all->empty()) { - return 0; + return SubtypeRegistry::const_iterator(); } TypeRegistry::const_iterator type_it = all->find(type); if (type_it == all->end()) { type_it = all->find("*"); } if (type_it == all->end()) { - return 0; + return SubtypeRegistry::const_iterator(); } const SubtypeRegistry &subtype_reg = type_it->second; if (subtype_reg.empty()) { - return 0; + return SubtypeRegistry::const_iterator(); } SubtypeRegistry::const_iterator subtype_it = subtype_reg.find(subtype); + qDebug() << type << subtype << subtype_reg.size(); if (subtype_it == subtype_reg.end()) { subtype_it = subtype_reg.find("*"); } if (subtype_it == subtype_reg.end()) { - return 0; + return SubtypeRegistry::const_iterator(); } if (!(*subtype_it).second) { qCWarning(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: a null bodypart formatter sneaked in for \"" << type << "/" << subtype << "\"!"; } - return (*subtype_it).second; + return subtype_it; +} + +const Interface::BodyPartFormatter *BodyPartFormatterFactory::createFor(const char *type, const char *subtype) const +{ + const auto it = createForIterator(type, subtype); + if ((*it).second) { + return (*it).second; + } + return 0; } const Interface::BodyPartFormatter *BodyPartFormatterFactory::createFor(const QString &type, const QString &subtype) const { return createFor(type.toLatin1(), subtype.toLatin1()); } const Interface::BodyPartFormatter *BodyPartFormatterFactory::createFor(const QByteArray &type, const QByteArray &subtype) const { return createFor(type.constData(), subtype.constData()); } diff --git a/messageviewer/src/viewer/bodypartformatterfactory.h b/messageviewer/src/viewer/bodypartformatterfactory.h index b8480179..332b3c9e 100644 --- a/messageviewer/src/viewer/bodypartformatterfactory.h +++ b/messageviewer/src/viewer/bodypartformatterfactory.h @@ -1,76 +1,89 @@ /* bodypartformatterfactory.h This file is part of KMail, the KDE mail client. Copyright (c) 2004 Marc Mutz , Ingo Kloecker KMail is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. KMail is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #ifndef __MESSAGEVIEWER_BODYPARTFORMATTERFACTORY_H__ #define __MESSAGEVIEWER_BODYPARTFORMATTERFACTORY_H__ +#include #include class QString; namespace MessageViewer { namespace Interface { class BodyPartFormatter; } +struct ltstr { + bool operator()(const char *s1, const char *s2) const + { + return qstricmp(s1, s2) < 0; + } +}; + +typedef std::multimap SubtypeRegistry; + class BodyPartFormatterFactory { class gcc_shut_up; friend class BodyPartFormatterFactory::gcc_shut_up; public: ~BodyPartFormatterFactory(); static const BodyPartFormatterFactory *instance(); + SubtypeRegistry::const_iterator createForIterator(const char *type, const char *subtype) const; + const SubtypeRegistry &subtypeRegistry(const char *type) const; + const Interface::BodyPartFormatter *createFor(const char *type, const char *subtype) const; const Interface::BodyPartFormatter *createFor(const QString &type, const QString &subtype) const; const Interface::BodyPartFormatter *createFor(const QByteArray &type, const QByteArray &subtype) const; // // Only boring stuff below: // private: BodyPartFormatterFactory(); static BodyPartFormatterFactory *mSelf; private: // disabled const BodyPartFormatterFactory &operator=(const BodyPartFormatterFactory &); BodyPartFormatterFactory(const BodyPartFormatterFactory &); }; } #endif // __MESSAGEVIEWER_BODYPARTFORMATTERFACTORY_H__ diff --git a/messageviewer/src/viewer/bodypartformatterfactory_p.h b/messageviewer/src/viewer/bodypartformatterfactory_p.h index 27083d31..22360a98 100644 --- a/messageviewer/src/viewer/bodypartformatterfactory_p.h +++ b/messageviewer/src/viewer/bodypartformatterfactory_p.h @@ -1,69 +1,57 @@ /* -*- mode: C++; c-file-style: "gnu" -*- bodypartformatterfactory.h This file is part of KMail, the KDE mail client. Copyright (c) 2004 Marc Mutz , Ingo Kloecker KMail is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. KMail is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #ifndef __MESSAGEVIEWER_BODYPARTFORMATTERFACTORY_P_H__ #define __MESSAGEVIEWER_BODYPARTFORMATTERFACTORY_P_H__ +#include "bodypartformatterfactory.h" + #include -#include -namespace MessageViewer -{ -namespace Interface -{ -class BodyPartFormatter; -} -} +#include namespace MessageViewer { namespace BodyPartFormatterFactoryPrivate { -struct ltstr { - bool operator()(const char *s1, const char *s2) const - { - return qstricmp(s1, s2) < 0; - } -}; -typedef std::map SubtypeRegistry; -typedef std::map TypeRegistry; +typedef std::map TypeRegistry; // defined in bodypartformatters.cpp extern void messageviewer_create_builtin_bodypart_formatters(TypeRegistry *); } } #endif // __MESSAGEVIEWER_BODYPARTFORMATTERFACTORY_P_H__