D25315: KDirModel: implement showing "/" as a root node, optionally
Raphael Rosch
noreply at phabricator.kde.org
Fri Feb 28 21:30:21 GMT 2020
rrosch added a comment.
> Keep only matters for further calls to openUrl, not the first one. It's about whether to *add* or *replace* the currently open URL.
> KDirModel takes care of that.
Ah ok, so it's going to do that without me needing to explicitly specify "Keep"?
>> I couldn't however get the following to work:
>>
>> QModelIndex index = getIndexFromUrl("/home/myuser");
>
> Invalid URL, that's a path, not a URL. You need QUrl::fromLocalFile().
Sorry that was me using shorthand to illustrate the problem, the url in the code is an absolute url stored in a variable with the schema and all the necessary things.
>> Which should show the node for "/home" as the root, but is instead giving me a flat listing of all the child nodes without "/home" as the root.
>
> Oh, hmm, that's not how setRootIndex works (that's a *view* feature, we can't change that).
> I changed the model to have one more node for "/", while I see now that what you want is that it *always* shows a root node even when the root is another directory.
Yeah that was my intent with the above. How come it doesn't work in the view for `file:///home/myuser` but it works for `file:///`?
In any case, the code here you provided works great for at least `file:///` and that gets us quite far. How much of a rework would getting it to work with subdirectories (like `file:///home/myuser`) take?
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D25315
To: dfaure, stefanocrocco, elvisangelaccio, meven, apol
Cc: rrosch, kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200228/880c30bc/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list