Commit 1f8f804d authored by Laurent Montel's avatar Laurent Montel 😁

Fix suggest automatic display

parent 532092dc
......@@ -77,6 +77,7 @@ void AttachmentUpdateJob::Private::loadJobResult(KJob *job)
mUpdatedPart->setEncrypted(q->originalPart()->isEncrypted());
mUpdatedPart->setEncoding(q->originalPart()->encoding());
mUpdatedPart->setMimeType(q->originalPart()->mimeType());
mUpdatedPart->setInline(q->originalPart()->isInline());
q->emitResult(); // Success.
}
......
......@@ -198,4 +198,33 @@ void AttachmentUpdateJobTest::shouldNotUpdateWhenUrlIsEmpty()
QVERIFY(!job->updatedPart());
}
void AttachmentUpdateJobTest::shouldHaveSameInlineStatus()
{
const KUrl url = KUrl::fromPath( PATH_ATTACHMENTS + QString::fromLatin1( "file.txt" ) );
// Some data.
QByteArray data( "This is short enough that compressing it is not efficient." );
const QString name = QString::fromLatin1( "name.txt" );
const QString description = QString::fromLatin1( "description" );
// Create the original part.
MessageCore::AttachmentPart::Ptr origPart = MessageCore::AttachmentPart::Ptr( new MessageCore::AttachmentPart );
origPart->setName( name );
origPart->setDescription( description );
origPart->setMimeType( "text/pdf" );
origPart->setEncoding( KMime::Headers::CE8Bit );
origPart->setData( data );
origPart->setUrl(url);
origPart->setSigned(true);
origPart->setEncrypted(true);
origPart->setInline(true);
MessageCore::AttachmentUpdateJob *job = new MessageCore::AttachmentUpdateJob(origPart, this);
VERIFYEXEC( job );
QCOMPARE(origPart->isInline(), job->updatedPart()->isInline());
}
QTEST_KDEMAIN(AttachmentUpdateJobTest, NoGUI)
......@@ -35,6 +35,7 @@ private Q_SLOTS:
void shouldHaveSameEncodingAfterUpdate();
void shouldHaveSameMimetypeAfterUpdate();
void shouldNotUpdateWhenUrlIsEmpty();
void shouldHaveSameInlineStatus();
};
#endif // ATTACHMENTUPDATEJOBTEST_H
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