File indexing completed on 2024-12-22 04:57:02

0001 /*
0002     SPDX-FileCopyrightText: 2015-2016 Krzysztof Nowicki <krissn@op.pl>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "ewsitemshape.h"
0008 
0009 void EwsItemShape::write(QXmlStreamWriter &writer) const
0010 {
0011     writer.writeStartElement(ewsMsgNsUri, QStringLiteral("ItemShape"));
0012 
0013     // Write the base shape
0014     writeBaseShape(writer);
0015 
0016     // Write the IncludeMimeContent element (if applicable)
0017     if (mFlags.testFlag(IncludeMimeContent)) {
0018         writer.writeTextElement(ewsTypeNsUri, QStringLiteral("IncludeMimeContent"), QStringLiteral("true"));
0019     }
0020 
0021     // Write the BodyType element
0022     if (mBodyType != BodyNone) {
0023         QString bodyTypeText;
0024 
0025         switch (mBodyType) {
0026         case BodyHtml:
0027             bodyTypeText = QStringLiteral("HTML");
0028             break;
0029         case BodyText:
0030             bodyTypeText = QStringLiteral("Text");
0031             break;
0032         default:
0033             // case BodyBest:
0034             bodyTypeText = QStringLiteral("Best");
0035             break;
0036         }
0037         writer.writeTextElement(ewsTypeNsUri, QStringLiteral("BodyType"), bodyTypeText);
0038     }
0039 
0040     // Write the FilterHtmlContent element (if applicable)
0041     if (mBodyType == BodyHtml && mFlags.testFlag(FilterHtmlContent)) {
0042         writer.writeTextElement(ewsTypeNsUri, QStringLiteral("FilterHtmlContent"), QStringLiteral("true"));
0043     }
0044 
0045     // Write the ConvertHtmlCodePageToUTF8 element (if applicable)
0046     if (mBodyType == BodyHtml && mFlags.testFlag(ConvertHtmlToUtf8)) {
0047         writer.writeTextElement(ewsTypeNsUri, QStringLiteral("ConvertHtmlCodePageToUTF8"), QStringLiteral("true"));
0048     }
0049 
0050     // Write properties (if any)
0051     writeProperties(writer);
0052 
0053     writer.writeEndElement();
0054 }