KDirModel with Node for top level URL
Christian Loose
christian.loose at hamburg.de
Sat Mar 8 14:55:26 GMT 2008
Hello everybody,
I'm trying to use KDirModel for the file view in Cervisia. It worked pretty well
so far but there is one thing I need and I can't get it to work. I need a tree node
for the top level URL like "/home/cloose/cvs-src/kde-head/kdepim/kmail" in the
following screenshot: http://cervisia.kde.org/images/screenshots/HEAD/mainview.png.
David suggested a few solutions on kfm-devel:
> * a "show root node" mode in KDirModel itself, but I'm afraid of the code complexity
> if it has to follow one of two logics... Sounds like ugly mixed code in the end.
> * a proxy that "adds" the toplevel node.
> Note that it still needs to do the usual proxy stuff (converting indexes), on top of which
> it needs to present a model with one additional node at the toplevel.
> Has to be done with QAbstractProxyModel, but note that you need to implement many
> methods from the base class, not just those that appear in the QAbstractProxyModel docu.
> * I also thought of a filter proxy model that would remove "all but the wanted root node"
> but this requires listing the parent url of the one we wanted to list in the first place (can
> lead to strange code in the application) and this would prevent having "/" as the root node.
We wonder now who else could have similar needs? What approach would you prefer?
>From Bug #153878 it seems that at least Dolphin could use a similar feature for its folder panel.
Bye,
Christian
More information about the kde-core-devel
mailing list