Bug 421391

Summary: "Maximum number of entries in recent file list" is zero-based and keeps one file even when set to 0
Product: [Frameworks and Libraries] frameworks-kconfigwidgets Reporter: Serhiy <serhiy.int>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: christoph, justin.zobel, nate
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Serhiy 2020-05-12 06:05:38 UTC
SUMMARY


STEPS TO REPRODUCE
1. Settings > Configure Kate > Sessions > "Maximum number of entries in recent file list" = 0
2. Open any file
3. Open ~/.local/share/kate/anonymous.katesession

OBSERVED RESULT
Last file is saved into anonymous.katesession under [Document 0]

EXPECTED RESULT
No file is saved

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 20.04
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8

ADDITIONAL INFORMATION
Looks like settings in systemsettings5 > Workspace behavior > Activities > Privacy are ignored. Do they affect something else then storing recent files in Kate? With "Do not remember" opened files are still written to _several_ locations, including ~/.local/share/RecentDocuments/ that I have now put into size=4k tmpfs as an experiment. System seems stable even when RecentDocuments dir is full.
Comment 1 Justin Zobel 2020-10-30 04:30:10 UTC
I can confirm this is still an issue in kate from git master, filename is shown in [Recent Files] section of file.
Comment 2 Christoph Cullmann 2021-02-21 19:06:25 UTC
I think KRecentFilesAction can't really cope well with the limit "0".
Comment 3 Christoph Cullmann 2021-02-21 19:11:37 UTC
I think KRecentFilesAction can't really cope well with the limit "0".
Comment 4 Bug Janitor Service 2021-02-21 19:12:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kconfigwidgets/-/merge_requests/34
Comment 5 Christoph Cullmann 2021-02-23 11:22:32 UTC
Git commit 6fe641001ff2be40849568b2c3b0c0f90348133f by Christoph Cullmann.
Committed on 23/02/2021 at 11:22.
Pushed by cullmann into branch 'master'.

fix maxItems == 0, really ensure no items are remembered

* fix maxItems == 0 avoids inserting of any item
* fix that maxItems can be negative, code doesn't handle that

M  +10   -3    src/krecentfilesaction.cpp
M  +2    -0    src/krecentfilesaction.h

https://invent.kde.org/frameworks/kconfigwidgets/commit/6fe641001ff2be40849568b2c3b0c0f90348133f