From 15928112ce57902d1b5e0f9f6870b625d6b8056f Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Thu, 17 Sep 2020 18:34:11 -0600 Subject: [PATCH] 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. --- src/views/dolphinviewactionhandler.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index fa0d553b6..a63263bf5 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -272,8 +272,8 @@ void DolphinViewActionHandler::createActions() connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting); KToggleAction* showHiddenFiles = m_actionCollection->add(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", "When " "this is enabled hidden files and folders " "are visible. They will be displayed semi-transparent." @@ -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) -- 2.47.3