From f5818306d014fafaf35ef10ee83e286eebea9cd7 Mon Sep 17 00:00:00 2001 From: Kostiantin Korchuhanov Date: Fri, 15 Aug 2025 16:29:34 +0300 Subject: itemactions: Add context menu actions to hide and unhide files using .hidden Summary: This patch introduces context menu actions that allow users to hide or unhide selected files by editing the .hidden file in their parent directories. What this patch does: - Implemented HideFileItemAction plugin based on KAbstractFileItemActionPlugin - Plugin is disabled by default unless explicitly enabled in kservicemenurc via the hidefileitemaction key - "Hide" action adds selected file names to the .hidden file, avoiding duplicates - "Unhide" action removes selected file names from the .hidden file - Action visibility logic: - If only visible or only hidden files are selected, only the relevant action is shown - If both are selected, both "Hide" and "Unhide" actions are shown - Write permission checks ensure actions are disabled if the .hidden file cannot be modified - Optimized redundant path computations by calculating parent directory and .hidden file paths once and reusing them --- src/itemactions/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/itemactions/CMakeLists.txt') diff --git a/src/itemactions/CMakeLists.txt b/src/itemactions/CMakeLists.txt index 6610b0e4a..cd196eb36 100644 --- a/src/itemactions/CMakeLists.txt +++ b/src/itemactions/CMakeLists.txt @@ -11,6 +11,16 @@ target_link_libraries(movetonewfolderitemaction KF6::KIOWidgets KF6::KIOFileWidgets) +#hidefileitemaction plugin +kcoreaddons_add_plugin(hidefileitemaction + SOURCES hidefileitemaction.cpp hidefileitemaction.h + INSTALL_NAMESPACE "kf6/kfileitemaction") + +target_link_libraries(hidefileitemaction + KF6::CoreAddons + KF6::I18n + KF6::KIOCore + KF6::KIOWidgets) if(NOT WIN32) # setfoldericon plugin @@ -24,3 +34,4 @@ if(NOT WIN32) KF6::KIOCore KF6::KIOWidgets) endif() + -- cgit v1.3.1