┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/viewproperties.cpp
diff options
context:
space:
mode:
authorSebastian Englbrecht <[email protected]>2026-05-23 13:27:54 +0200
committerSebastian Englbrecht <[email protected]>2026-05-24 17:27:40 +0200
commit1a813b8834f06c4b3a03fb5519cd72c713fd4cf7 (patch)
tree468e49d8eb36eaa76e62fe86fce1ee50a0b33b6c /src/views/viewproperties.cpp
parent2e665e1b513b3f7c082bedc8faaf47bee8008c73 (diff)
viewproperties: fall back to .directory when xattr space is exhausted
When saving view properties to extended attributes failed with NoSpace, the code cleared the xattr entry and returned without writing anything to disk. The .directory fallback file was never created, silently losing the user's view settings. Fix by copying the current settings into a file-backed KConfig pointing to .directory whenever the xattr write returns NoSpace. The copy uses KConfigGroup::copyTo per group (not KConfig::copyFrom, which replaces the entire entry map) so that unrelated groups already present in .directory — such as a [Desktop Entry] group carrying a custom folder icon — are left untouched by sync().
Diffstat (limited to 'src/views/viewproperties.cpp')
-rw-r--r--src/views/viewproperties.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp
index c5e53586c..9cd834991 100644
--- a/src/views/viewproperties.cpp
+++ b/src/views/viewproperties.cpp
@@ -640,10 +640,24 @@ void ViewProperties::save()
// free the space used by viewproperties from the file metadata
metaData.setAttribute(MetaDataKey, QString());
qCWarning(DolphinDebug) << "could not save viewproperties to extended attributes for dir " << m_filePath << ", no space available in attributes";
+ // xattr space exhausted — fall back to .directory file.
+ // Copy only the Dolphin-managed groups into the existing file using
+ // KConfigGroup::copyTo so that unrelated groups (e.g. [Desktop Entry]
+ // with a custom folder icon) are left untouched by sync().
+ const QString settingsFile = m_filePath + QDir::separator() + ViewPropertiesFileName;
+ KConfig fileConfig(settingsFile, KConfig::SimpleConfig);
+ for (const QString &group : m_node->config()->groupList()) {
+ KConfigGroup srcGrp(m_node->config(), group);
+ KConfigGroup dstGrp(&fileConfig, group);
+ srcGrp.copyTo(&dstGrp);
+ }
+ if (!fileConfig.sync()) {
+ qCWarning(DolphinDebug) << "could not save viewproperties to .directory for" << m_filePath;
+ }
} else {
qCWarning(DolphinDebug) << "could not save viewproperties to extended attributes for dir " << m_filePath << "error:" << result;
}
- // keep .directory file
+ m_changedProps = false;
return;
}
cleanDotDirectoryFile();