summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-04-09 10:56:39 +0200
committerMontel Laurent <[email protected]>2017-04-09 10:57:58 +0200
commit9d4bfe5b2340e465fb191de8775c02010d4bf2fc (patch)
treeff50675f006a1fab85b1fd8f51aaabc5b4a5b02b
parent9bc96e42c7e5ec4f1b540148e5c26857d54da7f4 (diff)
Use the same name as filename and name. It's more logical as discussed with David
-rw-r--r--messagecore/autotests/attachmentupdatejobtest.cpp3
-rw-r--r--messagecore/src/attachment/attachmentpropertiesdialog.cpp5
-rw-r--r--messagecore/src/attachment/attachmentupdatejob.cpp1
3 files changed, 7 insertions, 2 deletions
diff --git a/messagecore/autotests/attachmentupdatejobtest.cpp b/messagecore/autotests/attachmentupdatejobtest.cpp
index 0cf3205..e438c5d 100644
--- a/messagecore/autotests/attachmentupdatejobtest.cpp
+++ b/messagecore/autotests/attachmentupdatejobtest.cpp
@@ -76,10 +76,12 @@ void AttachmentUpdateJobTest::shouldHaveSameNameDescriptionAfterUpdate()
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");
+ const QString filename = QString::fromLatin1("filename");
// Create the original part.
MessageCore::AttachmentPart::Ptr origPart = MessageCore::AttachmentPart::Ptr(new MessageCore::AttachmentPart);
origPart->setName(name);
+ origPart->setFileName(filename);
origPart->setDescription(description);
origPart->setMimeType("text/plain");
origPart->setEncoding(KMime::Headers::CE7Bit);
@@ -91,6 +93,7 @@ void AttachmentUpdateJobTest::shouldHaveSameNameDescriptionAfterUpdate()
VERIFYEXEC(job);
QCOMPARE(origPart->name(), job->updatedPart()->name());
QCOMPARE(origPart->description(), job->updatedPart()->description());
+ QCOMPARE(origPart->fileName(), job->updatedPart()->fileName());
}
diff --git a/messagecore/src/attachment/attachmentpropertiesdialog.cpp b/messagecore/src/attachment/attachmentpropertiesdialog.cpp
index 6a284a2..5784429 100644
--- a/messagecore/src/attachment/attachmentpropertiesdialog.cpp
+++ b/messagecore/src/attachment/attachmentpropertiesdialog.cpp
@@ -301,8 +301,9 @@ void AttachmentPropertiesDialog::Private::saveToPart()
return;
}
mPart->setMimeType(ui->mimeType->currentText().toLatin1());
- mPart->setName(removeNewlines(ui->name->text()));
- // TODO what about fileName? Extra field??
+ const QString name = removeNewlines(ui->name->text());
+ mPart->setName(name);
+ mPart->setFileName(name);
mPart->setDescription(removeNewlines(ui->description->text()));
mPart->setInline(ui->autoDisplay->isChecked());
mPart->setSigned(ui->sign->isChecked());
diff --git a/messagecore/src/attachment/attachmentupdatejob.cpp b/messagecore/src/attachment/attachmentupdatejob.cpp
index 322d2d5..92e035a 100644
--- a/messagecore/src/attachment/attachmentupdatejob.cpp
+++ b/messagecore/src/attachment/attachmentupdatejob.cpp
@@ -75,6 +75,7 @@ void AttachmentUpdateJob::Private::loadJobResult(KJob *job)
AttachmentLoadJob *ajob = static_cast<AttachmentLoadJob *>(job);
mUpdatedPart = ajob->attachmentPart();
mUpdatedPart->setName(q->originalPart()->name());
+ mUpdatedPart->setFileName(q->originalPart()->fileName());
mUpdatedPart->setDescription(q->originalPart()->description());
mUpdatedPart->setSigned(q->originalPart()->isSigned());
mUpdatedPart->setEncrypted(q->originalPart()->isEncrypted());