Support writing empty color.

This commit is contained in:
Felix Geyer 2011-06-29 16:33:23 +02:00
parent 2adf3770b0
commit fd9685037b

View File

@ -386,6 +386,8 @@ void KeePass2XmlWriter::writeBool(const QString& qualifiedName, bool b)
void KeePass2XmlWriter::writeDateTime(const QString& qualifiedName, const QDateTime& dateTime)
{
Q_ASSERT(dateTime.isValid());
writeString(qualifiedName, dateTime.toUTC().toString(Qt::ISODate).append('Z'));
}
@ -421,9 +423,13 @@ void KeePass2XmlWriter::writeBinary(const QString& qualifiedName, const QByteArr
void KeePass2XmlWriter::writeColor(const QString& qualifiedName, const QColor& color)
{
QString colorStr = QString("#%1%2%3").arg(colorPartToString(color.red()))
.arg(colorPartToString(color.green()))
.arg(colorPartToString(color.blue()));
QString colorStr;
if (color.isValid()) {
colorStr = QString("#%1%2%3").arg(colorPartToString(color.red()))
.arg(colorPartToString(color.green()))
.arg(colorPartToString(color.blue()));
}
writeString(qualifiedName, colorStr);
}