20 #ifndef __kfileitem_h__
21 #define __kfileitem_h__
23 #include <tqstringlist.h>
26 #include <tqptrlist.h>
27 #include <kio/global.h>
30 #include <kmimetype.h>
31 #include <kfilemetainfo.h>
33 #define KFILEITEM_HAS_ISWRITABLE // only used in libkonq/konq_iconviewwidget.cc, will be removed for 3.4
44 enum { Unknown = (mode_t) - 1 };
58 bool _determineMimeTypeOnDemand =
false,
59 bool _urlIsDirectory =
false );
74 KFileItem( mode_t _mode, mode_t _permissions,
const KURL& _url,
75 bool _determineMimeTypeOnDemand =
false );
83 KFileItem(
const KURL &url,
const TQString &mimeType, mode_t mode );
107 void refreshMimeType();
113 const KURL &
url()
const {
return m_url; }
120 void setURL(
const KURL &url );
128 void setName(
const TQString &name );
140 TQString permissionsString()
const;
147 bool hasExtendedACL()
const;
161 KACL defaultACL()
const;
167 mode_t
mode()
const {
return m_fileMode; }
173 TQString user()
const;
179 TQString group()
const;
206 bool isReadable()
const;
215 bool isWritable()
const;
221 bool isHidden()
const;
227 TQString linkDest()
const;
235 TQString localPath()
const;
258 time_t time(
unsigned int which )
const;
267 time_t time(
unsigned int which,
bool &hasTime )
const;
289 const TQString&
text()
const {
return m_strText; }
298 const TQString&
name(
bool lowerCase =
false )
const {
302 if ( m_strLowerCaseName.isNull() )
303 m_strLowerCaseName = m_strName.lower();
304 return m_strLowerCaseName;
313 TQString mimetype()
const;
321 TQString mimetypeFast()
const;
329 KMimeType::Ptr mimeTypePtrFast();
337 KMimeType::Ptr determineMimeType();
346 bool isMimeTypeKnown()
const;
352 TQString mimeComment();
369 TQPixmap pixmap(
int _size,
int _state=0 )
const;
377 int overlays()
const;
384 TQString getStatusBarInfo();
394 TQString getToolTipText(
int maxcount = 6);
402 bool acceptsDrops( );
426 void mark() { m_bMarked =
true; }
473 virtual void setExtraData(
const void *key,
void *value );
482 virtual const void * extraData(
const void *key )
const;
491 virtual void * extraData(
const void *key );
497 virtual void removeExtraData(
const void *key );
512 void setFileMode( mode_t m );
519 void setMimeType(
const TQString& mimetype );
555 void setUDSEntry(
const KIO::UDSEntry& entry,
const KURL& url,
556 bool determineMimeTypeOnDemand =
false,
557 bool urlIsDirectory =
false );
568 KURL mostLocalURL(
bool &local)
const;
577 void init(
bool _determineMimeTypeOnDemand );
584 void readUDSEntry(
bool _urlIsDirectory );
589 TQString parsePermissions( mode_t perm )
const;
615 mutable TQString m_user, m_group;
620 mutable TQString m_strLowerCaseName;
625 KMimeType::Ptr m_pMimeType;
634 mode_t m_permissions;
647 bool m_bIsLocalURL:1;
649 bool m_bMimeTypeKnown:1;
652 enum { Auto, Hidden, Shown } m_hidden:3;
655 TQString m_guessedMimeType;
656 mutable TQString m_access;
657 TQMap<const void*, void*> m_extra;
660 enum { Modification = 0, Access = 1, Creation = 2, NumFlags = 3 };
661 mutable time_t m_time[3];
665 virtual void virtual_hook(
int id,
void* data );
667 class KFileItemPrivate;
668 KFileItemPrivate * d;
669 KIO_EXPORT
friend TQDataStream & operator<< ( TQDataStream & s,
const KFileItem & a );
670 KIO_EXPORT
friend TQDataStream & operator>> ( TQDataStream & s,
KFileItem & a );
676 typedef TQPtrList<KFileItem> KFileItemList;
681 typedef TQPtrListIterator<KFileItem> KFileItemListIterator;
683 KIO_EXPORT TQDataStream & operator<< ( TQDataStream & s,
const KFileItem & a );
684 KIO_EXPORT TQDataStream & operator>> ( TQDataStream & s,
KFileItem & a );
const KURL & url() const
Returns the url of the file.
const KIO::UDSEntry & entry() const
Returns the UDS entry.
The last time the file was modified.
const TQString & name(bool lowerCase=false) const
Return the name of the file item (without a path).
mode_t permissions() const
Returns the permissions of the file (stat.st_mode containing only permissions).
void mark()
Marks the item.
bool isLocalFile() const
Returns true if the file is a local file.
TQValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the information for a file or URL.
bool isFile() const
Returns true if this item represents a file (and not a a directory)
TQ_ULLONG filesize_t
64-bit file size
bool isLink() const
Returns true if this item represents a link in the UNIX sense of a link.
KMimeType::Ptr mimeTypePtr() const
Returns the currently known mimetype of the file item.
bool isMarked() const
Used when updating a directory.
The KCAL class encapsulates a POSIX Access Control List.
void unmark()
Unmarks the item.
mode_t mode() const
Returns the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).
const TQString & text() const
Returns the text of the file item.
A KFileItem is a generic class to handle a file, local or remote.