Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 06a5ad3a authored by Laurent Montel's avatar Laurent Montel 😁

in vcard4.0 ANNIVERSARY exists

parent 5b020772
......@@ -432,7 +432,7 @@ QByteArray VCardTool::createVCards( const Addressee::List &list,
}
// X-
const QStringList customs = ( *addrIt ).customs();
const QStringList customs = ( *addrIt ).customs();
for ( strIt = customs.begin(); strIt != customs.end(); ++strIt ) {
QString identifier = QLatin1String( "X-" ) +
( *strIt ).left( ( *strIt ).indexOf( QLatin1Char( ':' ) ) );
......@@ -470,12 +470,22 @@ QByteArray VCardTool::createVCards( const Addressee::List &list,
}
}
VCardLine line( identifier, value );
if ( version == VCard::v2_1 && needsEncoding( value ) ) {
line.addParameter( QLatin1String( "charset" ), QLatin1String( "UTF-8" ) );
line.addParameter( QLatin1String( "encoding" ), QLatin1String( "QUOTED-PRINTABLE" ) );
if (identifier.toLower() == QLatin1String( "x-kaddressbook-x-anniversary" ) && version == VCard::v4_0) {
// ANNIVERSARY
if (!value.isEmpty()) {
const QDate date = QDate::fromString( value, Qt::ISODate );
QDateTime dt = QDateTime(date);
dt.setTime(QTime());
card.addLine( VCardLine( QLatin1String( "ANNIVERSARY" ), createDateTime( dt ) ) );
}
} else {
VCardLine line( identifier, value );
if ( version == VCard::v2_1 && needsEncoding( value ) ) {
line.addParameter( QLatin1String( "charset" ), QLatin1String( "UTF-8" ) );
line.addParameter( QLatin1String( "encoding" ), QLatin1String( "QUOTED-PRINTABLE" ) );
}
card.addLine( line );
}
card.addLine( line );
}
vCardList.append( card );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment