• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.1 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • kio
kfileitem.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 1999-2006 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 KFILEITEM_H
21 #define KFILEITEM_H
22 
23 #include <sys/stat.h>
24 
25 #include <kio/global.h>
26 #include <kio/udsentry.h>
27 #include <kurl.h>
28 
29 #include <kacl.h>
30 #include <kmimetype.h>
31 #include <kfilemetainfo.h>
32 #include <kdatetime.h>
33 #include <QtCore/QList>
34 
35 class KFileItemPrivate;
36 
45 class KIO_EXPORT KFileItem
46 {
47 public:
48  enum { Unknown = static_cast<mode_t>(-1) };
49 
56  enum FileTimes {
57  // warning: don't change without looking at the Private class
58  ModificationTime = 0,
59  AccessTime = 1,
60  CreationTime = 2
61  //ChangeTime
62  };
63 
70  KFileItem();
71 
87  KFileItem( const KIO::UDSEntry& entry, const KUrl& itemOrDirUrl,
88  bool delayedMimeTypes = false,
89  bool urlIsDirectory = false );
90 
104  KFileItem( mode_t mode, mode_t permissions, const KUrl& url,
105  bool delayedMimeTypes = false );
106 
113  KFileItem( const KUrl &url, const QString &mimeType, mode_t mode );
114 
118  KFileItem(const KFileItem& other);
122  KFileItem& operator=(const KFileItem& other);
123 
128  ~KFileItem();
129 
134  void refresh();
135 
140  void refreshMimeType();
141 
146  KUrl url() const;
147 
153  void setUrl( const KUrl &url );
154 
161  void setName( const QString &name );
162 
167  mode_t permissions() const;
168 
173  QString permissionsString() const;
174 
179  bool hasExtendedACL() const;
180 
185  KACL ACL() const;
186 
191  KACL defaultACL() const;
192 
197  mode_t mode() const;
198 
203  QString user() const;
204 
209  QString group() const;
210 
216  bool isLink() const;
217 
222  bool isDir() const;
223 
228  bool isFile() const;
229 
236  bool isReadable() const;
237 
244  bool isWritable() const;
245 
250  bool isHidden() const;
251 
257  bool isSlow() const;
258 
265  bool isDesktopFile() const;
266 
271  QString linkDest() const;
272 
279  KUrl targetUrl() const;
280 
289  KUrl nepomukUri() const;
290 
296  QString localPath() const;
297 
302  KIO::filesize_t size() const;
303 
310  KDateTime time( FileTimes which ) const;
311 #ifndef KDE_NO_DEPRECATED
312  KDE_DEPRECATED time_t time( unsigned int which ) const;
313 #endif
314 
322  QString timeString( FileTimes which = ModificationTime ) const;
323 #ifndef KDE_NO_DEPRECATED
324  KDE_DEPRECATED QString timeString( unsigned int which) const;
325 #endif
326 
331  bool isLocalFile() const;
332 
338  QString text() const;
339 
347  QString name( bool lowerCase = false ) const;
348 
355  QString mimetype() const;
356 
363  KMimeType::Ptr determineMimeType() const;
364 
370  KMimeType::Ptr mimeTypePtr() const;
371 
378  bool isMimeTypeKnown() const;
379 
385  QString mimeComment() const;
386 
392  QString iconName() const;
393 
402  QPixmap pixmap( int _size, int _state=0 ) const;
403 
410  QStringList overlays() const;
411 
418  QString comment() const;
419 
425  QString getStatusBarInfo() const;
426 
437 #ifndef KDE_NO_DEPRECATED
438  KDE_DEPRECATED QString getToolTipText(int maxcount = 6) const;
439 #endif
440 
451 #ifndef KDE_NO_DEPRECATED
452  KDE_DEPRECATED bool acceptsDrops() const;
453 #endif
454 
459  void run( QWidget* parentWidget = 0 ) const;
460 
466  KIO::UDSEntry entry() const;
467 
472  bool isMarked() const;
477  void mark();
482  void unmark();
483 
489  bool isRegularFile() const;
490 
499  bool cmp( const KFileItem & item ) const;
500 
504  bool operator==(const KFileItem& other) const;
505 
509  bool operator!=(const KFileItem& other) const;
510 
511 
516  operator QVariant() const;
517 
553 #ifndef KDE_NO_DEPRECATED
554  KDE_DEPRECATED void setExtraData( const void *key, void *value );
555 #endif
556 
566 #ifndef KDE_NO_DEPRECATED
567  KDE_DEPRECATED const void * extraData( const void *key ) const;
568 #endif
569 
576 #ifndef KDE_NO_DEPRECATED
577  KDE_DEPRECATED void removeExtraData( const void *key );
578 #endif
579 
586  void setMetaInfo( const KFileMetaInfo & info ) const;
587 
596  KFileMetaInfo metaInfo(bool autoget = true,
597  int what = KFileMetaInfo::ContentInfo | KFileMetaInfo::TechnicalInfo) const;
598 
602 #ifndef KDE_NO_DEPRECATED
603  KDE_DEPRECATED void assign( const KFileItem & item );
604 #endif
605 
625 #ifndef KDE_NO_DEPRECATED
626  KDE_DEPRECATED void setUDSEntry( const KIO::UDSEntry& entry, const KUrl& url,
627  bool delayedMimeTypes = false,
628  bool urlIsDirectory = false );
629 #endif
630 
635  KUrl mostLocalUrl(bool &local) const; // KDE4 TODO: bool* local = 0
636 
642  KUrl mostLocalUrl() const; // KDE5: merge with above version
643 
647  bool isNull() const;
648 
649 private:
650  QSharedDataPointer<KFileItemPrivate> d;
651 
652 private:
653  KIO_EXPORT friend QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
654  KIO_EXPORT friend QDataStream & operator>> ( QDataStream & s, KFileItem & a );
655 
656  friend class KFileItemTest;
657 };
658 
659 Q_DECLARE_METATYPE(KFileItem)
660 
661 Q_CORE_EXPORT uint qHash(const QString &key);
662 inline uint qHash(const KFileItem& item){ return qHash(item.url().url()); }
663 
668 class KIO_EXPORT KFileItemList : public QList<KFileItem>
669 {
670 public:
672  KFileItemList();
673 
675  KFileItemList( const QList<KFileItem> &items );
676 
682  KFileItem findByName( const QString& fileName ) const;
683 
689  KFileItem findByUrl( const KUrl& url ) const;
690 
692  KUrl::List urlList() const;
693 
696  KUrl::List targetUrlList() const;
697 
698  // TODO KDE-5 add d pointer here so that we can merge KFileItemListProperties into KFileItemList
699 };
700 
701 KIO_EXPORT QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
702 KIO_EXPORT QDataStream & operator>> ( QDataStream & s, KFileItem & a );
703 
708 KIO_EXPORT QDebug operator<<(QDebug stream, const KFileItem& item);
709 
710 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Wed Mar 20 2013 07:19:33 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.10.1 API Reference

Skip menu "kdelibs-4.10.1 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal