Bug 379177 - History (recentfolders) not working / folder never created
Summary: History (recentfolders) not working / folder never created
Status: RESOLVED FIXED
Alias: None
Product: gwenview
Classification: Applications
Component: general (other bugs)
Version First Reported In: Git (add output of "git log -1 --oneline" to description)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
: 379622 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-04-24 21:08 UTC by Leszek Lesner
Modified: 2017-05-30 21:50 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Fix proposal (626 bytes, patch)
2017-04-24 21:08 UTC, Leszek Lesner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leszek Lesner 2017-04-24 21:08:04 UTC
Created attachment 105177 [details]
Fix proposal

2f1ad4c GIT_SILENT made messages (after extraction)

Folder History is not working anymore. 

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 )
Comment 1 Leszek Lesner 2017-04-24 21:19:48 UTC
Added phabricator review request for the patch: https://phabricator.kde.org/D5572
Comment 2 Luigi Toscano 2017-04-25 16:38:36 UTC
Git commit 5975b74974d06a1b8ac584edaa9f6b8ed9fa432d by Luigi Toscano, on behalf of Leszek Lesner.
Committed on 25/04/2017 at 16:38.
Pushed by ltoscano into branch 'arcpatch-D5572'.

History (recentfolders) not working / folder never created

Summary:
Folder History is not working anymore.

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 )

Reviewers: sandsmark, ltoscano

Reviewed By: ltoscano

Subscribers: ltoscano, cfeck

Differential Revision: https://phabricator.kde.org/D5572

M  +1    -1    app/gvcore.cpp

https://commits.kde.org/gwenview/5975b74974d06a1b8ac584edaa9f6b8ed9fa432d
Comment 3 Christoph Feck 2017-05-30 21:50:02 UTC
*** Bug 379622 has been marked as a duplicate of this bug. ***