From kfm-devel Sat Jan 18 18:22:16 2014 From: Mark Gaiser Date: Sat, 18 Jan 2014 18:22:16 +0000 To: kfm-devel Subject: Re: KDirLister::rootItem() sometimes returns a null KFileItem Message-Id: X-MARC-Message: https://marc.info/?l=kfm-devel&m=139006938026385 On Sat, Jan 18, 2014 at 6:28 PM, Frank Reininghaus 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