KDirLister::rootItem() sometimes returns a null KFileItem

Frank Reininghaus frank78ac at googlemail.com
Sat Jan 18 17:28:02 GMT 2014


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




More information about the kfm-devel mailing list