kio Library API Documentation

KFileItem Class Reference

A KFileItem is a generic class to handle a file, local or remote. More...

#include <kfileitem.h>

Collaboration diagram for KFileItem:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { Unknown = (mode_t) - 1 }

Public Member Functions

 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 KURLurl () const
void setURL (const KURL &url)
void setName (const QString &name)
mode_t permissions () const
QString permissionsString () const
mode_t mode () const
QString user () const
QString group () const
bool isLink () const
bool isDir () const
bool isFile () const
bool isReadable () const
bool isWritable () const
bool isHidden () const
QString linkDest () const
QString localPath () const
KIO::filesize_t size () const
time_t time (unsigned int which) const
QString timeString (unsigned int which=KIO::UDS_MODIFICATION_TIME) const
bool isLocalFile () const
const QStringtext () const
const QStringname (bool lowerCase=false) const
QString mimetype () const
KMimeType::Ptr determineMimeType ()
KMimeType::Ptr mimeTypePtr () const
bool isMimeTypeKnown () const
QString mimeComment ()
QString iconName ()
QPixmap pixmap (int _size, int _state=0) const
int overlays () const
QString getStatusBarInfo ()
QString getToolTipText (int maxcount=6)
bool acceptsDrops ()
void run ()
const KIO::UDSEntryentry () const
bool isMarked () const
void mark ()
void unmark ()
bool cmp (const KFileItem &item)
virtual void setExtraData (const void *key, void *value)
virtual const void * extraData (const void *key) const
virtual void * extraData (const void *key)
virtual void removeExtraData (const void *key)
void setMetaInfo (const KFileMetaInfo &info)
const KFileMetaInfometaInfo (bool autoget=true, int what=KFileMetaInfo::Fastest) const
void assign (const KFileItem &item)
void setUDSEntry (const KIO::UDSEntry &entry, const KURL &url, bool determineMimeTypeOnDemand=false, bool urlIsDirectory=false)
KFileItemoperator= (const KFileItem &)
KURL mostLocalURL (bool &local) const

Protected Member Functions

void init (bool _determineMimeTypeOnDemand)
void readUDSEntry (bool _urlIsDirectory)
QString parsePermissions (mode_t perm) const
virtual void virtual_hook (int id, void *data)

Friends

KIO_EXPORT friend QDataStreamoperator<< (QDataStream &s, const KFileItem &a)
KIO_EXPORT friend QDataStreamoperator>> (QDataStream &s, KFileItem &a)

Detailed Description

A KFileItem is a generic class to handle a file, local or remote.

In particular, it makes it easier to handle the result of KIO::listDir (UDSEntry isn't very friendly to use). It includes many file attributes such as mimetype, icon, text, mode, link...

Definition at line 40 of file kfileitem.h.


Constructor & Destructor Documentation

KFileItem::KFileItem const KIO::UDSEntry _entry,
const KURL _url,
bool  _determineMimeTypeOnDemand = false,
bool  _urlIsDirectory = false
 

Creates an item representing a file, from a UDSEntry.

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.

Definition at line 54 of file kfileitem.cpp.

References init(), and readUDSEntry().

KFileItem::KFileItem mode_t  _mode,
mode_t  _permissions,
const KURL _url,
bool  _determineMimeTypeOnDemand = false
 

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

Parameters:
_mode the file mode (according to stat() (e.g. S_IFDIR...) Set to KFileItem::Unknown if unknown. For local files, KFileItem will use stat().
_permissions the access permissions If you set both the mode and the permissions, you save a stat() for local files. Set to KFileItem::Unknown 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

Definition at line 71 of file kfileitem.cpp.

References init().

KFileItem::KFileItem const KURL url,
const QString mimeType,
mode_t  mode
 

Creates 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...)

Definition at line 88 of file kfileitem.cpp.

References init(), and KMimeType::mimeType().

KFileItem::KFileItem const KFileItem item  ) 
 

Copy constructor.

Note that extra-data set via setExtraData() is not deeply copied -- just the pointers are copied.

Definition at line 107 of file kfileitem.cpp.

References assign().

KFileItem::~KFileItem  )  [virtual]
 

Destructs the KFileItem.

Extra data set via setExtraData() is not deleted.

Definition at line 119 of file kfileitem.cpp.


Member Function Documentation

void KFileItem::refresh  ) 
 

Throw away and re-read (for local files) all information about the file.

This is called when the _file_ changes.

Definition at line 250 of file kfileitem.cpp.

References init().

void KFileItem::refreshMimeType  ) 
 

Re-reads mimetype information.

This is called when the mimetype database changes.

Definition at line 267 of file kfileitem.cpp.

References init().

const KURL& KFileItem::url  )  const [inline]
 

Returns the url of the file.

Returns:
the url of the file

Definition at line 112 of file kfileitem.h.

Referenced by KFileIconView::contentsDropEvent(), KFileDetailView::contentsDropEvent(), determineMimeType(), KFileDialog::fileHighlighted(), KFileDialog::fileSelected(), KImageFilePreview::gotPreview(), iconName(), init(), KFileIconView::insertItem(), KFileDetailView::insertItem(), KDirOperator::insertNewFiles(), KPropsDlgPlugin::isDesktopFile(), KFilePropsPlugin::KFilePropsPlugin(), metaInfo(), mimeComment(), mostLocalURL(), KFileTreeViewItem::path(), pixmap(), KDirSize::processList(), KIO::ChmodJob::processList(), run(), KDirOperator::selectDir(), KFilePropsPlugin::slotCopyFinished(), KFilePreview::slotHighlighted(), KFilePropsPlugin::slotSizeDetermine(), and KFileTreeViewItem::url().

void KFileItem::setURL const KURL url  ) 
 

Sets the item's URL.

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

Parameters:
url the item's URL

Definition at line 273 of file kfileitem.cpp.

References KURL::fileName(), and setName().

void KFileItem::setName const QString name  ) 
 

Sets the item's name (i.e.

the filename). This is automatically done by setURL, to set the name from the URL's fileName(). This method is provided for some special cases like relative paths as names (KFindPart)

Parameters:
name the item's name

Definition at line 279 of file kfileitem.cpp.

References KIO::decodeFileName().

Referenced by KFileIconView::insertItem(), KFileDetailView::insertItem(), and setURL().

mode_t KFileItem::permissions  )  const [inline]
 

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

Returns:
the permissions of the file

Definition at line 133 of file kfileitem.h.

Referenced by KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin(), and KIO::ChmodJob::processList().

QString KFileItem::permissionsString  )  const
 

Returns the access permissions for the file as a string.

Returns:
the access persmission as string

Definition at line 880 of file kfileitem.cpp.

References QString::isNull(), and parsePermissions().

Referenced by KFileListViewItem::init().

mode_t KFileItem::mode  )  const [inline]
 

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

..).

Returns:
the file type

Definition at line 145 of file kfileitem.h.

Referenced by acceptsDrops(), init(), KPropsDlgPlugin::isDesktopFile(), KFilePropsPlugin::KFilePropsPlugin(), and KSimpleFileFilter::passesFilter().

QString KFileItem::user  )  const
 

Returns the owner of the file.

Returns:
the file's owner

Definition at line 391 of file kfileitem.cpp.

References QFile::encodeName(), QString::fromLocal8Bit(), QString::isEmpty(), and KURL::path().

Referenced by getToolTipText(), KFileListViewItem::init(), and KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin().

QString KFileItem::group  )  const
 

Returns the group of the file.

Returns:
the file's group

Definition at line 406 of file kfileitem.cpp.

References QFile::encodeName(), QString::fromLocal8Bit(), QString::isEmpty(), KURL::path(), and QString::sprintf().

Referenced by getToolTipText(), KFileListViewItem::init(), and KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin().

bool KFileItem::isLink  )  const [inline]
 

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

Returns:
true if the file is a link

Definition at line 164 of file kfileitem.h.

Referenced by KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin(), KFilePropsPlugin::KFilePropsPlugin(), parsePermissions(), KDirSize::processList(), and KIO::ChmodJob::processList().

bool KFileItem::isDir  )  const
 

Returns true if this item represents a directory.

Returns:
true if the item is a directory

Definition at line 606 of file kfileitem.cpp.

References endl(), and kdDebug().

Referenced by KFileViewSignaler::activate(), KFileDialog::fileHighlighted(), KFileDialog::fileSelected(), KCombiView::insertItem(), KDirOperator::insertNewFiles(), KFileTreeViewItem::isDir(), KDirLister::itemsForDir(), KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin(), KFilePropsPlugin::KFilePropsPlugin(), KDirLister::matchesFilter(), parsePermissions(), KDirOperator::prepareCompletionObjects(), KDirSize::processList(), KIO::ChmodJob::processList(), KFileView::removeItem(), KFileDialog::setSelection(), KFileIconView::setSorting(), and KFileView::updateNumbers().

bool KFileItem::isFile  )  const [inline]
 

Returns true if this item represents a file (and not a a directory).

Returns:
true if the item is a file

Definition at line 176 of file kfileitem.h.

Referenced by KFileView::updateNumbers().

bool KFileItem::isReadable  )  const
 

Checks whether the file or directory is readable.

In some cases (remote files), we may return true even though it can't be read.

Returns:
true if the file can be read - more precisely, false if we know for sure it can't

Definition at line 556 of file kfileitem.cpp.

References QFile::encodeName(), and KURL::path().

Referenced by overlays().

bool KFileItem::isWritable  )  const
 

Checks whether the file or directory is writable.

In some cases (remote files), we may return true even though it can't be written to.

Returns:
true if the file or directory can be written to - more precisely, false if we know for sure it can't
Since:
3.4

Definition at line 577 of file kfileitem.cpp.

References QFile::encodeName(), and KURL::path().

Referenced by acceptsDrops().

bool KFileItem::isHidden  )  const
 

Checks whether the file is hidden.

Returns:
true if the file is hidden.

Definition at line 598 of file kfileitem.cpp.

References KURL::fileName(), and KURL::isEmpty().

Referenced by overlays().

QString KFileItem::linkDest  )  const
 

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

Returns:
the link destination. QString::null if the item is not a link

Definition at line 285 of file kfileitem.cpp.

References QValueList::begin(), QValueList::ConstIterator(), QFile::decodeName(), QFile::encodeName(), QValueList::end(), KURL::path(), and KIO::UDS_LINK_DEST.

Referenced by getStatusBarInfo(), getToolTipText(), KFilePropsPlugin::KFilePropsPlugin(), and run().

QString KFileItem::localPath  )  const
 

Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom.

Returns:
the item local path, or QString::null if not known
Since:
3.4

Definition at line 306 of file kfileitem.cpp.

References QValueList::begin(), QValueList::ConstIterator(), QValueList::end(), KURL::path(), and KIO::UDS_LOCAL_PATH.

Referenced by mostLocalURL(), and KPropertiesDialog::showDialog().

KIO::filesize_t KFileItem::size  )  const
 

Returns the size of the file, if known.

Returns:
the file size, or 0 if not known

Definition at line 325 of file kfileitem.cpp.

References QValueList::begin(), QValueList::ConstIterator(), QFile::encodeName(), QValueList::end(), KURL::path(), and KIO::UDS_SIZE.

Referenced by cmp(), getStatusBarInfo(), getToolTipText(), KFileListViewItem::init(), KFilePropsPlugin::KFilePropsPlugin(), KDirSize::processList(), and KFileIconView::setSorting().

time_t KFileItem::time unsigned int  which  )  const
 

Requests the modification, access or creation time, depending on which.

Parameters:
which UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or even UDS_CREATION_TIME
Returns:
the time asked for, (time_t)0 if not available
See also:
timeString()

Definition at line 347 of file kfileitem.cpp.

References QValueList::begin(), QValueList::ConstIterator(), QFile::encodeName(), QValueList::end(), KURL::path(), KIO::UDS_ACCESS_TIME, KIO::UDS_CREATION_TIME, and KIO::UDS_MODIFICATION_TIME.

Referenced by cmp(), KFilePropsPlugin::KFilePropsPlugin(), KFileIconView::setSorting(), and timeString().

QString KFileItem::timeString unsigned int  which = KIO::UDS_MODIFICATION_TIME  )  const
 

Requests the modification, access or creation time as a string, depending on which.

Parameters:
which UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or even UDS_CREATION_TIME
Returns:
a formatted string of the requested time.
See also:
time

Definition at line 922 of file kfileitem.cpp.

References KLocale::formatDateTime(), KGlobal::locale(), QDateTime::setTime_t(), and time().

Referenced by getToolTipText(), and KFileListViewItem::init().

bool KFileItem::isLocalFile  )  const [inline]
 

Returns true if the file is a local file.

Returns:
true if the file is local, false otherwise

Definition at line 242 of file kfileitem.h.

Referenced by KPropsDlgPlugin::isDesktopFile().

const QString& KFileItem::text  )  const [inline]
 

Returns the text of the file item.

It's not exactly the filename since some decoding happens ('2F'->'/').

Returns:
the text of the file item

Definition at line 249 of file kfileitem.h.

Referenced by getStatusBarInfo(), getToolTipText(), KFileListViewItem::init(), KFileTreeViewItem::KFileTreeViewItem(), KDirLister::matchesFilter(), and KFileIconView::setSorting().

const QString& KFileItem::name bool  lowerCase = false  )  const [inline]
 

Return the name of the file item (without a path).

Similar to text(), but unencoded, i.e. the original name.

Parameters:
lowerCase if true, the name will be returned in lower case, which is useful to speed up sorting by name, case insensitively.
Returns:
the file's name

Definition at line 258 of file kfileitem.h.

References QString::lower().

Referenced by KFileDialog::fileHighlighted(), KFileDialog::fileSelected(), KFilePropsPlugin::KFilePropsPlugin(), KFileDialog::multiSelectionChanged(), KSimpleFileFilter::passesFilter(), KDirOperator::prepareCompletionObjects(), and KFileView::setCurrentItem().

QString KFileItem::mimetype  )  const
 

Returns the mimetype of the file item.

If _determineMimeTypeOnDemand was used in the constructor, this will determine the mimetype first. Equivalent to determineMimeType()->name()

Returns:
the mime type of the file

Definition at line 427 of file kfileitem.cpp.

References determineMimeType().

Referenced by acceptsDrops(), cmp(), KFileIconView::insertItem(), KFileDetailView::insertItem(), KPropsDlgPlugin::isDesktopFile(), KFilePropsPlugin::KFilePropsPlugin(), KDirLister::matchesMimeFilter(), and metaInfo().

KMimeType::Ptr KFileItem::determineMimeType  ) 
 

Returns the mimetype of the file item.

If _determineMimeTypeOnDemand was used in the constructor, this will determine the mimetype first.

Returns:
the mime type

Definition at line 433 of file kfileitem.cpp.

References KMimeType::findByURL(), mostLocalURL(), and url().

Referenced by assign(), KFileIconView::determineIcon(), KFileDetailView::determineIcon(), getStatusBarInfo(), iconName(), mimeComment(), and mimetype().

KMimeType::Ptr KFileItem::mimeTypePtr  )  const [inline]
 

Returns the currently known mimetype of the file item.

This will not try to determine the mimetype if unknown.

Returns:
the known mime type

Definition at line 288 of file kfileitem.h.

Referenced by KSimpleFileFilter::passesFilter().

QString KFileItem::mimeComment  ) 
 

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

Returns:
the mime type description, or the mime type itself

Definition at line 456 of file kfileitem.cpp.

References determineMimeType(), QString::isEmpty(), mostLocalURL(), and url().

Referenced by getStatusBarInfo(), getToolTipText(), and KFilePropsPlugin::KFilePropsPlugin().

QString KFileItem::iconName  ) 
 

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

Returns:
iconName the name of the file's icon

Definition at line 471 of file kfileitem.cpp.

References determineMimeType(), mostLocalURL(), and url().

QPixmap KFileItem::pixmap int  _size,
int  _state = 0
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

Definition at line 510 of file kfileitem.cpp.

References KIcon::Desktop, endl(), KURL::fileName(), KMimeType::findByURL(), KServiceType::icon(), QString::isEmpty(), QPixmap::isNull(), kdWarning(), QString::left(), QString::length(), KMimeType::mimeType(), mostLocalURL(), overlays(), KURL::path(), QString::right(), KURL::setPath(), KGlobal::staticQString(), and url().

Referenced by KFileTreeView::dragObject(), KFileIconView::dragObject(), KFileDetailView::dragObject(), KFileListViewItem::init(), KFileTreeView::itemIcon(), KFileTreeViewItem::KFileTreeViewItem(), and KFileDetailView::updateView().

int KFileItem::overlays  )  const
 

Returns the overlays (bitfield of KIcon::*Overlay flags) that are used for this item's pixmap.

Overlays are used to show for example, whether a file can be modified.

Returns:
the overlays of the pixmap

Definition at line 482 of file kfileitem.cpp.

References KURL::fileName(), KIcon::HiddenOverlay, KNFSShare::instance(), KSambaShare::instance(), KNFSShare::isDirectoryShared(), isHidden(), isReadable(), KIcon::LinkOverlay, KIcon::LockOverlay, KURL::path(), QString::right(), KIcon::ShareOverlay, and KIcon::ZipOverlay.

Referenced by pixmap().

QString KFileItem::getStatusBarInfo  ) 
 

Returns the string to be displayed in the statusbar, e.g.

when the mouse is over this item

Returns:
the status bar information

Definition at line 645 of file kfileitem.cpp.

References QString::arg(), KIO::convertSize(), determineMimeType(), QString::isEmpty(), linkDest(), mimeComment(), size(), and text().

QString KFileItem::getToolTipText int  maxcount = 6  ) 
 

Returns the string to be displayed in the tool tip when the mouse is over this item.

This may load a plugin to determine additional information specific to the mimetype of the file.

Parameters:
maxcount the maximum number of entries shown
Returns:
the tool tip string

Definition at line 681 of file kfileitem.cpp.

References QString::append(), QString::arg(), KFileMetaInfoItem::attributes(), KIO::convertSize(), QStyleSheet::escape(), group(), QString::isEmpty(), KFileMetaInfo::isEmpty(), KFileMetaInfoItem::isValid(), KFileMetaInfo::isValid(), KFileMetaInfo::item(), QString::length(), linkDest(), KGlobal::locale(), metaInfo(), mimeComment(), parsePermissions(), KFileMetaInfo::preferredKeys(), size(), KFileMimeTypeInfo::SqueezeText, KFileMetaInfoItem::string(), text(), timeString(), KFileMetaInfoItem::translatedKey(), QString::truncate(), KIO::UDS_MODIFICATION_TIME, and user().

bool KFileItem::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.

Returns:
true if you can drop files over the item

Definition at line 624 of file kfileitem.cpp.

References QFile::encodeName(), isWritable(), mimetype(), mode(), and KURL::path().

void KFileItem::run  ) 
 

Let's "KRun" this file ! (e.g.

when file is clicked or double-clicked or return is pressed)

Definition at line 758 of file kfileitem.cpp.

References linkDest(), mostLocalURL(), and url().

const KIO::UDSEntry& KFileItem::entry  )  const [inline]
 

Returns the UDS entry.

Used by the tree view to access all details by position.

Returns:
the UDS entry

Definition at line 359 of file kfileitem.h.

bool KFileItem::isMarked  )  const [inline]
 

Used when updating a directory.

marked == seen when refreshing.

Returns:
true if the file item is marked

Definition at line 365 of file kfileitem.h.

void KFileItem::mark  )  [inline]
 

Marks the item.

See also:
isMarked()

Definition at line 370 of file kfileitem.h.

void KFileItem::unmark  )  [inline]
 

Unmarks the item.

See also:
isMarked()

Definition at line 375 of file kfileitem.h.

bool KFileItem::cmp const KFileItem item  ) 
 

Somewhat like a comparison operator, but more explicit.

Parameters:
item the item to compare
Returns:
true if all values are equal

Definition at line 770 of file kfileitem.cpp.

References d, m_bIsLocalURL, m_bLink, m_fileMode, m_group, m_permissions, m_strName, m_user, mimetype(), size(), time(), and KIO::UDS_MODIFICATION_TIME.

void KFileItem::setExtraData const void *  key,
void *  value
[virtual]
 

This allows to associate some "extra" data to a KFileItem.

As one KFileItem can be used by several objects (often views) which all need to add some data, you have to use a key to reference your extra data within the KFileItem.

That way a KFileItem can hold and provide access to all those views separately.

I.e. a KFileIconView that associates a KFileIconViewItem (an item suitable for use with QIconView) does

 kfileItem->setExtraData( this, iconViewItem );

and can later access the iconViewItem by doing

 KFileIconViewItem *iconViewItem = static_cast<KFileIconViewItem*>( kfileItem->extraData( this ));

This is usually more efficient then having every view associate data to items by using a separate QDict or QMap.

Note: you have to remove and destroy the data you associated yourself when you don't need it anymore!

Parameters:
key the key of the extra data
value the value of the extra data
See also:
extraData

removeExtraData

Definition at line 851 of file kfileitem.cpp.

References QMap::replace().

Referenced by KFileIconView::insertItem(), and KFileDetailView::insertItem().

const void * KFileItem::extraData const void *  key  )  const [virtual]
 

Retrieves the extra data with the given key.

Parameters:
key the key of the extra data
Returns:
the extra data associated to an item with key via setExtraData. 0L if nothing was associated with key.
See also:
extraData

Definition at line 859 of file kfileitem.cpp.

References QMapConstIterator::data(), QMap::end(), and QMap::find().

Referenced by KFileDetailView::ensureItemVisible(), KFileTreeView::findItem(), KFileTreeBranch::findTVIByURL(), KFileDetailView::isSelected(), KFileDetailView::removeItem(), KFileDetailView::setCurrentItem(), KFileDetailView::setSelected(), and KFileDetailView::updateView().

void * KFileItem::extraData const void *  key  )  [virtual]
 

Retrieves the extra data with the given key.

Parameters:
key the key of the extra data
Returns:
the extra data associated to an item with key via setExtraData. 0L if nothing was associated with key.
See also:
extraData

Definition at line 867 of file kfileitem.cpp.

References QMapIterator::data(), QMap::end(), and QMap::find().

void KFileItem::removeExtraData const void *  key  )  [virtual]
 

Removes the extra data associated with an item via key.

Parameters:
key the key of the extra data to remove

Definition at line 875 of file kfileitem.cpp.

References QMap::remove().

Referenced by KFileIconViewItem::~KFileIconViewItem(), and KFileTreeViewItem::~KFileTreeViewItem().

void KFileItem::setMetaInfo const KFileMetaInfo info  ) 
 

Sets the metainfo of this item to info.

Parameters:
info the new meta info

Definition at line 929 of file kfileitem.cpp.

Referenced by KFileMetaPropsPlugin::KFileMetaPropsPlugin().

const KFileMetaInfo & KFileItem::metaInfo bool  autoget = true,
int  what = KFileMetaInfo::Fastest
const
 

Returns the metainfo of this item.

Parameters:
autoget if true, the metainfo will automatically be created
what ignored

Definition at line 934 of file kfileitem.cpp.

References KFileMetaInfo::isValid(), mimetype(), mostLocalURL(), KGlobalSettings::showFilePreview(), and url().

Referenced by getToolTipText(), and KFileMetaPropsPlugin::KFileMetaPropsPlugin().

void KFileItem::assign const KFileItem item  ) 
 

Somewhat like an assignment operator, but more explicit.

Note: extra-data set with setExtraData() is not copied, so be careful what you do!

Parameters:
item the item to copy

Definition at line 785 of file kfileitem.cpp.

References d, determineMimeType(), m_access, m_bIsLocalURL, m_bLink, m_bMimeTypeKnown, m_entry, m_fileMode, m_group, m_guessedMimeType, m_metaInfo, m_permissions, m_pMimeType, m_size, m_strLowerCaseName, m_strName, m_strText, m_time, m_url, and m_user.

Referenced by KFileItem(), and operator=().

void KFileItem::setUDSEntry const KIO::UDSEntry entry,
const KURL url,
bool  determineMimeTypeOnDemand = false,
bool  urlIsDirectory = false
 

Reinitialize KFileItem with a new UDSEntry.

Note: extra-data set with setExtraData() is not changed or deleted, so be careful what you do!

KDirListerCache uses it to save new/delete calls by updating existing items that are otherwise not needed anymore.

Parameters:
entry the UDSEntry to assign to this KFileItem
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.
Since:
3.4.1

Definition at line 824 of file kfileitem.cpp.

References init(), KURL::isLocalFile(), and readUDSEntry().

KFileItem & KFileItem::operator= const KFileItem  ) 
 

Assignment operator, calls assign().

Definition at line 113 of file kfileitem.cpp.

References assign().

KURL KFileItem::mostLocalURL bool &  local  )  const
 

Tries to give a local URL for this file item if possible.

The given boolean indicates if the returned url is local or not.

Definition at line 948 of file kfileitem.cpp.

References QString::isEmpty(), localPath(), KURL::setPath(), and url().

Referenced by determineMimeType(), iconName(), init(), metaInfo(), mimeComment(), pixmap(), and run().

void KFileItem::init bool  _determineMimeTypeOnDemand  )  [protected]
 

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

Definition at line 124 of file kfileitem.cpp.

References QFile::encodeName(), KMimeType::findByURL(), KURL::isEmpty(), KURL::isLocalFile(), mode(), mostLocalURL(), KURL::path(), and url().

Referenced by KFileItem(), refresh(), refreshMimeType(), and setUDSEntry().

void KFileItem::readUDSEntry bool  _urlIsDirectory  )  [protected]
 

Extracts the data from the UDSEntry member and updates the KFileItem accordingly.

Since:
3.4.1

Definition at line 186 of file kfileitem.cpp.

References KURL::addPath(), QValueList::begin(), QValueList::ConstIterator(), KIO::decodeFileName(), QValueList::end(), QString::isEmpty(), KURL::isLocalFile(), KMimeType::mimeType(), KGlobal::staticQString(), KIO::UDS_ACCESS, KIO::UDS_FILE_TYPE, KIO::UDS_GROUP, KIO::UDS_GUESSED_MIME_TYPE, KIO::UDS_ICON_NAME, KIO::UDS_LINK_DEST, KIO::UDS_MIME_TYPE, KIO::UDS_NAME, KIO::UDS_URL, and KIO::UDS_USER.

Referenced by KFileItem(), and setUDSEntry().

QString KFileItem::parsePermissions mode_t  perm  )  const [protected]
 

Parses the given permission set and provides it for access().

Definition at line 888 of file kfileitem.cpp.

References QString::fromLatin1(), isDir(), and isLink().

Referenced by getToolTipText(), and permissionsString().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kio Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 16 06:57:39 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003