Add function to suggest a unique filename
ClosedPublic

Authored by nicolasfella on Jul 21 2019, 6:00 PM.

Details

Summary

This is a copy of KIO::suggestName. It doesn't use anything from KIO in its implementation and this patch enables to use it without pulling in all the baggage that comes with KIO

Test Plan

Port the one use in KDE Connect to it

Diff Detail

Repository
R244 KCoreAddons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nicolasfella created this revision.Jul 21 2019, 6:00 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 21 2019, 6:00 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
nicolasfella requested review of this revision.Jul 21 2019, 6:00 PM
dfaure requested changes to this revision.Jul 21 2019, 6:21 PM

Please "move" (copy) the autotest as well, see kio/autotests/globaltest.cpp

Typo in the commit log: s/it's/its/

This revision now requires changes to proceed.Jul 21 2019, 6:21 PM
nicolasfella edited the summary of this revision. (Show Details)Jul 21 2019, 6:33 PM
dfaure requested changes to this revision.Jul 21 2019, 6:40 PM
dfaure added inline comments.
autotests/kfileutilstest.cpp
3

Liar :-)

I wrote the first version of this test method.

src/lib/io/kfileutils.cpp
3

ditto

65

You can remove this TODO. By moving this code to KCoreAddons we are finally closing the lid on this TODO.
It just won't be done, it wouldn't be a good idea anyway (too slow, and would require an async API, and a KIO dependency). So if it's ever done, it'll be with a different implementation in KIO, while this one will remain the "simple and synchronous" way, sufficient for many apps.

This revision now requires changes to proceed.Jul 21 2019, 6:40 PM
  • Don't steal David's copyright
  • Remove TODO
dfaure accepted this revision.Jul 21 2019, 6:51 PM
This revision is now accepted and ready to land.Jul 21 2019, 6:51 PM
This revision was automatically updated to reflect the committed changes.