Question about KDirLister and hiding expanded directories

Frank Reininghaus frank78ac at googlemail.com
Sun Jan 6 16:47:38 GMT 2013


Hi David,

2013/1/6 David Faure:
> On Saturday 05 January 2013 14:49:11 Frank Reininghaus wrote:
>> after debugging a Dolphin crash,
>
> Hi Frank, nice piece of debugging :)
>
>> https://bugs.kde.org/show_bug.cgi?id=311947
>>
>> I have another question about KDirLister. The problem is the
>> following: assuming we have folders ~/a and ~/a/b, renaming ~/a to
>> ~/.a (and thus hiding it) will have the following effects:
>>
>> 1. KDirLister's refreshItems signal reports that the name of ~/a/b
>> changes to ~/.a/b.
>> 2. It then reports that ~/a has been deleted.
>
> I assume KDirLister's builtin "hiding of dot files" is being used, then.

Yes.

>> KDirModel does not suffer from this problem because each
>> KDirModelDirNode node keeps a list of its children, so the
>> parent-child relationship is not affected by the ~/a/b -> ~/.a/b
>> change.
>
> One day we should merge KDirLister and KDirModel's data structures...
>
>> So my question is: Would you agree that emitting the refreshItems
>> signal for a child of the directory that is being hidden is sort of
>> unexpected?
>
> Yes, I guess I agree. Even though the directory was effectively renamed on
> disk, in a KDirLister which is set to "hiding dot files", the outside view (for
> the user of KDirLister) is that the directory was "removed".
>
>> And if yes, is there an easy way to fix this?
>
> I'll need to look into that.
>
>> The alternative might be to move the entire "hidden files" filtering
>> to the model. Given that we already do filtering by name and mime type
>> inside the model, this looks more consistent anyway.
>
> Which model? The dolphin-specific one? Doesn't seem like the right layer for
> the fix.

>From the Dolphin point of view, there are only two layers: KDirLister
and (Dolphin's) KFileItemModel. KFileItemModel has filtering and
sorting built in, whereas KDirModel would need a proxy model for that.
It was Peter's idea to put it all into the same class, and I must say
that not needing all those mapToSource any more really does make
development easier.

So the only options that Dolphin has for "hidden files" filtering are
either the dir lister or the model. I just thought that filtering by
name, mime-type and "hidden" status do share some concepts, so having
these at the same location in the code might make sense. But if the
issue causing the bug is changed in KDirLister, that's also fine for
me.

Thanks and best regards,
Frank




More information about the kfm-devel mailing list