Bug 320335 - Problem with tree view when using programs:/ protocol
Summary: Problem with tree view when using programs:/ protocol
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 2.2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: investigated
Depends on:
Blocks:
 
Reported: 2013-05-27 02:09 UTC by André Marcelo Alvarenga
Modified: 2013-06-10 08:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11
Sentry Crash Report:


Attachments
Screenshot (69.37 KB, image/png)
2013-05-27 02:10 UTC, André Marcelo Alvarenga
Details
Debugging patch (581 bytes, patch)
2013-05-27 09:27 UTC, Frank Reininghaus
Details
New screenshot (44.30 KB, image/png)
2013-05-27 11:30 UTC, André Marcelo Alvarenga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description André Marcelo Alvarenga 2013-05-27 02:09:34 UTC
See screenshot.
The Multimedia (Multimídia in my screenshot) subitems are displayed at the end of the list.
This also happens with other submenus.

Reproducible: Always

Steps to Reproduce:
1. Press F6 key
2. Type 'programs:/' and press Enter
3. Click on Multimedia item (or any other with subitem)
Comment 1 André Marcelo Alvarenga 2013-05-27 02:10:06 UTC
Created attachment 80099 [details]
Screenshot
Comment 2 Emmanuel Pescosta 2013-05-27 06:48:07 UTC
Hello André,
thanks for the bug report!

I cannot reproduce this bug with Dolphin 2.2, maybe because of the different language settings (English in my case).

This bug should be fixed in Dolphin 2.3 / KDE 4.11. See commit https://projects.kde.org/projects/kde/applications/kde-baseapps/repository/revisions/8008bc233d8447794df6f4cdc8c3f0ee7e8ac628
Comment 3 Emmanuel Pescosta 2013-05-27 07:01:32 UTC
Do you really have Dolphin 2.2? Not Dolphin from git?

Because I can reproduce this bug with the git version of Dolphin. Very strange ....
Comment 4 Frank Reininghaus 2013-05-27 09:27:42 UTC
Created attachment 80101 [details]
Debugging patch

The debugging patch yields the following output when opening 'programs:' and then expanding 'Applications':

Items added in directory KUrl("programs://") : 

([KFileItem forKUrl("programs:/Applications/") ] ,  [KFileItem for KUrl("programs:/Office/") ] ,  [KFileItem for KUrl("programs:/Utilities/") ] ,  [KFileItem for KUrl("programs:/Education/") ] ,  [KFileItem for KUrl("programs:/Development/") ] ,  [KFileItem for KUrl("programs:/Graphics/") ] ,  [KFileItem for KUrl("programs:/Internet/") ] ,  [KFileItem for KUrl("programs:/Multimedia/") ] ,  [KFileItem for KUrl("programs:/Science/") ] ,  [KFileItem for KUrl("programs:/Games/") ] ,  [KFileItem for KUrl("programs:/System/") ] ,  [KFileItem for KUrl("programs:/kfind") ] ,  [KFileItem for KUrl("programs:/systemsettings") ] )  

Items added in directory KUrl("programs:/Applications") : 

([KFileItem forKUrl("programs:/Applications/kseg") ] ,  [KFileItem for KUrl("programs:/Applications/kde-ksimus") ] ,  [KFileItem for KUrl("programs:/Applications/xaos") ] ,  [KFileItem for KUrl("programs:/Applications/xmgrace") ] ,  [KFileItem for KUrl("programs:/Applications/xmoontool") ] ,  [KFileItem for KUrl("programs:/Applications/xyscan") ] ,  [KFileItem for KUrl("programs:/Applications/zim") ] ) 

Note how the KFileItem for 'Applications/' is added *with* trailing slash, but the child items that appear when expanding are supposed to have  'Applications', *without* trailing slash, as their parent folder. This is why looking up the parent fails in KFileItemModel.

Now we could of course add hacks to Dolphin to always remove the trailing slash everywhere, but I do not think that this is the right approach to fix this. A better place for a fix might be

kde-runtime.git/kioslave/applications/kio_applications.cpp

But it seems that there is no bugzilla component for this code that provides access to 'programs:'
Comment 5 Emmanuel Pescosta 2013-05-27 09:38:43 UTC
@Frank:
Found the same problem, but you are faster with writting the comment. ;)

Are there other kio slaves where the trailing space problem appears?
Comment 6 André Marcelo Alvarenga 2013-05-27 11:30:45 UTC
Created attachment 80102 [details]
New screenshot

> Do you really have Dolphin 2.2? 
>
> Not Dolphin from git? Because I can reproduce this bug with the git version of Dolphin. Very strange ....

This screenshot is the 2.2.60 version (Project Neon)

In 4.10.2 version, I can see a similar problem (see new screenshot).

Subitems are above.
Comment 7 André Marcelo Alvarenga 2013-05-27 11:45:52 UTC
settings:/ protocol works fine for me.
Comment 8 Emmanuel Pescosta 2013-05-27 13:24:06 UTC
Thanks for your help.

Just one line is needed in kio_applications.cpp to fix this bug. 

Add "dirUrl.adjustPath(KUrl::RemoveTrailingSlash);" after "dirUrl.setPath('/' + relPath);" in "void ApplicationsProtocol::listDir(const KUrl& url)".
Comment 9 Emmanuel Pescosta 2013-05-27 13:27:46 UTC
Thanks for the 2. screenshot. 
It shows the bug which is fixed in Dolphin 2.3 (Comment #2) ;)
Comment 10 Frank Reininghaus 2013-05-27 14:43:03 UTC
(In reply to comment #5)
> Are there other kio slaves where the trailing space problem appears?

I'm not aware of any other kioslaves that have this "trailing slash" behaviour. If there are any others, people will certainly find out during the beta cycle and let us know.

(In reply to comment #8)
> Just one line is needed in kio_applications.cpp to fix this bug. 
> 
> Add "dirUrl.adjustPath(KUrl::RemoveTrailingSlash);" after
> "dirUrl.setPath('/' + relPath);" in "void
> ApplicationsProtocol::listDir(const KUrl& url)".

Great, thanks for looking into it! I'll add David to CC (he is the last one who touched the file, I think). In case he misses the notification, you might want to file a review request for kde-runtime and add him as reviewer.
Comment 11 Emmanuel Pescosta 2013-06-10 08:33:17 UTC
Git commit 3dafdf356b549c9f9cbedcebb996486be8b56ce9 by Emmanuel Pescosta.
Committed on 10/06/2013 at 10:30.
Pushed by emmanuelp into branch 'master'.

Fix Bug 320335 - Problem with tree view when using programs:/ protocol

Create directories without trailing slashes, like every other kio slave does.
REVIEW: 110924
FIXED-IN: 4.11

M  +1    -0    kioslave/applications/kio_applications.cpp

http://commits.kde.org/kde-runtime/3dafdf356b549c9f9cbedcebb996486be8b56ce9