KDirLister::rootItem() sometimes returns a null KFileItem

Mark Gaiser markg85 at gmail.com
Sat Jan 18 18:22:16 GMT 2014


On Sat, Jan 18, 2014 at 6:28 PM, Frank Reininghaus
<frank78ac at googlemail.com> wrote:
> Dear KIO experts,
>
> to determine if the "Create New..." menu should be enabled for the
> current URL in Dolphin, we wait for the KDirLister's completed()
> signal, then create a KFileItemListProperties instance for a
> KFileItemList containing the dir lister's root item, and check the
> return value of KFileItemListProperties::supportsWriting().
>
> This works fine most of the time, but now we have this bug:
>
> https://bugs.kde.org/show_bug.cgi?id=330001
>
> The "Create New..." menu is disabled in a writable directory for the
> reporter, and according to the debug output that we got, this is
> because the dir lister's rootItem() is a null KFileItem.
>
> The documentation of this function says "Can return an empty
> KFileItem.", but it was my understanding that the root item should be
> valid after the completed() signal is emitted.
>
> We can in principle work around this problem easily (setup a KFileItem
> with the current url() if the root item is null, and use this for the
> "supportsWriting()" check), but before we commit this and possibly
> hide the real problem, I thought I'd better ask you if you know what
> might be going wrong.
>
> Thanks and best regards,
> Frank

Hi Frank,

I think you've uncovered some kind of corner case.

I apparently am in the "lucky" position where i can test this for you
since i have it on my dolphin and a samba share.
If you have some testcases for me to run, i'd be happy to give it a run.

Cheers,
Mark




More information about the kfm-devel mailing list