History (recentfolders) not working / folder never created
ClosedPublic

Authored by leszeklesner on Apr 24 2017, 9:18 PM.

Details

Summary

Folder History is not working anymore.

BUG: 379177

Commit 840d1c40bc906b0961418c8b738aef3971e7dce2 broke it.

QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, "recentfolders/")

always returns an empty string "" when either the recentfolders folder or the ~/.local/share/gwenview folder don't exist.
See: http://doc.qt.io/qt-5/qstandardpaths.html#locate

If no such file or directory can be found, an empty string is returned

KStandardDirs::locateLocal behaves differently (from the api doc)

No check is made if the specified filename actually exists. Missing directories are created.

As we don't want to switch back to KStandardDirs I came up with a working patch using QStandardPaths::writableLocation (see attachment) as

Note: The storage location returned can be a directory that does not exist; i.e., it may need to be created by the system or the user.

(from : http://doc.qt.io/qt-5/qstandardpaths.html#writableLocation )

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
leszeklesner created this revision.Apr 24 2017, 9:18 PM
leszeklesner edited the summary of this revision. (Show Details)Apr 24 2017, 9:28 PM
cfeck added a subscriber: cfeck.Apr 24 2017, 11:25 PM
sandsmark accepted this revision.Apr 25 2017, 3:59 PM
This revision is now accepted and ready to land.Apr 25 2017, 3:59 PM

@leszeklesner , do you have a commit account? If not, I can commit it (with you as author of course)

@leszeklesner , do you have a commit account? If not, I can commit it (with you as author of course)

I don't have a commit account.
Yeah please commit it then for me :)

This revision now requires review to proceed.Apr 25 2017, 4:26 PM
ltoscano accepted this revision.Apr 25 2017, 4:33 PM

I'm going to ask you for the the emails (apparently you removed reviewers, basically un-accepting the review; reaccepting)

This revision is now accepted and ready to land.Apr 25 2017, 4:33 PM
This revision was automatically updated to reflect the committed changes.