Reader window opened on message in trash still shows "Move to trash" action
ClosedPublic

Authored by marten on Mar 13 2018, 1:38 PM.

Details

Summary

If a separate reader window is opened on a message which is in a trash folder, the menu and toolbar still show the "Move to trash" action text and icon. However, clicking this action actually deletes the message permanently. The toolbar and menu actions change appropriately in the KMail main window, so the message viewer should do so as well to correctly reflect the action that will be done.

Because similar code and identical UI strings are needed for both cases, I've copied it out of KMMainWidget::updateFolderMenu() into a new function Util::setActionTrashOrDelete().

I'm not sure what the comment "Use same text as in Text property. Change it in kf5" is intended to mean. If it is saying that the tool tip text set is exactly the same as the action text, then that is true as far as the user sees - but it wouldn't be possible to just do 'action->setToolTip(action->text())' because the text() has '&' accelerators included. Unless we remove the accelerators from the action text, but that would be an I18N change and the automatically assigned accelerator may be different.

Test Plan

Built KMail with this change. Verified that the reader window shows and does "Move to trash" unless the message is in the trash already, in which case it shows and does "Delete".

Diff Detail

Repository
R206 KMail
Lint
Lint Skipped
Unit
Unit Tests Skipped
marten created this revision.Mar 13 2018, 1:38 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptMar 13 2018, 1:38 PM
marten requested review of this revision.Mar 13 2018, 1:38 PM
mlaurent requested changes to this revision.Mar 14 2018, 6:26 AM
mlaurent added a subscriber: mlaurent.
mlaurent added inline comments.
src/util.cpp
183

Add a if (action) by default it's always true but I prefer to be safe.

This revision now requires changes to proceed.Mar 14 2018, 6:26 AM
marten updated this revision to Diff 29466.Mar 14 2018, 8:17 AM

Util::setActionTrashOrDelete() guarded in accordance with review comments

marten marked an inline comment as done.Mar 14 2018, 8:18 AM
mlaurent accepted this revision.Mar 14 2018, 5:24 PM
This revision is now accepted and ready to land.Mar 14 2018, 5:24 PM
This revision was automatically updated to reflect the committed changes.