From 65cc12ab3ec8ca313d0e9d9b6d506e9fa9042bc1 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Mon, 13 Apr 2020 12:21:57 -0600 Subject: Add standard shortcut for "Show/Hide Hidden Files" Summary: Add a standard shortcut for this action so it can be synchronized between different apps and the file dialog; see https://bugs.kde.org/show_bug.cgi?id=262551. The action in Dolphin also has F8 bound to this, but the definition here only accept two default shortcuts, and F8 seems kind of random. CCBUG: 262551 Test Plan: Apply D28803 to KIO and D28804 to Dolphin and test there Reviewers: dfaure, #frameworks Reviewed By: dfaure Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D28802 --- src/gui/kstandardshortcut.cpp | 6 ++++++ src/gui/kstandardshortcut.h | 9 +++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/gui/kstandardshortcut.cpp b/src/gui/kstandardshortcut.cpp index 2bf978cc..b9bce5ed 100644 --- a/src/gui/kstandardshortcut.cpp +++ b/src/gui/kstandardshortcut.cpp @@ -166,6 +166,7 @@ static KStandardShortcutInfo g_infoStandardShortcut[] = { { RenameFile, "RenameFile", QT_TRANSLATE_NOOP3("KStandardShortcut", "Rename", "@action"), Qt::Key_F2, 0, QList(), false }, { MoveToTrash, "MoveToTrash", QT_TRANSLATE_NOOP3("KStandardShortcut", "Move to Trash", "@action"), Qt::Key_Delete, 0, QList(), false }, { Donate, "Donate", QT_TRANSLATE_NOOP3("KStandardShortcut", "Donate", "@action"), 0, 0, QList(), false }, + { ShowHideHiddenFiles, "ShowHideHiddenFiles", QT_TRANSLATE_NOOP3("KStandardShortcut", "Show/Hide Hidden Files", "@action"), CTRL(H), ALT(Period), QList(), false }, //dummy entry to catch simple off-by-one errors. Insert new entries before this line. { AccelNone, nullptr, {nullptr, nullptr}, 0, 0, QList(), false } @@ -557,4 +558,9 @@ const QList &preferences() return shortcut(Preferences); } +const QList &showHideHiddenFiles() +{ + return shortcut(ShowHideHiddenFiles); +} + } diff --git a/src/gui/kstandardshortcut.h b/src/gui/kstandardshortcut.h index e8fce220..69feee61 100644 --- a/src/gui/kstandardshortcut.h +++ b/src/gui/kstandardshortcut.h @@ -141,6 +141,7 @@ enum StandardShortcut { RenameFile, ///< Rename files or folders. @since 5.25 MoveToTrash, ///< Move files or folders to the trash. @since 5.25 Donate, ///< Open donation page on kde.org. @since 5.26 + ShowHideHiddenFiles, ///< Toggle showing or hiding hidden files @since 5.70 // Insert new items here! StandardShortcutCount // number of standard shortcuts @@ -526,6 +527,14 @@ KCONFIGGUI_EXPORT const QList &moveToTrash(); * @since 5.64 */ KCONFIGGUI_EXPORT const QList &preferences(); + +/** + * Shows or hides hidden files. Defaults: Ctrl+H, Alt+. + * @return the shortcut of the standard accelerator + * @since 5.70 + */ +KCONFIGGUI_EXPORT const QList &showHideHiddenFiles(); + } #endif // KSTANDARDSHORTCUT_H -- cgit v1.2.1