KIO design decision necessary: unique names in KIO listings

David Faure faure at kde.org
Fri Jan 14 22:28:11 GMT 2011


On Friday 14 January 2011, Sebastian Trueg wrote:
> Hi guys,
> 
> the problem is fairly simple: KIO relies on entry names to be unique.
> That makes sense since there needs to be some way to identify the items
> in a dir listing. This also worked nicely in pre-Nepomuk days.
> 
> However, with the introduction of desktop search the filename is no
> unique identifier anymore. Two query results can have the same name.
> 
> My solution for nepomuksearch was two fold:
> 1. Use an encoded file URL as UDS_NAME
> 2. Use the actual filename as UDS_DISPLAY_NAME
> 
> This works to an extend. As you can see in bug 263169[1] the properties
> dialog (there may be other places) uses UDS_NAME to display item names.
> The reason is that items can be renamed and in KIO terms renaming an
> item means changing its UDS_NAME.
> 
> The question now is:
> Should KIO rename change its meaning to: change UDS_DISPLAY_NAME?

In the properties dialog? From a user point of view, that would make sense, 
since the display name is what the user saw in the directory listing in the 
first place.

But the problem is, rename (KIO::move()) takes urls, not display names.
And for this reason KPropertiesDialog::rename uses the user-entered name as 
"let's append that to the directory url". Won't be any good with a display 
name.

So we have no way currently to rename based on the UDS_DISPLAY_NAME, sounds 
like something that would have to be added; a new kind of job, say 
KIO::renameFile(const KUrl& currentFileUrl, const QString& newName).
Should be used by the propertiesdialog and by inline-renaming.

This sounds like a job for me actually; not that I'm missing jobs :)

And adding "virtual" methods in SlaveBase sounds like a lot of fun... 
virtual_hook would be very ugly... maybe I should use a new interface and 
dynamic_cast...

> Should we define a new way to uniquely identify items in a dir listing?

That's what UDS_NAME is really. Especially since it's used to make up full 
URLs everywhere. I'm definitely not in favour of changing that, it would be 
incompatible and a huge amount of work, and in fact pointless since I don't 
see how that would solve the KIO::move issue.

> IMHO not allowing the renaming of files in a search result listing is
> not an option since.

... since you can't finish sentences? :-P

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).




More information about the kde-core-devel mailing list