Question concerning KFileItemModel::setExpanded()
Peter Penz
peter.penz19 at gmail.com
Tue Jan 24 15:07:05 GMT 2012
Hi Frank,
On Saturday 21 January 2012 21:33:24 Frank Reininghaus wrote:
[....]
> 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.
Thanks for the detailed analyses, I just could reproduce the issue.
> 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.
Yes, this is definitely an unwanted behavior and an implementation issue.
> 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.
Hm, I currently see two options:
1. We leave the name + implementation, fix the documentation to match the implementation and adjust the calling code to pass the parent URLs instead.
2. We leave the documentation, fix the implementation so that it only expands the parents and rename the method to avoid confusion (= your suggestion).
When I wrote setExpanded(const QSet<KUrl>& urls) I had in mind to expand only the parent items like said in the documentation. I tend to go for your suggestion, as I also think the two overloaded setExpanded() methods are confusing. I'm not sure about the name - expandParentItems() or setParentItemsExpanded(...)? As we don't have a getter-method and this is no property I'd tend to go for void expandParentItems(const QSet<KUrl>& urls). Do you probably have a better suggestion?
Do you want to take care for proceeding with this task or should I have a look?
Cheers,
Peter
> Best regards,
> Frank
>
More information about the kfm-devel
mailing list