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 a7e26e14 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr

Fix links for TNEF attachements with umlauts.

This patch fixes the generated file links for files in TNEF attachments containing
non-ascii-charcters. With this patch, the same file naming scheme is applied as
used in KNefParser::extractAttachementTo(...) which first uses att->fileName()
and att->file() only as a fallback. The patch contains fixes for all code snippets
in KDEPIM using KTNEFParser::extractFileTo(...).

REVIEW: 121937
parent e8fbce87
......@@ -271,7 +271,13 @@ QString KTNEFMain::extractTemp( KTNEFAttach *att )
{
QString dir = KGlobal::dirs()->localkdedir() + QLatin1String("/share/apps/ktnef/tmp/");
mParser->extractFileTo( att->name(), dir );
dir.append( att->name() );
QString filename = att->fileName();
// falling back to internal TNEF attachement name if no filename is given for the attached file
// this follows the logic of KTNEFParser::extractFileTo(...)
if ( filename.isEmpty() ) {
filename = att->name();
}
dir.append( filename );
return dir;
}
......
......@@ -151,11 +151,17 @@ namespace {
const QString dir = bodyPart->nodeHelper()->createTempDir( QLatin1String("ktnef-") + QString::number( i ) );
parser.extractFileTo( att->name(), dir );
bodyPart->nodeHelper()->addTempFile( dir + QDir::separator() + att->name() );
const QString href = QLatin1String("file:") + QString::fromLatin1(KUrl::toPercentEncoding( dir + QDir::separator() + att->name() ));
// falling back to internal TNEF attachement name if no filename is given for the attached file
// this follows the logic of KTNEFParser::extractFileTo(...)
QString attFileName = att->fileName();
if ( attFileName.isEmpty() ) {
attFileName = att->name();
}
bodyPart->nodeHelper()->addTempFile( dir + QDir::separator() + attFileName );
const QString href = QLatin1String("file:") + QString::fromLatin1(KUrl::toPercentEncoding( dir + QDir::separator() + attFileName ));
const QString iconName = MessageViewer::Util::fileNameForMimetype( att->mimeTag(),
KIconLoader::Desktop, att->name() );
KIconLoader::Desktop, attFileName );
writer->queue( QLatin1String("<div><a href=\"") + href + QLatin1String("\"><img src=\"file:///") +
iconName + QLatin1String("\" border=\"0\" style=\"max-width: 100%\"/>") + label +
......
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