# class KFileItem |
Definition | `#include <kfileitem.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KFileItem ( const KIO::UDSEntry& _entry, const KURL& _url, bool _determineMimeTypeOnDemand = false, bool _urlIsDirectory = false )
- KFileItem ( mode_t _mode, mode_t _permissions, const KURL& _url, bool _determineMimeTypeOnDemand = false )
- KFileItem ( const KURL &url, const QString &mimeType, mode_t mode )
- KFileItem ( const KFileItem &item )
- virtual ~KFileItem ()
- void refresh ()
- void refreshMimeType ()
- const KURL & url () const
- void setURL ( const KURL &url )
- mode_t permissions () const
- mode_t mode () const
- QString user () const
- QString group () const
- bool isLink () const
- bool isDir () const
- bool isReadable () const
- QString linkDest () const
- long size () const
- time_t time ( unsigned int which ) const
- bool isLocalFile () const
- const QString& text () const
- const QString& name ( bool lowerCase = false ) const
- QString mimetype () const
- KMimeType::Ptr determineMimeType ()
- KMimeType::Ptr mimeTypePtr ()
- bool isMimeTypeKnown () const
- QString mimeComment ()
- QString iconName ()
- QPixmap pixmap ( int _size, int _state=0 ) const
- QString getStatusBarInfo ()
- bool acceptsDrops ( )
- void run ()
- const KIO::UDSEntry & entry () const
- bool isMarked () const
- void mark ()
- void unmark ()
- bool cmp ( const KFileItem & item )
- void assign ( const KFileItem & item )

#### Protected Methods

- void init ( bool _determineMimeTypeOnDemand )

#### Protected Members

- KIO::UDSEntry m_entry
- KURL m_url
- bool m_bIsLocalURL
- QString m_strName
- QString m_strText
- mode_t m_fileMode
- mode_t m_permissions
- mutable QString m_user
- mutable QString m_group
- bool m_bLink
- KMimeType::Ptr m_pMimeType
- mutable QString m_strLowerCaseName

## Detailed Description

KFileItem ( const KIO::UDSEntry& _entry, const KURL& _url, bool _determineMimeTypeOnDemand = false, bool _urlIsDirectory = false ) | ### KFileItem

Create an item representing a file, from an UDSEntry (see kio/global.h) This is the preferred constructor when using KIO::listDir().

Parameters:

_entry | the KIO entry used to get the file, contains info about it
_url | the file url
_determineMimeTypeOnDemand | specifies if the mimetype of the given URL should be determined immediately or on demand
_urlIsDirectory | specifies if the url is just the directory of the fileitem and the filename from the UDSEntry should be used.

KFileItem ( mode_t _mode, mode_t _permissions, const KURL& _url, bool _determineMimeTypeOnDemand = false ) | ### KFileItem

Create an item representing a file, from all the necessary info for it

Parameters:

_mode | the file mode (according to stat()) Set to -1 if unknown. For local files, KFileItem will use stat().
_mode | the mode (S_IFDIR...)
_permissions | the access permissions If you set both the mode and the permissions, you save a ::stat() for local files Set to -1 if you don't know the mode or the permission.
_url | the file url
_determineMimeTypeOnDemand | specify if the mimetype of the given URL should be determined immediately or on demand

KFileItem ( const KURL &url, const QString &mimeType, mode_t mode ) | ### KFileItem

Create an item representing a file, for which the mimetype is already known

Parameters:

url | the file url
mimeType | the name of the file's mimetype
mode | the mode (S_IFDIR...)

KFileItem ( const KFileItem &item ) | ### KFileItem

Copy constructor

~KFileItem () | ### ~KFileItem

[virtual]

Destructor

void refresh () | ### refresh

Re-read information (currently only permissions and mimetype) This is called when the _file_ changes

void refreshMimeType () | ### refreshMimeType

Re-read mimetype information This is called when the mimetype database changes

const KURL & url () | ### url

[const]

Returns: the url of the file

void setURL ( const KURL &url ) | ### setURL

Set the item's URL. Do not call unless you know what you are doing! (used for example when an item got renamed)

mode_t permissions () | ### permissions

[const]

Returns: the permissions of the file (stat.st_mode containing only permissions)

mode_t mode () | ### mode

[const]

Returns: the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...)

QString user () | ### user

[const]

Returns: the owner of the file.

QString group () | ### group

[const]

Returns: the group of the file.

bool isLink () | ### isLink

[const]

Returns: true if this item represents a link in the UNIX sense of a link.

bool isDir () | ### isDir

[const]

Returns: true if this item represents a directory

bool isReadable () | ### isReadable

[const]

Returns: true if the file can be read - more precisely, returns false if we know for sure it can't. In some cases (remote files), we may return true even though it can't be read.

QString linkDest () | ### linkDest

[const]

Returns: the link destination if isLink() == true

long size () | ### size

[const]

Returns: the size of the file, if known

time_t time ( unsigned int which ) | ### time

[const]

Parameters:

which | UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or even UDS_CREATION_TIME

Returns: the time asked for, (time_t)0 if not available

bool isLocalFile () | ### isLocalFile

[const]

Returns: true if the file is a local file

const QString& text () | ### text

[const]

Returns: the text of the file item It's not exactly the filename since some decoding happens ('%2F'->'/')

const QString& name ( bool lowerCase = false ) | ### name

[const]

Returns: the name of the file item (without a path) Similar to text(), but unencoded, i.e. the original name If `lowerCase` is true, the name will be returned in lower case, which is useful to speed up sorting by name, case insensitively.

QString mimetype () | ### mimetype

[const]

Returns: the mimetype of the file item

KMimeType::Ptr determineMimeType () | ### determineMimeType

Returns: the mimetype of the file item If determineMimeTypeOnDemand was used, this will determine the mimetype first.

KMimeType::Ptr mimeTypePtr () | ### mimeTypePtr

Returns: the currently-known mimetype of the file item This will not try to determine the mimetype if unknown.

bool isMimeTypeKnown () | ### isMimeTypeKnown

[const]

QString mimeComment () | ### mimeComment

Returns: the descriptive comment for this mime type, or the mime type itself if none is present.

QString iconName () | ### iconName

Returns: the full path name to the icon that represents this mime type.

QPixmap pixmap ( int _size, int _state=0 ) | ### pixmap

[const]

Returns a pixmap representing the file

Parameters:

_size | Size for the pixmap in pixels. Zero will return the globally configured default size.
_state | The state of the icon: KIcon::DefaultState, KIcon::ActiveState or KIcon::DisabledState.

Returns: the pixmap

QString getStatusBarInfo () | ### getStatusBarInfo

Returns: the string to be displayed in the statusbar e.g. when the mouse is over this item

bool acceptsDrops ( ) | ### acceptsDrops

Returns: true if files can be dropped over this item Contrary to popular belief, not only dirs will return true :) Executables, .desktop files, will do so as well.

void run () | ### run

Let's "KRun" this file ! (e.g. when file is clicked or double-clicked or return is pressed)

const KIO::UDSEntry & entry () | ### entry

[const]

Returns: the UDS entry. Used by the tree view to access all details by position.

bool isMarked () | ### isMarked

[const]

void mark () | ### mark

void unmark () | ### unmark

bool cmp ( const KFileItem & item ) | ### cmp

Somewhat like a comparison operator, but more explicit

void assign ( const KFileItem & item ) | ### assign

Somewhat like an assignment operator, but more explicit

void init ( bool _determineMimeTypeOnDemand ) | ### init

[protected]

Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called again later

KIO::UDSEntry m_entry | ### m_entry

[protected]

KURL m_url | ### m_url

[protected]

bool m_bIsLocalURL | ### m_bIsLocalURL

[protected]

QString m_strName | ### m_strName

[protected]

QString m_strText | ### m_strText

[protected]

mode_t m_fileMode | ### m_fileMode

[protected]

mode_t m_permissions | ### m_permissions

[protected]

mutable QString m_user | ### m_user

[protected]

mutable QString m_group | ### m_group

[protected]

the user and group assigned to the file.

bool m_bLink | ### m_bLink

[protected]

KMimeType::Ptr m_pMimeType | ### m_pMimeType

[protected]

mutable QString m_strLowerCaseName | ### m_strLowerCaseName

[protected]

Generated by: root@sparc.ports.openbsd.org on Wed May 2 09:40:40 2001, using kdoc 2.0a53.