[PATCH] UDS_TARGET_URL and UDS_DISPLAY_NAME
faure at kde.org
Fri Feb 22 11:27:27 GMT 2008
On Friday 22 February 2008, Vlad wrote:
> --- nf2 <nf2 at scheinwelt.at> wrote:
> > Hi,
> > This patch adds two new field types to KIO::UDSEntry:
> > UDS_TARGET_URL: for special file-items pointing to a different
> > hierarchy
> > (quite useful in remote:// and smb://workgroup,...). The
> > filemanegers/-dialogs can open the target-url instantly when you
> > click
> > on such an item. Therefore you don't need the redirection() trick
> > anymore.
> > UDS_DISPLAY_NAME: this optional field sets m_strText in KFileItem
> > (overrides UDS_NAME) to display a label different from the real
> > filename.
This one is a must have in any case. I would recommend committing
UDS_DISPLAY_NAME support and porting kio_trash to it, independently
from the rest.
> > The first patch also makes KDirOperator switch the Url instantly
> > when
> > you click on a file-item which has UDS_TARGET_URL set. Therefore
> > file-dialogs follow such links appropriately. The second patch
> > implements the same feature for Dolphin. Unfortunately I didn't find
> > the right code in Konqueror yet to add this feature.
Konqueror uses dolphin :)
> I don't think it's wise to implement a URL redirection scheme that
> requires every single KDE app to be individually modified in order to
> make it aware of the redirection. This introduces a number of
> loopholes, such as when a URL is acquired from anywhere except the
> file dialog. For example, passing a URL to an application on the
> command line will result in that URL remaining untranslated.
But why would you pass a URL like smb://workgroup/host on the command line,
when the file manager gives you smb://host automatically? The intermediate
smb://workgroup/host URL doesn't appear anywhere to the user, it's just a URL
used internally in the directory listing.
This is for file managers and the file dialog (and KDirOperator), other apps don't
navigate between directories themselves, do they? (or if they do, they use the
file dialog or KDirOperator to do that). The argument "modify all apps" needs to
be backed up with which apps exactly would need to be modified...
Anyway I agree that UDS_TARGET_URL is more of a stop-gap measure so
that kio_smb and other slaves (remote:/ ?) work in 4.0.2 and that the real solution is to implement support
for child items not starting with the URL of their parent item in KDirLister+KDirModel,
but this will take a bit more time (I want to do it at some point, but it's a bit tricky).
But even when that's done, there's still a difference between "this item's URL is <foo>" (UDS_URL)
and "this items makes you go to <foo>" (UDS_TARGET_URL). nf2 mentionned for instance mount points,
where you want the (auto) mount action to happen only once you click on it,
not when you're stat'ing the item's url for previews, metainfo, child count etc.
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel