Bug 383850 - Gwenview shows unreadable paths in Recent Folders
Summary: Gwenview shows unreadable paths in Recent Folders
Status: RESOLVED FIXED
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: 17.04.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-22 12:42 UTC by DrSlony
Modified: 2018-04-07 11:56 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 18.04.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DrSlony 2017-08-22 12:42:31 UTC
The paths which Gwenview shows in Recent Folders are not human-friendly.

e.g.:
file:///home/me/photos/bugs/
file:///tmp/icons/

It would be not only more human-friendly but also more of the path would be visible if the paths were formed as follows:
/home/me/photos/bugs/
/tmp/icons/

or even:
~/photos/bugs/
/tmp/icons/
Comment 1 Kai Uwe Broulik 2017-08-28 09:47:45 UTC
Probably needs to use QUrl::toDisplayString with QUrl::PreferLocalFile
Comment 2 null 2017-12-14 19:40:18 UTC
If anybody tackles this: There's also this annoying problem of duplicate entries, i.e. some with / and some with // at the end.
Comment 3 null 2017-12-15 21:07:36 UTC
Since KDE Frameworks 5.41 (more specifically: 7eb6333bdb48), there is another problem caused by the superfluous "/":
- Access "Today"
- Go back to Start Page, notice new entry in Recent Folders ("timeline:/today")
- Right-click, Add to Places, note the extra "/" in the new Places entry ("timeline:/today/")
- Click on new Places entry
- Result (with a Debug build, at least):
ASSERT: "path.endsWith(QLatin1String("/today"))" in file ~/kio/src/filewidgets/kfileplacesmodel.cpp, line 124
Aborted (core dumped)
Comment 4 null 2018-01-24 23:02:36 UTC
Note that one of a whole set of patches I worked on end of last year will solve this Bug, it should even conform to DrSlony's last example. Once my review backlog shortens a bit I'll rebase, clean it up and post it on Phab. (← Bad form of cookie licking, sorry for that ;)
Comment 5 null 2018-03-19 16:59:46 UTC
Patches available in https://phabricator.kde.org/D11492 and https://phabricator.kde.org/D11493, but note that comment 3 is not related to Gwenview or slashes in particular. This can happen to any caller of KFilePlacesModel::convertedUrl, e.g. when accessing the places dropdown in KUrlNavigator with "timeline:/today/" or "timeline:/2018-02".
Comment 6 null 2018-03-21 01:02:29 UTC
Git commit 79a537ee840c629ed59ae8542f1041991910c1a2 by Henrik Fehlauer.
Committed on 21/03/2018 at 01:02.
Pushed by rkflx into branch 'Applications/18.04'.

Prevent duplicate slashes in Recent Folders

Summary:
Sometimes the {nav Recent Folders} tab on the {nav Start Page} would
show directory entries with multiple `/` at the end. Clicking on those
folders works fine, but as the same folder could also be added without
two slashes, in some cases there were multiple entries for the same
location.

The duplicate slash is caused by a porting mistake in d760ced7cb5b,
which added `/` unconditionally while `KUrl::AddTrailingSlash` only
added `/` if there was none at the end. Performing this check manually
fixes the bug.

Note that the fix for Bug #312060 (differentiate between home and root
folder for remote hosts) and what was added in 7eb5472f6539 (no password
dialog right after startup) are still in effect as well, even after
porting away from `KUrl`.

As a side effect, visiting `/` does not result anymore in broken
{nav Recent Folder} entries (non-functional and showing an error icon).
KIO warnings are gone, too:
  kf5.kio.core: Invalid URL: QUrl("")

Test Plan:
Open folder, {nav Go > Up}, switch to {nav Start Page} and notice how
now the added recent folder only has a single slash at the end. In
particular, there is only a single entry for this location after
navigating back and forth again.

Start `sshd`, `sftp://localhost` still shows home folder,
`sftp://localhost/` shows root dir. Killing `kiod` and restarting
Gwenview does not show a password prompt on the {nav Start Page}.

Visit `/`, switch back to {nav Start Page} and observe that the newly
added entry shows and works correctly.

Reviewers: #gwenview, muhlenpfordt

Reviewed By: #gwenview, muhlenpfordt

Subscribers: muhlenpfordt

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

M  +5    -2    app/gvcore.cpp

https://commits.kde.org/gwenview/79a537ee840c629ed59ae8542f1041991910c1a2
Comment 7 null 2018-03-21 01:04:07 UTC
Git commit b4e9e0fc238dde90274125d47664fd0e04ca9f81 by Henrik Fehlauer.
Committed on 21/03/2018 at 01:03.
Pushed by rkflx into branch 'Applications/18.04'.

Prettify display of URLs in Recent Folders and Places

Summary:
Entries in the {nav Recent Folders} tab on the {nav Start Page}
contained superfluous information like `file://` for local folders and
the user's home directory, taking away valuable space and unnecessarily
eliding the text:
  file:///home/user/Documents/

By abbreviating to `~` and omitting the protocol for local folders, the
entries can look much neater, making them faster to scan for users:
  ~/Documents/

The changes not only affect the {nav Recent Folders} tab, but also what
is displayed in the {nav Recent Files} tab and the hover overlays for
very long entries.

In addition, adding folders to the {nav Places} panel now uses the last
subfolder for naming the entry, bringing the behaviour in line with
Dolphin.
FIXED-IN: 18.04.0

Test Plan:
- Inspected {nav Recent Folders} and {nav Recent Files} on the {nav Start Page}.
- In {nav Browse} mode, used {nav File > Add Folder to Places}.
- Tested that remote paths containing `~` are still intact.

Before:
{F5758862}

After:
{F5758864}

Reviewers: #gwenview, muhlenpfordt

Reviewed By: #gwenview, muhlenpfordt

Subscribers: ngraham, muhlenpfordt

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

M  +1    -1    app/browsemainpage.cpp
M  +1    -1    app/startmainpage.cpp
M  +10   -1    lib/historymodel.cpp
M  +7    -1    lib/recentfilesmodel.cpp

https://commits.kde.org/gwenview/b4e9e0fc238dde90274125d47664fd0e04ca9f81