┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings
diff options
context:
space:
mode:
authorKostiantin Korchuhanov <[email protected]>2025-08-15 16:29:34 +0300
committerKostiantyn Korchuhanov <[email protected]>2025-09-22 06:51:19 +0000
commitf5818306d014fafaf35ef10ee83e286eebea9cd7 (patch)
tree25151e3268583dbc4f503a043357a03469c622ab /src/settings
parent1d92f1736350664383217a7f30f4c3701ae14759 (diff)
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
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/contextmenu/contextmenusettingspage.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/settings/contextmenu/contextmenusettingspage.cpp b/src/settings/contextmenu/contextmenusettingspage.cpp
index b3585e3fa..ae3b58033 100644
--- a/src/settings/contextmenu/contextmenusettingspage.cpp
+++ b/src/settings/contextmenu/contextmenusettingspage.cpp
@@ -300,7 +300,10 @@ void ContextMenuSettingsPage::loadServices()
for (const auto &jsonMetadata : jsonPlugins) {
const QString desktopEntryName = jsonMetadata.pluginId();
if (!isInServicesList(desktopEntryName)) {
- const bool checked = showGroup.readEntry(desktopEntryName, true);
+ bool checked = showGroup.readEntry(desktopEntryName, true);
+ if (!showGroup.hasKey(desktopEntryName) && desktopEntryName == QStringLiteral("hidefileitemaction")) {
+ checked = false;
+ }
addRow(jsonMetadata.iconName(), jsonMetadata.name(), desktopEntryName, checked);
}
}