Bug 291781

Summary: dolphin (kde-4.8rc2) does not synchronize folderview on the left with opened folder on the right in some cases
Product: [Applications] dolphin Reporter: H.H. <cyberbeat>
Component: panels: foldersAssignee: Peter Penz <peter.penz19>
Status: RESOLVED FIXED    
Severity: normal CC: frank78ac, gedgon
Priority: NOR Keywords: investigated
Version: 2.0   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In: 4.8.1

Description H.H. 2012-01-17 15:08:36 UTC
Version:           2.0 (using Devel) 
OS:                Linux

When I open a folder, which has a folder with a "space" character in its path, the folderview on the left does not open/select/scrollto that folder.

for example a path like

/xxx/xx/xxx xxx/xxx

I am not sure if spaces are the problem, but this is the only differences I notice between working and not-working cases.

Reproducible: Always

Steps to Reproduce:
see above

Actual Results:  
see above

Expected Results:  
see above

OS: Linux (x86_64) release 2.6.37.1-1.2-desktop
Compiler: gcc
Comment 1 Frank Reininghaus 2012-01-18 22:43:44 UTC
Thanks for the bug report! I can confirm the problem.
Comment 2 Frank Reininghaus 2012-01-19 08:00:00 UTC
The problem is in

void KFileItemModel::setExpanded(const QSet<KUrl>& urls).

This function contains the line

const QStringList subDirs = url.url().mid(pos).split(QDir::separator());

to determine a chain of sub folders leading to the url to be expanded. However, KUrl::url() returns a QString where special characters like spaces are encoded -> "xxx xxx" becomes "xxx%2520xxx". The expansion algorithm in KFileItemModel::slotCompleted() then fails to find the encoded url in the model.

So we should transform the KUrl to a QString without encoding it. I'll have a look at that later.
Comment 3 gedgon 2012-01-23 18:08:05 UTC
*** Bug 290721 has been marked as a duplicate of this bug. ***
Comment 4 Frank Reininghaus 2012-01-25 20:34:00 UTC
Git commit 80d9bfec580bf01b0ee584fc4bb46e3d59a0ba7c by Frank Reininghaus.
Committed on 25/01/2012 at 21:30.
Pushed by freininghaus into branch 'KDE/4.8'.

Handle folder names containing spaces correctly in the Folders Panel

The problem was that KFileItemModel::setExpanded() used KUrl::url()
to determine the names of the subfolders. This method encodes special
characters, such that comparing the folder names with the unencoded URLs
stored in the model fails.
Using KUrl::path(), which does not encode special characters, fixes the
problem.
FIXED-IN: 4.8.1

M  +2    -2    dolphin/src/kitemviews/kfileitemmodel.cpp

http://commits.kde.org/kde-baseapps/80d9bfec580bf01b0ee584fc4bb46e3d59a0ba7c
Comment 5 Frank Reininghaus 2012-01-25 20:37:27 UTC
Git commit e6e8e6fdc1a4d50364b9479b1de7d8fc3b5c0c64 by Frank Reininghaus.
Committed on 25/01/2012 at 21:30.
Pushed by freininghaus into branch 'master'.

Handle folder names containing spaces correctly in the Folders Panel

The problem was that KFileItemModel::setExpanded() used KUrl::url()
to determine the names of the subfolders. This method encodes special
characters, such that comparing the folder names with the unencoded URLs
stored in the model fails.
Using KUrl::path(), which does not encode special characters, fixes the
problem.
FIXED-IN: 4.8.1
(cherry picked from commit 80d9bfec580bf01b0ee584fc4bb46e3d59a0ba7c)

M  +2    -2    dolphin/src/kitemviews/kfileitemmodel.cpp

http://commits.kde.org/kde-baseapps/e6e8e6fdc1a4d50364b9479b1de7d8fc3b5c0c64