• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • 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 = (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 
00085     KFileItem( const KIO::UDSEntry& entry, const KUrl& directoryUrl,
00086                bool delayedMimeTypes = false,
00087                bool urlIsDirectory = false );
00088 
00102     KFileItem( mode_t mode, mode_t permissions, const KUrl& url,
00103                bool delayedMimeTypes = false );
00104 
00111     KFileItem( const KUrl &url, const QString &mimeType, mode_t mode );
00112 
00116     KFileItem(const KFileItem& other);
00120     KFileItem& operator=(const KFileItem& other);
00121 
00126     ~KFileItem();
00127 
00132     void refresh();
00133 
00138     void refreshMimeType();
00139 
00144     KUrl url() const;
00145 
00151     void setUrl( const KUrl &url );
00152 
00159     void setName( const QString &name );
00160 
00165     mode_t permissions() const;
00166 
00171     QString permissionsString() const;
00172 
00177     bool hasExtendedACL() const;
00178 
00183     KACL ACL() const;
00184 
00189     KACL defaultACL() const;
00190 
00195     mode_t mode() const;
00196 
00201     QString user() const;
00202 
00207     QString group() const;
00208 
00214     bool isLink() const;
00215 
00220     bool isDir() const;
00221 
00226     bool isFile() const;
00227 
00234     bool isReadable() const;
00235 
00242     bool isWritable() const;
00243 
00248     bool isHidden() const;
00249 
00256     bool isDesktopFile() const;
00257 
00262     QString linkDest() const;
00263 
00270     KUrl targetUrl() const;
00271 
00277     QString localPath() const;
00278 
00283     KIO::filesize_t size() const;
00284 
00291     KDateTime time( FileTimes which ) const;
00292     KDE_DEPRECATED time_t time( unsigned int which ) const;
00293 
00301     QString timeString( FileTimes which = ModificationTime ) const;
00302     KDE_DEPRECATED QString timeString( unsigned int which) const;
00303 
00308     bool isLocalFile() const;
00309 
00315     QString text() const;
00316 
00324     QString name( bool lowerCase = false ) const;
00325 
00332     QString mimetype() const;
00333 
00340     KMimeType::Ptr determineMimeType() const;
00341 
00347     KMimeType::Ptr mimeTypePtr() const;
00348 
00355     bool isMimeTypeKnown() const;
00356 
00362     QString mimeComment() const;
00363 
00369     QString iconName() const;
00370 
00379     QPixmap pixmap( int _size, int _state=0 ) const;
00380 
00387     QStringList overlays() const;
00388 
00394     QString getStatusBarInfo() const;
00395 
00404     QString getToolTipText(int maxcount = 6) const;
00405 
00416     KDE_DEPRECATED bool acceptsDrops() const;
00417 
00422     void run( QWidget* parentWidget = 0 ) const;
00423 
00429     KIO::UDSEntry entry() const;
00430 
00435     bool isMarked() const;
00440     void mark();
00445     void unmark();
00446 
00455     bool cmp( const KFileItem & item ) const;
00456 
00457     bool operator==(const KFileItem& other) const;
00458 
00459     bool operator!=(const KFileItem& other) const;
00460 
00461 
00466     operator QVariant() const;
00467 
00503     KDE_DEPRECATED void setExtraData( const void *key, void *value );
00504 
00514     KDE_DEPRECATED const void * extraData( const void *key ) const;
00515 
00522     KDE_DEPRECATED void removeExtraData( const void *key );
00523 
00530     void setMetaInfo( const KFileMetaInfo & info ) const;
00531 
00537     KFileMetaInfo metaInfo(bool autoget = true,
00538                                    int what = KFileMetaInfo::Fastest) const;
00539 
00543     KDE_DEPRECATED void assign( const KFileItem & item );
00544 
00564     KDE_DEPRECATED void setUDSEntry( const KIO::UDSEntry& entry, const KUrl& url,
00565                                      bool delayedMimeTypes = false,
00566                                      bool urlIsDirectory = false );
00567 
00572     KUrl mostLocalUrl(bool &local) const; // KDE4 TODO: bool* local = 0
00573 
00577     bool isNull() const;
00578 
00579 private:
00580     QSharedDataPointer<KFileItemPrivate> d;
00581 
00582 private:
00583     KIO_EXPORT friend QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
00584     KIO_EXPORT friend QDataStream & operator>> ( QDataStream & s, KFileItem & a );
00585 };
00586 
00587 Q_DECLARE_METATYPE(KFileItem)
00588 
00589 Q_CORE_EXPORT uint qHash(const QString &key);
00590 inline uint qHash(const KFileItem& item){ return qHash(item.url().url()); }
00591 
00596 class KIO_EXPORT KFileItemList : public QList<KFileItem>
00597 {
00598 public:
00600   KFileItemList();
00601 
00603   KFileItemList( const QList<KFileItem> &items );
00604 
00610   KFileItem findByName( const QString& fileName ) const;
00611 
00617   KFileItem findByUrl( const KUrl& url ) const;
00618 
00620   KUrl::List urlList() const;
00621 };
00622 
00623 KIO_EXPORT QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
00624 KIO_EXPORT QDataStream & operator>> ( QDataStream & s, KFileItem & a );
00625 
00626 
00627 #endif

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal