[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: mime type for a directory?
From:       Fritz Elfert <felfert () to ! com>
Date:       2001-03-28 0:07:58
[Download RAW message or body]

On Tue, 27 Mar 2001, David Faure wrote:

> On Tuesday 27 March 2001 14:23, David Sweet wrote:
> > In an implementation of the mimeType() method of SlaveBase, what mime type
> > should be returned if the URL points to a directory and not a file?  (I
> > notice that there's inode/directory, but isn't inode an ext2fs-specific term,
> > adn thus inappropriate for a generic, foreign file system?)
>
> That's the name of the mimetype, more of a convention than anything.
> KIO extends the filesystem concept over the network :)
> inode/directory is just fine, but also make sure to set S_IFDIR in the UDS_FILE_TYPE,
> it's what konq uses to determine directories (faster than checking the
> mimetype name).
>
> > What about a link?  Should I determine whether the link points to a file or
> > directory first?
>
> For [sym]links, set the target name in UDS_LINK_DEST,
> do NOT set S_IFLINK in the file type, and set everything else
> to be the target's information (its size, it's file type using S_IFREG
> or S_IFDIR, etc.)
>
> Of course if getting the information about the target is too slow
> (as it is with FTP), you can guess things and go for a "non-complete"
> solution. UDS_GUESSED_MIMETYPE can help for such cases
> (it gives a hint for the icon to be shown, but when clicking on the file
> the mimetype will be re-determined more accurately).
>
>
The problem with UDS_GUESSED_MIMETYPE is, that it has no effect, if
S_IFDIR is set. Setting S_IFDIR always results in showing a folder Icon.
In my kioslave for example, i have Drives of a Psion PDA in the toplevel
(virtual) directory. I want to show different Icons for these. On a
local filesystem, one would do that with a .directory entry which is also
ignored on remote URLs.
So what i do currently do is setting S_IFREG and UDS_GUESSED_MIMETYPE for
the drive's entries during dirList(), and later, when konqueror
re-determines the mimetype return S_IFDIR and the correct mimetype.
Little bit weird, but works.

BTW: Today, i found another funny behavior (can be reproduced with any
remote directory URL regardless of the protocol):
Open the properties dialog, _dont_ change anything but click "OK", then
try to change into the folder by klicking on it. You will get "permission
denied" then even if you have correct permissions.

I traced that down to kfileitem:
The refresh() method of kfileitem is called upon that klick on "OK", this
sets m_permissions to -1 and calls init().  There, mode is first set to 0
and then only updated correctly for local files. -> Results in the above
behavior. Probably resetting mode should go _into_ the
"if (m_url.isLocalFile())" block, but i'm not shure if that probably
breaks other things.

resets the mode to 0, if it is notified by the dirwatcher to  Ciao
 -Fritz
-- 
Fritz Elfert <felfert@to.com>               Thinking Objects Software GmbH
Kranstraße 8                                      Phone: +49 711 838981 50
70499 Stuttgart                                     FAX: +49 711 838981 69
--------------------------------------------------------------------------


>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic