Make "Show hidden files" action follow HIG

The action is a toggle action, for which the HIG prescribes that the
text should describe the action's checked state, and neither the text
nor the icon should change when the action is checked. Other toggle
actions in Dolphin follow these rules, but this one does not.

This commit makes the action follow those rules.
This commit is contained in:
Nate Graham 2020-09-17 18:34:11 -06:00
parent 9b83378c08
commit 15928112ce

View file

@ -272,8 +272,8 @@ void DolphinViewActionHandler::createActions()
connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting);
KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files"));
showHiddenFiles->setIcon(QIcon::fromTheme(QStringLiteral("view-visible")));
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
showHiddenFiles->setToolTip(i18nc("@info", "Visibility of hidden files and folders"));
showHiddenFiles->setWhatsThis(xi18nc("@info:whatsthis", "<para>When "
"this is enabled <emphasis>hidden</emphasis> files and folders "
"are visible. They will be displayed semi-transparent.</para>"
@ -552,14 +552,6 @@ void DolphinViewActionHandler::slotHiddenFilesShownChanged(bool shown)
{
QAction* showHiddenFilesAction = m_actionCollection->action(QStringLiteral("show_hidden_files"));
showHiddenFilesAction->setChecked(shown);
// #374508: don't overwrite custom icons.
const QString iconName = showHiddenFilesAction->icon().name();
if (!iconName.isEmpty() && iconName != QLatin1String("view-visible") && iconName != QLatin1String("view-hidden")) {
return;
}
showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
}
void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable)