Question concerning KFileItemModel::setExpanded()

Peter Penz peter.penz19 at gmail.com
Fri Feb 3 19:04:20 GMT 2012


On 02/03/2012 07:08 PM, Frank Reininghaus wrote:
> Hi,
>
> Am 24. Januar 2012 16:07 schrieb Peter Penz:
> [...]
>>> 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?
>
> I just noticed that KFileItemModel::setExpanded(const QSet<KUrl>&
> urls) is also called in FoldersPanel::setHiddenFilesShown(),
> apparently to restore expanded folders when the hidden files setting
> is toggled. However, I don't really see why this is necessary, and it
> seems that commenting out that line has no effect here. Peter, can you
> comment on why that call is made there?

This call can be removed in the meantime. It originally has been 
necessary when the folders panel worked with KDirLister directly. Now as 
it works on KFileItemModel this is not necessary anymore - I simply 
forgot to remove this 2 lines after extending KFileItemModel :-/

I'll remove this line, thanks for the hint!

Peter

> Thanks,
> Frank





More information about the kfm-devel mailing list