20 #ifndef __tdefileitem_h__
21 #define __tdefileitem_h__
23 #include <tqstringlist.h>
26 #include <tqptrlist.h>
27 #include <tdeio/global.h>
30 #include <kmimetype.h>
31 #include <tdefilemetainfo.h>
33 #define TDEFILEITEM_HAS_ISWRITABLE
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 );
134 void setListerURL(
const KURL &url );
142 void setName(
const TQString &name );
154 TQString permissionsString()
const;
161 bool hasExtendedACL()
const;
175 KACL defaultACL()
const;
181 mode_t
mode()
const {
return m_fileMode; }
187 TQString user()
const;
193 TQString group()
const;
220 bool isReadable()
const;
229 bool isWritable()
const;
235 bool isHidden()
const;
241 TQString linkDest()
const;
249 TQString localPath()
const;
272 time_t time(
unsigned int which )
const;
281 time_t time(
unsigned int which,
bool &hasTime )
const;
303 const TQString&
text()
const {
return m_strText; }
312 const TQString&
name(
bool lowerCase =
false )
const {
316 if ( m_strLowerCaseName.isNull() )
317 m_strLowerCaseName = m_strName.lower();
318 return m_strLowerCaseName;
327 TQString mimetype()
const;
335 TQString mimetypeFast()
const;
343 KMimeType::Ptr mimeTypePtrFast();
351 KMimeType::Ptr determineMimeType();
360 bool isMimeTypeKnown()
const;
366 TQString mimeComment();
383 TQPixmap pixmap(
int _size,
int _state=0 )
const;
391 int overlays()
const;
398 TQString getStatusBarInfo();
408 TQString getToolTipText(
int maxcount = 6);
416 bool acceptsDrops( );
440 void mark() { m_bMarked =
true; }
487 virtual void setExtraData(
const void *key,
void *value );
496 virtual const void * extraData(
const void *key )
const;
505 virtual void * extraData(
const void *key );
511 virtual void removeExtraData(
const void *key );
526 void setFileMode( mode_t m );
533 void setMimeType(
const TQString& mimetype );
570 bool determineMimeTypeOnDemand =
false,
571 bool urlIsDirectory =
false );
582 KURL mostLocalURL(
bool &local)
const;
591 void init(
bool _determineMimeTypeOnDemand );
598 void readUDSEntry(
bool _urlIsDirectory );
603 TQString parsePermissions( mode_t perm )
const;
634 mutable TQString m_user, m_group;
639 mutable TQString m_strLowerCaseName;
644 KMimeType::Ptr m_pMimeType;
653 mode_t m_permissions;
666 bool m_bIsLocalURL:1;
668 bool m_bMimeTypeKnown:1;
671 enum { Auto, Hidden, Shown } m_hidden:3;
674 TQString m_guessedMimeType;
675 mutable TQString m_access;
676 TQMap<const void*, void*> m_extra;
679 enum { Modification = 0, Access = 1, Creation = 2, NumFlags = 3 };
680 mutable time_t m_time[3];
684 virtual void virtual_hook(
int id,
void* data );
686 class KFileItemPrivate;
687 KFileItemPrivate * d;
688 TDEIO_EXPORT
friend TQDataStream & operator<< ( TQDataStream & s,
const KFileItem & a );
689 TDEIO_EXPORT
friend TQDataStream & operator>> ( TQDataStream & s,
KFileItem & a );
695 typedef TQPtrList<KFileItem> KFileItemList;
700 typedef TQPtrListIterator<KFileItem> KFileItemListIterator;
702 TDEIO_EXPORT TQDataStream & operator<< ( TQDataStream & s,
const KFileItem & a );
703 TDEIO_EXPORT TQDataStream & operator>> ( TQDataStream & s,
KFileItem & a );
The KCAL class encapsulates a POSIX Access Control List.
A KFileItem is a generic class to handle a file, local or remote.
const TQString & text() const
Returns the text of the file item.
bool isMarked() const
Used when updating a directory.
const TQString & name(bool lowerCase=false) const
Return the name of the file item (without a path).
bool isLocalFile() const
Returns true if the file is a local file.
void mark()
Marks the item.
KMimeType::Ptr mimeTypePtr() const
Returns the currently known mimetype of the file item.
bool isLink() const
Returns true if this item represents a link in the UNIX sense of a link.
const KURL & url() const
Returns the url of the file.
mode_t permissions() const
Returns the permissions of the file (stat.st_mode containing only permissions).
void unmark()
Unmarks the item.
const KURL & listerURL() const
Returns the lister url of the file.
bool isFile() const
Returns true if this item represents a file (and not a a directory)
const TDEIO::UDSEntry & entry() const
Returns the UDS entry.
mode_t mode() const
Returns the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).
@ UDS_MODIFICATION_TIME
The last time the file was modified.
TQValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the information for a file or URL.
TQ_ULLONG filesize_t
64-bit file size