Question concerning KFileItemModel::setExpanded()

Frank Reininghaus frank78ac at googlemail.com
Sat Jan 21 20:33:24 GMT 2012


Hi,

I've looked into
https://bugs.kde.org/show_bug.cgi?id=291781,
which is about Dolphin's Folders Panel failing to activate the current
folder if the path contains spaces. The problem is that the function

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

encodes special characters (like spaces) in the URLs, such that
KFileItemModel::slotCompleted() cannot find the URLs in the model
(which stores unencoded URLs). This can be fixed easily by replacing
"url().url()" by "url().path()" twice in the function.

However, when I thought about writing a unit test for this issue, I
noticed that the function does actually not do what the API docs say.
According to the docs, it should "Expand all parent-items of each
URL", but actually, it does not only expand the parents of the URLs,
but also the URLs themselves.

This has an unwanted effect in the following situation:

1. Use the Details View, expand a folder and click one of its
subfolders, e.g., ~/a/b.
2. Note that not only ~/a/b appears in the Folders Panel, but also all
of its subfolders, e.g., ~/a/b/c, ~/a/b/c2, ...

In contrast, if ~a/b is shown in the Folders panel already, entering
this folder does not expand it in the Panel, so its subfolders remain
invisible.

In other words: If the folder is expanded in the Folders Panel depends
on whether the folder has been shown in the panel already or not, and
this is unwanted behaviour IMHO.

Maybe we should modify KFileItemModel::setExpanded() such that it
really only expands the parents of the given URLs? In that case, maybe
we should also change the name of the function to avoid confustion.

Best regards,
Frank




More information about the kfm-devel mailing list