https://bugs.kde.org/show_bug.cgi?id=454481

            Bug ID: 454481
           Summary: KRecentFiles: allow temporary files to be added the
                    list of recent files
           Product: frameworks-kconfigwidgets
           Version: 5.94.0
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kdelibs-b...@kde.org
          Reporter: raphael....@jakse.fr
  Target Milestone: ---

Temporary files are not added to the list of recent files in Kate and KDevelop.
This is because KRecentFiles ignores them in krecentfilesaction.cpp:

    void KRecentFilesAction::addUrl(const QUrl &url, const QString &name)
    {
        ...
        if (url.isLocalFile() &&
url.toLocalFile().startsWith(QDir::tempPath())) {
            return;
        }
        ...
    }

I can see why it is this way, and this is useful, and this should probably be
the default. Usually, you don't want stale files in the recent files.

Now, I would like files I edit in /tmp to be in the recent files. My computer
is on for days, so files are going to stay for some time.

But if the goal is to avoid stale files to be in the recent files list, this is
incomplete: non-temporary files can also be (re)moved. I personally don't mind
having a few stale files in the recent files list, it is still useful to have
them in there, as a log of what as been edited in the past. But if it is
important, we could imagine a solution that iterates over the list and stat the
file system to see if they are still readable. 

I see several solutions:

1. Don't care - let's keep it as it is
2. Add a configuration parameter somewhere that allows the user to say "I want
files in /tmp to be remembered in recent files"
3. Let's just accept there will be stale files in the recent files list and
unconditionally allow files in /tmp to be remembered.
4. No parameter while still avoiding stale files: iterate over the recent files
on initialization and check which ones are still readable. This might be costly
and not worth it, and should probably be done asynchronously to avoid making
apps lag just because we are doing something for the recent files.

My preference would be 3, but if it's there, it must be there of a reason and
probably to fix a former issue, so I guess 2. 1 is fine for me. 4 seems a bit
complicated and might cause other issues, but offer a more complete solution to
the problem at hand the developer who wrote this condition was probably facing.

STEPS TO REPRODUCE
1. Open Kate
2. Edit a file in /tmp
3. Save

OBSERVED RESULT

Notice the file is missing in the recent files menu (this is an intentional
behavior)

EXPECTED RESULT

I'd like the file to be in the recent files menu. I was not expecting a file I
edited not to show up in the list and caused me some confusion.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20220524
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.94.0

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to