Commit 8870c646 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

run git clang-format

parent e54e855f
......@@ -9,9 +9,9 @@
#include "config-ktnef-tests.h"
#include <ktnef/ktnefparser.h>
#include <ktnef/ktnefmessage.h>
#include <ktnef/ktnefattach.h>
#include <ktnef/ktnefmessage.h>
#include <ktnef/ktnefparser.h>
#include <QString>
#include <QTest>
......@@ -94,10 +94,9 @@ void ParserTest::testUmlautAttachmentFilenames()
KTNEFMessage *msg = parser.message();
QVERIFY(msg != nullptr);
QList<KTNEFAttach*> atts = msg->attachmentList();
QList<KTNEFAttach *> atts = msg->attachmentList();
QVERIFY(atts.count() == 1);
KTNEFAttach *att = atts.first();
QCOMPARE(att->fileName(), QString::fromUtf8("döcument.pdf"));
}
......@@ -20,16 +20,16 @@
*/
#include "formatter.h"
#include "ktnefparser.h"
#include "ktnefmessage.h"
#include "ktnefdefs.h"
#include "ktnefmessage.h"
#include "ktnefparser.h"
#include <kcontacts/phonenumber.h>
#include <kcontacts/vcardconverter.h>
#include <KCalUtils/IncidenceFormatter>
#include <KCalendarCore/Calendar>
#include <KCalendarCore/ICalFormat>
#include <KCalUtils/IncidenceFormatter>
#include <KLocalizedString>
......@@ -47,14 +47,12 @@ using namespace KTnef;
//-----------------------------------------------------------------------------
//@cond IGNORE
static QString stringProp(KTNEFMessage *tnefMsg, quint32 key,
const QString &fallback = QString())
static QString stringProp(KTNEFMessage *tnefMsg, quint32 key, const QString &fallback = QString())
{
return tnefMsg->findProp(key < 0x10000 ? key & 0xFFFF : key >> 16, fallback);
}
static QString sNamedProp(KTNEFMessage *tnefMsg, const QString &name,
const QString &fallback = QString())
static QString sNamedProp(KTNEFMessage *tnefMsg, const QString &name, const QString &fallback = QString())
{
return tnefMsg->findNamedProp(name, fallback);
}
......@@ -77,8 +75,8 @@ static QDateTime pureISOToLocalQDateTime(const QString &dtStr)
// correct for GMT ( == Zulu time == UTC )
if (dtStr.at(dtStr.length() - 1) == QLatin1Char('Z')) {
//dT = dT.addSecs( 60 * KRFCDate::localUTCOffset() );
//localUTCOffset( dT ) );
// dT = dT.addSecs( 60 * KRFCDate::localUTCOffset() );
// localUTCOffset( dT ) );
dT = dT.toLocalTime();
}
return dT;
......@@ -100,7 +98,7 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
if (parser.openDevice(&buf)) {
KTNEFMessage *tnefMsg = parser.message();
//QMap<int,KTNEFProperty*> props = parser.message()->properties();
// QMap<int,KTNEFProperty*> props = parser.message()->properties();
// Everything depends from property PR_MESSAGE_CLASS
// (this is added by KTNEFParser):
......@@ -139,14 +137,13 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
prodID += QLatin1String("VERSION:2.0\n");
calFormat.setApplication(QStringLiteral("Outlook"), prodID);
//iTIPMethod method;
// iTIPMethod method;
if (bCompatMethodRequest) {
//method = iTIPRequest;
// method = iTIPRequest;
} else if (bCompatMethodCancled) {
//method = iTIPCancel;
} else if (bCompatMethodAccepted || bCompatMethodAcceptedCond ||
bCompatMethodDeclined) {
//method = iTIPReply;
// method = iTIPCancel;
} else if (bCompatMethodAccepted || bCompatMethodAcceptedCond || bCompatMethodDeclined) {
// method = iTIPReply;
bIsReply = true;
} else {
// pending(khz): verify whether "0x0c17" is the right tag ???
......@@ -160,11 +157,11 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
if (tnefMsg->findProp(0x0c17) == QLatin1Char('1')) {
bIsReply = true;
}
//method = iTIPRequest;
// method = iTIPRequest;
}
/// ### FIXME Need to get this attribute written
//ScheduleMessage schedMsg( event, method, ScheduleMessage::Unknown );
// ScheduleMessage schedMsg( event, method, ScheduleMessage::Unknown );
QString sSenderSearchKeyEmail(tnefMsg->findProp(0x0C1D));
if (sSenderSearchKeyEmail.isEmpty()) {
......@@ -229,7 +226,7 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
event->addAttendee(attendee);
}
}
s = tnefMsg->findProp(0x3ff8); // look for organizer property
s = tnefMsg->findProp(0x3ff8); // look for organizer property
if (s.isEmpty() && !bIsReply) {
s = sSenderSearchKeyEmail;
}
......@@ -242,11 +239,10 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
if (!dt.isValid()) {
dt = tnefMsg->property(0x0060).toDateTime();
}
event->setDtStart(dt); // ## Format??
event->setDtStart(dt); // ## Format??
dt = tnefMsg->property(0x819c).toDateTime();
if (!dt.isValid())
{
if (!dt.isValid()) {
dt = tnefMsg->property(0x0061).toDateTime();
}
event->setDtEnd(dt);
......@@ -254,8 +250,8 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
s = tnefMsg->findProp(0x810d);
event->setLocation(s);
// is it OK to set this to OPAQUE always ??
//vPart += "TRANSP:OPAQUE\n"; ###FIXME, portme!
//vPart += "SEQUENCE:0\n";
// vPart += "TRANSP:OPAQUE\n"; ###FIXME, portme!
// vPart += "SEQUENCE:0\n";
// is "0x0023" OK - or should we look for "0x0003" ??
s = tnefMsg->findProp(0x0062);
......@@ -287,13 +283,9 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
event->setPriority(s.toInt());
// is reminder flag set ?
if (!tnefMsg->findProp(0x8503).isEmpty()) {
Alarm::Ptr alarm(new Alarm(event.data())); // TODO: fix when KCalendarCore::Alarm is fixed
QDateTime highNoonTime =
pureISOToLocalQDateTime(tnefMsg->findProp(0x8502).
remove(QLatin1Char('-')).remove(QLatin1Char(':')));
QDateTime wakeMeUpTime =
pureISOToLocalQDateTime(tnefMsg->findProp(0x8560, QString()).
remove(QLatin1Char('-')).remove(QLatin1Char(':')));
Alarm::Ptr alarm(new Alarm(event.data())); // TODO: fix when KCalendarCore::Alarm is fixed
QDateTime highNoonTime = pureISOToLocalQDateTime(tnefMsg->findProp(0x8502).remove(QLatin1Char('-')).remove(QLatin1Char(':')));
QDateTime wakeMeUpTime = pureISOToLocalQDateTime(tnefMsg->findProp(0x8560, QString()).remove(QLatin1Char('-')).remove(QLatin1Char(':')));
alarm->setTime(wakeMeUpTime);
if (highNoonTime.isValid() && wakeMeUpTime.isValid()) {
......@@ -308,12 +300,12 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
// so we always set 'DISPLAY' (no sounds, no images...)
event->addAlarm(alarm);
}
//ensure we have a uid for this event
// ensure we have a uid for this event
if (event->uid().isEmpty()) {
event->setUid(CalFormat::createUniqueId());
}
cal->addEvent(event);
//bOk = true;
// bOk = true;
// we finished composing a vCal
} else if (bCompatClassNote || QLatin1String("IPM.CONTACT") == msgClass) {
addressee.setUid(stringProp(tnefMsg, attMSGID));
......@@ -321,23 +313,17 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
addressee.insertEmail(sNamedProp(tnefMsg, QStringLiteral(MAPI_TAG_CONTACT_EMAIL1EMAILADDRESS)), true);
addressee.insertEmail(sNamedProp(tnefMsg, QStringLiteral(MAPI_TAG_CONTACT_EMAIL2EMAILADDRESS)), false);
addressee.insertEmail(sNamedProp(tnefMsg, QStringLiteral(MAPI_TAG_CONTACT_EMAIL3EMAILADDRESS)), false);
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-IMAddress"),
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"),
QStringLiteral("X-IMAddress"),
sNamedProp(tnefMsg, QStringLiteral(MAPI_TAG_CONTACT_IMADDRESS)));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-SpousesName"),
stringProp(tnefMsg, MAPI_TAG_PR_SPOUSE_NAME));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-ManagersName"),
stringProp(tnefMsg, MAPI_TAG_PR_MANAGER_NAME));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-AssistantsName"),
stringProp(tnefMsg, MAPI_TAG_PR_ASSISTANT));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Department"),
stringProp(tnefMsg, MAPI_TAG_PR_DEPARTMENT_NAME));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Office"),
stringProp(tnefMsg, MAPI_TAG_PR_OFFICE_LOCATION));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Profession"),
stringProp(tnefMsg, MAPI_TAG_PR_PROFESSION));
QString s = tnefMsg->findProp(MAPI_TAG_PR_WEDDING_ANNIVERSARY).
remove(QLatin1Char('-')).remove(QLatin1Char(':'));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-SpousesName"), stringProp(tnefMsg, MAPI_TAG_PR_SPOUSE_NAME));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-ManagersName"), stringProp(tnefMsg, MAPI_TAG_PR_MANAGER_NAME));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-AssistantsName"), stringProp(tnefMsg, MAPI_TAG_PR_ASSISTANT));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Department"), stringProp(tnefMsg, MAPI_TAG_PR_DEPARTMENT_NAME));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Office"), stringProp(tnefMsg, MAPI_TAG_PR_OFFICE_LOCATION));
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Profession"), stringProp(tnefMsg, MAPI_TAG_PR_PROFESSION));
QString s = tnefMsg->findProp(MAPI_TAG_PR_WEDDING_ANNIVERSARY).remove(QLatin1Char('-')).remove(QLatin1Char(':'));
if (!s.isEmpty()) {
addressee.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("X-Anniversary"), s);
}
......@@ -398,30 +384,23 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
QString nr;
nr = stringProp(tnefMsg, MAPI_TAG_PR_HOME_TELEPHONE_NUMBER);
addressee.insertPhoneNumber(
KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Home));
addressee.insertPhoneNumber(KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Home));
nr = stringProp(tnefMsg, MAPI_TAG_PR_BUSINESS_TELEPHONE_NUMBER);
addressee.insertPhoneNumber(
KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Work));
addressee.insertPhoneNumber(KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Work));
nr = stringProp(tnefMsg, MAPI_TAG_PR_MOBILE_TELEPHONE_NUMBER);
addressee.insertPhoneNumber(
KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Cell));
addressee.insertPhoneNumber(KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Cell));
nr = stringProp(tnefMsg, MAPI_TAG_PR_HOME_FAX_NUMBER);
addressee.insertPhoneNumber(
KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Fax | KContacts::PhoneNumber::Home));
addressee.insertPhoneNumber(KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Fax | KContacts::PhoneNumber::Home));
nr = stringProp(tnefMsg, MAPI_TAG_PR_BUSINESS_FAX_NUMBER);
addressee.insertPhoneNumber(
KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Fax | KContacts::PhoneNumber::Work));
addressee.insertPhoneNumber(KContacts::PhoneNumber(nr, KContacts::PhoneNumber::Fax | KContacts::PhoneNumber::Work));
s = tnefMsg->findProp(MAPI_TAG_PR_BIRTHDAY).
remove(QLatin1Char('-')).remove(QLatin1Char(':'));
s = tnefMsg->findProp(MAPI_TAG_PR_BIRTHDAY).remove(QLatin1Char('-')).remove(QLatin1Char(':'));
if (!s.isEmpty()) {
addressee.setBirthday(QDateTime::fromString(s));
}
//bOk = (!addressee.isEmpty());
// bOk = (!addressee.isEmpty());
} else if (QLatin1String("IPM.NOTE") == msgClass) {
} // else if ... and so on ...
}
}
......@@ -438,9 +417,7 @@ QString KTnef::msTNEFToVPart(const QByteArray &tnef)
return QString::fromUtf8(converter.createVCard(addressee));
}
QString KTnef::formatTNEFInvitation(const QByteArray &tnef,
const MemoryCalendar::Ptr &cal,
KCalUtils::InvitationFormatterHelper *h)
QString KTnef::formatTNEFInvitation(const QByteArray &tnef, const MemoryCalendar::Ptr &cal, KCalUtils::InvitationFormatterHelper *h)
{
const QString vPart = msTNEFToVPart(tnef);
QString iCal = KCalUtils::IncidenceFormatter::formatICalInvitation(vPart, cal, h);
......
......@@ -20,8 +20,8 @@
#ifndef KTNEF_FORMATTER_H
#define KTNEF_FORMATTER_H
#include <QString>
#include <KCalendarCore/MemoryCalendar>
#include <QString>
#include "ktnef_export.h"
......@@ -32,7 +32,6 @@ class InvitationFormatterHelper;
namespace KTnef
{
/**
Formats a @acronym TNEF attachment to an HTML mail.
......@@ -41,8 +40,8 @@ namespace KTnef
@param h is a pointer to a InvitationFormatterHelp object.
*/
Q_REQUIRED_RESULT KTNEF_EXPORT QString formatTNEFInvitation(const QByteArray &tnef,
const KCalendarCore::MemoryCalendar::Ptr &cal,
KCalUtils::InvitationFormatterHelper *h);
const KCalendarCore::MemoryCalendar::Ptr &cal,
KCalUtils::InvitationFormatterHelper *h);
/**
Transforms a @acronym TNEF attachment to an iCal or vCard.
......
......@@ -28,12 +28,12 @@ using namespace KTnef;
class KTnef::KTNEFAttach::AttachPrivate
{
public:
int state_;
int size_;
int offset_;
int displaysize_;
int state_;
int size_;
int offset_;
int displaysize_;
QString name_;
int index_;
int index_;
QString filename_;
QString displayname_;
QString mimetag_;
......@@ -41,7 +41,8 @@ public:
};
//@endcond
KTNEFAttach::KTNEFAttach() : d(new KTnef::KTNEFAttach::AttachPrivate)
KTNEFAttach::KTNEFAttach()
: d(new KTnef::KTNEFAttach::AttachPrivate)
{
d->state_ = Unparsed;
d->offset_ = -1;
......
......@@ -20,8 +20,8 @@
#include <QString>
#include "ktnefpropertyset.h"
#include "ktnef_export.h"
#include "ktnefpropertyset.h"
namespace KTnef
{
......@@ -30,7 +30,6 @@ class KTNEFProperty;
namespace KTnef
{
/**
* @brief
* Represents a @acronym TNEF attachment.
......@@ -42,10 +41,10 @@ public:
* The different attachment parsed states.
*/
enum ParseState {
Unparsed = 0x0000, /**< Unparsed */
Unparsed = 0x0000, /**< Unparsed */
TitleParsed = 0x0001, /**< The title is parsed */
DataParsed = 0x0002, /**< The data is parsed */
InfoParsed = 0x0004 /**< The info is parsed */
DataParsed = 0x0002, /**< The data is parsed */
InfoParsed = 0x0004 /**< The info is parsed */
};
/**
......
This diff is collapsed.
......@@ -32,7 +32,9 @@ using namespace KTnef;
class KTnef::KTNEFMessage::MessagePrivate
{
public:
MessagePrivate() {}
MessagePrivate()
{
}
~MessagePrivate();
void clearAttachments();
......@@ -53,7 +55,8 @@ void KTNEFMessage::MessagePrivate::clearAttachments()
}
//@endcond
KTNEFMessage::KTNEFMessage() : d(new KTnef::KTNEFMessage::MessagePrivate)
KTNEFMessage::KTNEFMessage()
: d(new KTnef::KTNEFMessage::MessagePrivate)
{
}
......@@ -98,8 +101,7 @@ QString KTNEFMessage::rtfString() const
QByteArray rtf;
QByteArray propArray(prop.toByteArray());
QBuffer input(&propArray), output(&rtf);
if (input.open(QIODevice::ReadOnly) &&
output.open(QIODevice::WriteOnly)) {
if (input.open(QIODevice::ReadOnly) && output.open(QIODevice::WriteOnly)) {
if (KTnef::lzfu_decompress(&input, &output) == 0) {
qWarning() << "Error when decompress data";
}
......
......@@ -20,8 +20,8 @@
#include <QList>
#include "ktnefpropertyset.h"
#include "ktnef_export.h"
#include "ktnefpropertyset.h"
namespace KTnef
{
......@@ -30,7 +30,6 @@ class KTNEFAttach;
namespace KTnef
{
/**
* @brief
* Represents a @acronym TNEF message.
......
This diff is collapsed.
......@@ -18,9 +18,9 @@
#ifndef KTNEFPARSER_H
#define KTNEFPARSER_H
#include <QString>
#include <QIODevice>
#include "ktnef_export.h"
#include <QIODevice>
#include <QString>
namespace KTnef
{
......@@ -29,7 +29,6 @@ class KTNEFMessage;
namespace KTnef
{
/**
* @brief
* Provides an @acronym TNEF parser.
......
......@@ -18,7 +18,6 @@
#include "ktnefproperty.h"
#include "mapi.h"
#include <ctype.h>
using namespace KTnef;
......@@ -37,8 +36,7 @@ KTNEFProperty::KTNEFProperty()
{
}
KTNEFProperty::KTNEFProperty(int key_, int type_, const QVariant &value_,
const QVariant &name_)
KTNEFProperty::KTNEFProperty(int key_, int type_, const QVariant &value_, const QVariant &name_)
: d(new KTNEFPropertyPrivate)
{
d->_key = key_;
......@@ -88,14 +86,14 @@ QString KTNEFProperty::formatValue(const QVariant &value, bool beautify)
QByteArray arr = value.toByteArray();
bool printable = true;
for (int i = qMin(arr.size(), 8) - 1; i >= 0 && printable; i--) {
printable = (isprint(arr[ i ]) != 0);
printable = (isprint(arr[i]) != 0);
}
if (!printable) {
QString s;
int i;
int txtCount = beautify ? qMin(arr.size(), 32) : arr.size();
for (i = 0; i < txtCount; ++i) {
s.append(QString::asprintf("%02X", (uchar)arr[ i ]));
s.append(QString::asprintf("%02X", (uchar)arr[i]));
if (beautify) {
s.append(QLatin1Char(' '));
}
......@@ -106,7 +104,7 @@ QString KTNEFProperty::formatValue(const QVariant &value, bool beautify)
return s;
}
}
//else if ( value.type() == QVariant::DateTime )
// else if ( value.type() == QVariant::DateTime )
// return value.toDateTime().toString();
return value.toString();
}
......
......@@ -18,14 +18,13 @@
#ifndef KTNEFPROPERTY_H
#define KTNEFPROPERTY_H
#include <QVariant>
#include <QString>
#include <QVariant>
class KTNEFPropertyPrivate;
#include "ktnef_export.h"
namespace KTnef
{
/**
* @brief
* Interface for setting @acronym MAPI properties.
......@@ -37,16 +36,16 @@ public:
* The different @acronym MAPI types.
*/
enum MAPIType {
UInt16 = 0x0002, /**< 16-bit unsigned integer */
ULong = 0x0003, /**< unsigned long integer */
Float = 0x0004, /**< single precision floating point */
Double = 0x0005, /**< double precision floating point */
UInt16 = 0x0002, /**< 16-bit unsigned integer */
ULong = 0x0003, /**< unsigned long integer */
Float = 0x0004, /**< single precision floating point */
Double = 0x0005, /**< double precision floating point */
Boolean = 0x000B, /**< a boolean value */
Object = 0x000D, /**< an object */
Time = 0x0040, /**< a time value */
Object = 0x000D, /**< an object */
Time = 0x0040, /**< a time value */
String8 = 0x001E, /**< a string of 8 characters */
UString = 0x001F, /**< a string of characters */
Binary = 0x0102 /**< a binary value */
Binary = 0x0102 /**< a binary value */
};
/**
......@@ -62,8 +61,7 @@ public:
* @param value_ is the property value.
* @param name_ is the property name.
*/
KTNEFProperty(int key_, int type_, const QVariant &value_,
const QVariant &name_ = QVariant());
KTNEFProperty(int key_, int type_, const QVariant &value_, const QVariant &name_ = QVariant());
/**
* Constructs a @acronym TNEF property with settings from another property.
......
......@@ -43,37 +43,31 @@ KTNEFPropertySet::~KTNEFPropertySet()
delete d;
}
void KTNEFPropertySet::addProperty(int key, int type, const QVariant &value,
const QVariant &name, bool overwrite)
void KTNEFPropertySet::addProperty(int key, int type, const QVariant &value, const QVariant &name, bool overwrite)
{
QMap<int, KTNEFProperty *>::ConstIterator it = d->properties_.constFind(key);
if (it != d->properties_.constEnd()) {
if (overwrite) {
delete(*it);
delete (*it);
} else {
return;
}
}
auto *p = new KTNEFProperty(key, type, value, name);
d->properties_[ p->key() ] = p;
d->properties_[p->key()] = p;
}
QString KTNEFPropertySet::findProp(int key, const QString &fallback,
bool upper) const
QString KTNEFPropertySet::findProp(int key, const QString &fallback, bool upper) const
{
QMap<int, KTNEFProperty *>::Iterator it = d->properties_.find(key);
if (d->properties_.end() != it) {
return upper ?
KTNEFProperty::formatValue((*it)->value(), false).toUpper() :
KTNEFProperty::formatValue((*it)->value(), false);
return upper ? KTNEFProperty::formatValue((*it)->value(), false).toUpper() : KTNEFProperty::formatValue((*it)->value(), false);
} else {
return fallback;
}
}
QString KTNEFPropertySet::findNamedProp(const QString &name,
const QString &fallback,
bool upper) const
QString KTNEFPropertySet::findNamedProp(const QString &name, const QString &fallback, bool upper) const
{
for (QMap<int, KTNEFProperty *>::Iterator it = d->properties_.begin(), protEnd = d->properties_.end(); it != protEnd; ++it) {
if ((*it)->name().isValid()) {
......@@ -128,34 +122,29 @@ QVariant KTNEFPropertySet::property(int key) const
void KTNEFPropertySet::clear(bool deleteAll)
{
if (deleteAll) {
for (QMap<int, KTNEFProperty *>::ConstIterator it = d->properties_.constBegin();
it != d->properties_.constEnd();
++it) {
delete(*it);
for (QMap<int, KTNEFProperty *>::ConstIterator it = d->properties_.constBegin(); it != d->properties_.constEnd(); ++it) {
delete (*it);
}
for (QMap<int, KTNEFProperty *>::ConstIterator it = d->attributes_.constBegin();
it != d->attributes_.constEnd();
++it) {
delete(*it);
for (QMap<int, KTNEFProperty *>::ConstIterator it = d->attributes_.constBegin(); it != d->attributes_.constEnd(); ++it) {
delete (*it);
}
}
d->properties_.clear();
d->attributes_.clear();
}
void KTNEFPropertySet::addAttribute(int key, int type, const QVariant &value,
bool overwrite)
void KTNEFPropertySet::addAttribute(int key, int type, const QVariant &value, bool overwrite)
{
QMap<int, KTNEFProperty *>::ConstIterator it = d->attributes_.constFind(key);
if (it != d->attributes_.constEnd()) {
if (overwrite) {
delete(*it);
delete (*it);
} else {
return;
}
}
KTNEFProperty *p = new KTNEFProperty(key, type, value, QVariant());
d->attributes_[ p->key() ] = p;
d->attributes_[p->key()] = p;
}
QMap<int, KTNEFProperty *> &KTNEFPropertySet::attributes()
......
......@@ -30,7 +30,6 @@ class KTNEFProperty;
namespace KTnef
{
/**
* @brief
* Interface for setting @acronym MAPI properties and @acronym TNEF attributes.
......@@ -57,8 +56,7 @@ public:
@param name is the property name.
@param overwrite if true, then remove the property if it already exists.
*/
void addProperty(int key, int type, const QVariant &value,
const QVariant &name = QVariant(), bool overwrite = false);
void addProperty(int key, int type, const QVariant &value, const QVariant &name = QVariant(), bool overwrite = false);
/**
Finds a property by @p key, returning a formatted value.
......@@ -71,8 +69,7 @@ public:
@return a formatted value string.