[pim/messagelib] messagecomposer/src/attachment: Fix show error message. When we cancel it's not a problem about attachment file

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 8760e0f1f7919c12b3426ab41d2af66faff18836 by Laurent Montel.
Committed on 15/08/2026 at 06:10.
Pushed by mlaurent into branch 'master'.

Fix show error message. When we cancel it's not a problem about attachment file

M  +4    -2    messagecomposer/src/attachment/attachmentcontrollerbase.cpp

https://invent.kde.org/pim/messagelib/-/commit/8760e0f1f7919c12b3426ab41d2af66faff18836

diff --git a/messagecomposer/src/attachment/attachmentcontrollerbase.cpp b/messagecomposer/src/attachment/attachmentcontrollerbase.cpp
index 3972eb262..b0a9deaa7 100644
--- a/messagecomposer/src/attachment/attachmentcontrollerbase.cpp
+++ b/messagecomposer/src/attachment/attachmentcontrollerbase.cpp
@@ -711,8 +711,10 @@ void AttachmentControllerBase::openAttachment(const AttachmentPart::Ptr &part)
     job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, d->wParent));
     job->setDeleteTemporaryFile(true);
     connect(job, &KIO::OpenUrlJob::result, this, [this, tempFile](KJob *job) {
-        if (job->error() == KIO::ERR_USER_CANCELED) {
-            KMessageBox::error(d->wParent, job->errorString(), i18n("KMail was unable to open the attachment"));
+        if (job->error()) {
+            if (job->error() != KIO::ERR_USER_CANCELED) {
+                KMessageBox::error(d->wParent, job->errorString(), i18nc("@title:window", "Unable to open attachment"));
+            }
             delete tempFile;
         } else {
             // The file was opened.  Delete it only when the composer is closed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.