[Notifications] Display URL relative to Place similar to KUrlNavigator
This changes the displayed destination of a file operation in the summary to be relative to the closest user's place, similar to how the KUrlNavigator (address bar) does it in Dolphin, for example:
- /tmp: Root/tmp
- /home/user/Documents: Documents
- /home/user/Documents/foo/bar: Documents/foo/bar
- ftp://example.com/var/www/clients/user/blog/uploads: My Blog/uploads
- stp://192.168.0.123/home/user/stuff/kf5/plasma-workspace: Build Server/stuff/kf5/plasma-workspace
Especially for remote locations the user has bookmarked this can tremendously clean up the displayed address, showing a nice name rather than the full URL.
The other logic about showing local paths and replacement of $HOME by tilde has been removed as both Root and Home are default places that are likely to be present.
URL | Before | After |
---|---|---|
file:///tmp | /tmp | Root/tmp |
file:///home/kbroulik | Home | Home |
file:///home/kbroulik/Test | ~/test | Home/test |
file:///home/kbroulik/Documents | Documents | Documents |
file:///home/kbroulik/Documents/KDE | ~/Documents/KDE | Documents/KDE |
file:///home/kbroulik/Projects/kf5/plasma-workspace | ~/Projects/kf5/plasma-workspace | kf5/plasma-workspace (I have my kf5 folder bookmarked) |
sftp:///kbroulik-desktop.local/home/kbroulik | sftp:///kbroulik-desktop.local/home/kbroulik | kbroulik-desktop (I have that bookmarked as such) |
sftp:///kbroulik-desktop.local/home/kbroulik/Projects/kf5/plasma-workspace | sftp:///kbroulik-desktop.local/home/kbroulik/Projects/kf5/plasma-workspace | kbroulik-desktop/kf5/pasma-workspace |