• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
tdefileitem.h
1 /* This file is part of the KDE project
2  Copyright (C) 1999 David Faure <faure@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef __tdefileitem_h__
21 #define __tdefileitem_h__
22 
23 #include <tqstringlist.h>
24 #include <sys/stat.h>
25 
26 #include <tqptrlist.h>
27 #include <tdeio/global.h>
28 #include <kurl.h>
29 #include <kacl.h>
30 #include <kmimetype.h>
31 #include <tdefilemetainfo.h>
32 
33 #define TDEFILEITEM_HAS_ISWRITABLE // only used in libkonq/konq_iconviewwidget.cpp, will be removed for 3.4
34 
41 class TDEIO_EXPORT KFileItem
42 {
43 public:
44  enum { Unknown = (mode_t) - 1 };
45 
57  KFileItem( const TDEIO::UDSEntry& _entry, const KURL& _url,
58  bool _determineMimeTypeOnDemand = false,
59  bool _urlIsDirectory = false );
60 
74  KFileItem( mode_t _mode, mode_t _permissions, const KURL& _url,
75  bool _determineMimeTypeOnDemand = false );
76 
83  KFileItem( const KURL &url, const TQString &mimeType, mode_t mode );
84 
89  KFileItem( const KFileItem &item );
90 
95  virtual ~KFileItem();
96 
101  void refresh();
102 
107  void refreshMimeType();
108 
113  const KURL & url() const { return m_url; }
114 
120  void setURL( const KURL &url );
121 
127  const KURL & listerURL() const { return m_listerURL; }
128 
134  void setListerURL( const KURL &url );
135 
142  void setName( const TQString &name );
143 
148  mode_t permissions() const { return m_permissions; }
149 
154  TQString permissionsString() const;
155 
161  bool hasExtendedACL() const;
162 
168  KACL ACL() const;
169 
175  KACL defaultACL() const;
176 
181  mode_t mode() const { return m_fileMode; }
182 
187  TQString user() const;
188 
193  TQString group() const;
194 
200  bool isLink() const { return m_bLink; }
201 
206  bool isDir() const;
207 
212  bool isFile() const { return !isDir(); }
213 
220  bool isReadable() const;
221 
229  bool isWritable() const;
230 
235  bool isHidden() const;
236 
241  TQString linkDest() const;
242 
249  TQString localPath() const;
250 
251  //FIXME KDE4 deprecate this in favor of size(bool &hasSize)
256  TDEIO::filesize_t size() const;
257 
263  TDEIO::filesize_t size(bool &hasSize) const;
264 
265  //FIXME KDE4 deprecate this in favor of time(unsigned int which, bool &hasSize)
272  time_t time( unsigned int which ) const;
273 
281  time_t time( unsigned int which, bool &hasTime ) const;
282 
290  TQString timeString( unsigned int which = TDEIO::UDS_MODIFICATION_TIME ) const;
291 
296  bool isLocalFile() const { return m_bIsLocalURL; }
297 
303  const TQString& text() const { return m_strText; }
304 
312  const TQString& name( bool lowerCase = false ) const {
313  if ( !lowerCase )
314  return m_strName;
315  else
316  if ( m_strLowerCaseName.isNull() )
317  m_strLowerCaseName = m_strName.lower();
318  return m_strLowerCaseName;
319  }
320 
327  TQString mimetype() const;
328 
335  TQString mimetypeFast() const;
336 
343  KMimeType::Ptr mimeTypePtrFast();
344 
351  KMimeType::Ptr determineMimeType();
352 
358  KMimeType::Ptr mimeTypePtr() const { return m_pMimeType; }
359 
360  bool isMimeTypeKnown() const;
366  TQString mimeComment();
367 
373  TQString iconName();
374 
383  TQPixmap pixmap( int _size, int _state=0 ) const;
384 
391  int overlays() const;
392 
398  TQString getStatusBarInfo();
399 
408  TQString getToolTipText(int maxcount = 6);
409 
416  bool acceptsDrops( );
417 
422  void run();
423 
429  const TDEIO::UDSEntry & entry() const { return m_entry; }
430 
435  bool isMarked() const { return m_bMarked; }
440  void mark() { m_bMarked = true; }
445  void unmark() { m_bMarked = false; }
446 
452  bool cmp( const KFileItem & item );
453 
487  virtual void setExtraData( const void *key, void *value );
488 
496  virtual const void * extraData( const void *key ) const;
497 
505  virtual void * extraData( const void *key );
506 
511  virtual void removeExtraData( const void *key );
512 
517  void setMetaInfo( const KFileMetaInfo & info );
518 
526  void setFileMode( mode_t m );
527 
533  void setMimeType( const TQString& mimetype );
534 
540  const KFileMetaInfo & metaInfo(bool autoget = true,
541  int what = KFileMetaInfo::Fastest) const;
542 
550  void assign( const KFileItem & item );
551 
569  void setUDSEntry( const TDEIO::UDSEntry& entry, const KURL& url,
570  bool determineMimeTypeOnDemand = false,
571  bool urlIsDirectory = false );
572 
576  KFileItem& operator=( const KFileItem& );
577 
582  KURL mostLocalURL(bool &local) const;
583 
585 
586 protected:
591  void init( bool _determineMimeTypeOnDemand );
592 
598  void readUDSEntry( bool _urlIsDirectory );
599 
603  TQString parsePermissions( mode_t perm ) const;
604 
605 private:
609  TDEIO::UDSEntry m_entry;
613  KURL m_url;
614 
618  KURL m_listerURL;
619 
623  TQString m_strName;
624 
629  TQString m_strText;
630 
634  mutable TQString m_user, m_group;
635 
639  mutable TQString m_strLowerCaseName;
640 
644  KMimeType::Ptr m_pMimeType;
645 
649  mode_t m_fileMode;
653  mode_t m_permissions;
654 
658  bool m_bMarked:1;
662  bool m_bLink:1;
666  bool m_bIsLocalURL:1;
667 
668  bool m_bMimeTypeKnown:1;
669 
670  // Auto: check leading dot.
671  enum { Auto, Hidden, Shown } m_hidden:3;
672 
673  // For special case like link to dirs over FTP
674  TQString m_guessedMimeType;
675  mutable TQString m_access;
676  TQMap<const void*, void*> m_extra;
677  mutable KFileMetaInfo m_metaInfo;
678 
679  enum { Modification = 0, Access = 1, Creation = 2, NumFlags = 3 };
680  mutable time_t m_time[3];
681  mutable TDEIO::filesize_t m_size;
682 
683 protected:
684  virtual void virtual_hook( int id, void* data );
685 private:
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 );
690 };
691 
695 typedef TQPtrList<KFileItem> KFileItemList;
696 
700 typedef TQPtrListIterator<KFileItem> KFileItemListIterator;
701 
702 TDEIO_EXPORT TQDataStream & operator<< ( TQDataStream & s, const KFileItem & a );
703 TDEIO_EXPORT TQDataStream & operator>> ( TQDataStream & s, KFileItem & a );
704 
705 
706 #endif
KACL
The KCAL class encapsulates a POSIX Access Control List.
Definition: kacl.h:43
KFileItem
A KFileItem is a generic class to handle a file, local or remote.
Definition: tdefileitem.h:42
KFileItem::text
const TQString & text() const
Returns the text of the file item.
Definition: tdefileitem.h:303
KFileItem::isMarked
bool isMarked() const
Used when updating a directory.
Definition: tdefileitem.h:435
KFileItem::name
const TQString & name(bool lowerCase=false) const
Return the name of the file item (without a path).
Definition: tdefileitem.h:312
KFileItem::isLocalFile
bool isLocalFile() const
Returns true if the file is a local file.
Definition: tdefileitem.h:296
KFileItem::mark
void mark()
Marks the item.
Definition: tdefileitem.h:440
KFileItem::mimeTypePtr
KMimeType::Ptr mimeTypePtr() const
Returns the currently known mimetype of the file item.
Definition: tdefileitem.h:358
KFileItem::isLink
bool isLink() const
Returns true if this item represents a link in the UNIX sense of a link.
Definition: tdefileitem.h:200
KFileItem::url
const KURL & url() const
Returns the url of the file.
Definition: tdefileitem.h:113
KFileItem::permissions
mode_t permissions() const
Returns the permissions of the file (stat.st_mode containing only permissions).
Definition: tdefileitem.h:148
KFileItem::unmark
void unmark()
Unmarks the item.
Definition: tdefileitem.h:445
KFileItem::listerURL
const KURL & listerURL() const
Returns the lister url of the file.
Definition: tdefileitem.h:127
KFileItem::isFile
bool isFile() const
Returns true if this item represents a file (and not a a directory)
Definition: tdefileitem.h:212
KFileItem::entry
const TDEIO::UDSEntry & entry() const
Returns the UDS entry.
Definition: tdefileitem.h:429
KFileItem::mode
mode_t mode() const
Returns the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).
Definition: tdefileitem.h:181
KFileMetaInfo
Meta Information about a file.
Definition: tdefilemetainfo.h:927
KFileMetaInfo::Fastest
@ Fastest
do the fastest possible read and omit all items that might need a significantly longer time than the ...
Definition: tdefilemetainfo.h:940
TDEIO::UDS_MODIFICATION_TIME
@ UDS_MODIFICATION_TIME
The last time the file was modified.
Definition: global.h:358
TDEIO::UDSEntry
TQValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the information for a file or URL.
Definition: global.h:507
TDEIO::filesize_t
TQ_ULLONG filesize_t
64-bit file size
Definition: global.h:39

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.1
This website is maintained by Timothy Pearson.