Commit 5ab9e701 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Fix check for root of content node tree

showContextMenu() is only called for content nodes from the mime part
tree, but the mime part tree has a separate copy of the node tree.
Therefore, isRoot was always false. Check content->isTopLevel() instead
of comparing pointers.
parent 0b53b367
Pipeline #59419 canceled with stage
in 17 minutes and 3 seconds
......@@ -1681,12 +1681,11 @@ void ViewerPrivate::showContextMenu(KMime::Content *content, const QPoint &pos)
const bool isAttachment = !content->contentType()->isMultipart() && !content->isTopLevel();
const bool isExtraContent = !mMessage->content(content->index());
const bool isRoot = (content ==;
const auto hasAttachments = KMime::hasAttachment(;
QMenu popup;
if (!isRoot) {
if (!content->isTopLevel()) {
popup.addAction(QIcon::fromTheme(QStringLiteral("document-save-as")), i18n("Save &As..."), this, &ViewerPrivate::slotAttachmentSaveAs);
if (isAttachment) {
......@@ -1705,12 +1704,11 @@ void ViewerPrivate::showContextMenu(KMime::Content *content, const QPoint &pos)
popup.addAction(i18n("Save All Attachments..."), this, &ViewerPrivate::slotAttachmentSaveAll);
if (!isRoot) {
if (!content->isTopLevel()) {
if (isAttachment) {
popup.addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18n("Copy"), this, &ViewerPrivate::slotAttachmentCopy);
if (!content->isTopLevel()) {
auto deleteAction =
popup.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("Delete Attachment"), this, &ViewerPrivate::slotAttachmentDelete);
// body parts can only be deleted one at a time, and extra content cannot be delete
......@@ -1719,7 +1717,6 @@ void ViewerPrivate::showContextMenu(KMime::Content *content, const QPoint &pos)
popup.addAction(i18n("Properties"), this, &ViewerPrivate::slotAttachmentProperties);
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