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

KIO

kfileitem.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 1999-2006 David Faure <faure@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KFILEITEM_H
00021 #define KFILEITEM_H
00022 
00023 #include <sys/stat.h>
00024 
00025 #include <kio/global.h>
00026 #include <kio/udsentry.h>
00027 #include <kurl.h>
00028 
00029 #include <kacl.h>
00030 #include <kmimetype.h>
00031 #include <kfilemetainfo.h>
00032 #include <kdatetime.h>
00033 #include <QtCore/QList>
00034 
00035 class KFileItemPrivate;
00036 
00045 class KIO_EXPORT KFileItem
00046 {
00047 public:
00048     enum { Unknown = static_cast<mode_t>(-1) };
00049 
00056     enum FileTimes {
00057         // warning: don't change without looking at the Private class
00058         ModificationTime = 0,
00059         AccessTime = 1,
00060         CreationTime = 2
00061         //ChangeTime
00062     };
00063 
00070     KFileItem();
00071 
00087     KFileItem( const KIO::UDSEntry& entry, const KUrl& itemOrDirUrl,
00088                bool delayedMimeTypes = false,
00089                bool urlIsDirectory = false );
00090 
00104     KFileItem( mode_t mode, mode_t permissions, const KUrl& url,
00105                bool delayedMimeTypes = false );
00106 
00113     KFileItem( const KUrl &url, const QString &mimeType, mode_t mode );
00114 
00118     KFileItem(const KFileItem& other);
00122     KFileItem& operator=(const KFileItem& other);
00123 
00128     ~KFileItem();
00129 
00134     void refresh();
00135 
00140     void refreshMimeType();
00141 
00146     KUrl url() const;
00147 
00153     void setUrl( const KUrl &url );
00154 
00161     void setName( const QString &name );
00162 
00167     mode_t permissions() const;
00168 
00173     QString permissionsString() const;
00174 
00179     bool hasExtendedACL() const;
00180 
00185     KACL ACL() const;
00186 
00191     KACL defaultACL() const;
00192 
00197     mode_t mode() const;
00198 
00203     QString user() const;
00204 
00209     QString group() const;
00210 
00216     bool isLink() const;
00217 
00222     bool isDir() const;
00223 
00228     bool isFile() const;
00229 
00236     bool isReadable() const;
00237 
00244     bool isWritable() const;
00245 
00250     bool isHidden() const;
00251 
00257     bool isSlow() const;
00258 
00265     bool isDesktopFile() const;
00266 
00271     QString linkDest() const;
00272 
00279     KUrl targetUrl() const;
00280 
00289     KUrl nepomukUri() const;
00290 
00296     QString localPath() const;
00297 
00302     KIO::filesize_t size() const;
00303 
00310     KDateTime time( FileTimes which ) const;
00311 #ifndef KDE_NO_DEPRECATED
00312     KDE_DEPRECATED time_t time( unsigned int which ) const;
00313 #endif
00314 
00322     QString timeString( FileTimes which = ModificationTime ) const;
00323 #ifndef KDE_NO_DEPRECATED
00324     KDE_DEPRECATED QString timeString( unsigned int which) const;
00325 #endif
00326 
00331     bool isLocalFile() const;
00332 
00338     QString text() const;
00339 
00347     QString name( bool lowerCase = false ) const;
00348 
00355     QString mimetype() const;
00356 
00363     KMimeType::Ptr determineMimeType() const;
00364 
00370     KMimeType::Ptr mimeTypePtr() const;
00371 
00378     bool isMimeTypeKnown() const;
00379 
00385     QString mimeComment() const;
00386 
00392     QString iconName() const;
00393 
00402     QPixmap pixmap( int _size, int _state=0 ) const;
00403 
00410     QStringList overlays() const;
00411 
00418     QString comment() const;
00419 
00425     QString getStatusBarInfo() const;
00426 
00437 #ifndef KDE_NO_DEPRECATED
00438     KDE_DEPRECATED QString getToolTipText(int maxcount = 6) const;
00439 #endif
00440 
00451 #ifndef KDE_NO_DEPRECATED
00452     KDE_DEPRECATED bool acceptsDrops() const;
00453 #endif
00454 
00459     void run( QWidget* parentWidget = 0 ) const;
00460 
00466     KIO::UDSEntry entry() const;
00467 
00472     bool isMarked() const;
00477     void mark();
00482     void unmark();
00483 
00489     bool isRegularFile() const;
00490 
00499     bool cmp( const KFileItem & item ) const;
00500 
00501     bool operator==(const KFileItem& other) const;
00502 
00503     bool operator!=(const KFileItem& other) const;
00504 
00505 
00510     operator QVariant() const;
00511 
00547 #ifndef KDE_NO_DEPRECATED
00548     KDE_DEPRECATED void setExtraData( const void *key, void *value );
00549 #endif
00550 
00560 #ifndef KDE_NO_DEPRECATED
00561     KDE_DEPRECATED const void * extraData( const void *key ) const;
00562 #endif
00563 
00570 #ifndef KDE_NO_DEPRECATED
00571     KDE_DEPRECATED void removeExtraData( const void *key );
00572 #endif
00573 
00580     void setMetaInfo( const KFileMetaInfo & info ) const;
00581 
00590     KFileMetaInfo metaInfo(bool autoget = true,
00591                            int what = KFileMetaInfo::ContentInfo | KFileMetaInfo::TechnicalInfo) const;
00592 
00596 #ifndef KDE_NO_DEPRECATED
00597     KDE_DEPRECATED void assign( const KFileItem & item );
00598 #endif
00599 
00619 #ifndef KDE_NO_DEPRECATED
00620     KDE_DEPRECATED void setUDSEntry( const KIO::UDSEntry& entry, const KUrl& url,
00621                                      bool delayedMimeTypes = false,
00622                                      bool urlIsDirectory = false );
00623 #endif
00624 
00629     KUrl mostLocalUrl(bool &local) const; // KDE4 TODO: bool* local = 0
00630 
00636     KUrl mostLocalUrl() const; // KDE5: merge with above version
00637 
00641     bool isNull() const;
00642 
00643 private:
00644     QSharedDataPointer<KFileItemPrivate> d;
00645 
00646 private:
00647     KIO_EXPORT friend QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
00648     KIO_EXPORT friend QDataStream & operator>> ( QDataStream & s, KFileItem & a );
00649 };
00650 
00651 Q_DECLARE_METATYPE(KFileItem)
00652 
00653 Q_CORE_EXPORT uint qHash(const QString &key);
00654 inline uint qHash(const KFileItem& item){ return qHash(item.url().url()); }
00655 
00660 class KIO_EXPORT KFileItemList : public QList<KFileItem>
00661 {
00662 public:
00664   KFileItemList();
00665 
00667   KFileItemList( const QList<KFileItem> &items );
00668 
00674   KFileItem findByName( const QString& fileName ) const;
00675 
00681   KFileItem findByUrl( const KUrl& url ) const;
00682 
00684   KUrl::List urlList() const;
00685 
00688   KUrl::List targetUrlList() const;
00689 
00690   // TODO KDE-5 add d pointer here so that we can merge KFileItemListProperties into KFileItemList
00691 };
00692 
00693 KIO_EXPORT QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
00694 KIO_EXPORT QDataStream & operator>> ( QDataStream & s, KFileItem & a );
00695 
00700 KIO_EXPORT QDebug operator<<(QDebug stream, const KFileItem& item);
00701 
00702 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Wed May 2 2012 18:21:08 by doxygen 1.8.0 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.8.3 API Reference

Skip menu "kdelibs-4.8.3 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