Changeset View
Changeset View
Standalone View
Standalone View
kolabformat/v2helpers.h
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Parse XML, create KCalCore container and extract attachments | * Parse XML, create KCalCore container and extract attachments | ||||
*/ | */ | ||||
template <typename KCalPtr, typename Container> | template <typename KCalPtr, typename Container> | ||||
static KCalPtr fromXML(const QByteArray &xmlData, QStringList &attachments) | static KCalPtr fromXML(const QByteArray &xmlData, QStringList &attachments) | ||||
{ | { | ||||
const QDomDocument xmlDoc = KolabV2::KolabBase::loadDocument( QString::fromUtf8(xmlData) ); //TODO extract function from V2 format | const QDomDocument xmlDoc = KolabV2::KolabBase::loadDocument( QString::fromUtf8(xmlData) ); //TODO extract function from V2 format | ||||
if ( xmlDoc.isNull() ) { | if ( xmlDoc.isNull() ) { | ||||
Critical() << "Failed to read the xml document"; | Error() << "Failed to read the xml document"; | ||||
return KCalPtr(); | return KCalPtr(); | ||||
} | } | ||||
const KCalPtr i = Container::fromXml( xmlDoc, QString() ); //For parsing we don't need the timezone, so we don't set one | const KCalPtr i = Container::fromXml( xmlDoc, QString() ); //For parsing we don't need the timezone, so we don't set one | ||||
Q_ASSERT ( i ); | Q_ASSERT ( i ); | ||||
QDomNodeList nodes = xmlDoc.elementsByTagName("inline-attachment"); | QDomNodeList nodes = xmlDoc.elementsByTagName("inline-attachment"); | ||||
for (int i = 0; i < nodes.size(); i++ ) { | for (int i = 0; i < nodes.size(); i++ ) { | ||||
attachments.append(nodes.at(i).toElement().text()); | attachments.append(nodes.at(i).toElement().text()); | ||||
} | } | ||||
Show All 40 Lines |