• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 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
35class KFileItemPrivate;
36
45class KIO_EXPORT KFileItem
46{
47public:
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
376 bool isFinalIconKnown() const;
377
384 bool isMimeTypeKnown() const;
385
391 QString mimeComment() const;
392
398 QString iconName() const;
399
408 QPixmap pixmap( int _size, int _state=0 ) const;
409
416 QStringList overlays() const;
417
424 QString comment() const;
425
431 QString getStatusBarInfo() const;
432
443#ifndef KDE_NO_DEPRECATED
444 KDE_DEPRECATED QString getToolTipText(int maxcount = 6) const;
445#endif
446
457#ifndef KDE_NO_DEPRECATED
458 KDE_DEPRECATED bool acceptsDrops() const;
459#endif
460
465 void run( QWidget* parentWidget = 0 ) const;
466
472 KIO::UDSEntry entry() const;
473
478 bool isMarked() const;
483 void mark();
488 void unmark();
489
495 bool isRegularFile() const;
496
505 bool cmp( const KFileItem & item ) const;
506
510 bool operator==(const KFileItem& other) const;
511
515 bool operator!=(const KFileItem& other) const;
516
517
522 operator QVariant() const;
523
559#ifndef KDE_NO_DEPRECATED
560 KDE_DEPRECATED void setExtraData( const void *key, void *value );
561#endif
562
572#ifndef KDE_NO_DEPRECATED
573 KDE_DEPRECATED const void * extraData( const void *key ) const;
574#endif
575
582#ifndef KDE_NO_DEPRECATED
583 KDE_DEPRECATED void removeExtraData( const void *key );
584#endif
585
592 void setMetaInfo( const KFileMetaInfo & info ) const;
593
602 KFileMetaInfo metaInfo(bool autoget = true,
603 int what = KFileMetaInfo::ContentInfo | KFileMetaInfo::TechnicalInfo) const;
604
608#ifndef KDE_NO_DEPRECATED
609 KDE_DEPRECATED void assign( const KFileItem & item );
610#endif
611
631#ifndef KDE_NO_DEPRECATED
632 KDE_DEPRECATED void setUDSEntry( const KIO::UDSEntry& entry, const KUrl& url,
633 bool delayedMimeTypes = false,
634 bool urlIsDirectory = false );
635#endif
636
641 KUrl mostLocalUrl(bool &local) const; // KDE4 TODO: bool* local = 0
642
648 KUrl mostLocalUrl() const; // KDE5: merge with above version
649
653 bool isNull() const;
654
655private:
656 QSharedDataPointer<KFileItemPrivate> d;
657
658private:
659 KIO_EXPORT friend QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
660 KIO_EXPORT friend QDataStream & operator>> ( QDataStream & s, KFileItem & a );
661
662 friend class KFileItemTest;
663};
664
665Q_DECLARE_METATYPE(KFileItem)
666
667Q_CORE_EXPORT uint qHash(const QString &key);
668inline uint qHash(const KFileItem& item){ return qHash(item.url().url()); }
669
674class KIO_EXPORT KFileItemList : public QList<KFileItem>
675{
676public:
678 KFileItemList();
679
681 KFileItemList( const QList<KFileItem> &items );
682
688 KFileItem findByName( const QString& fileName ) const;
689
695 KFileItem findByUrl( const KUrl& url ) const;
696
698 KUrl::List urlList() const;
699
702 KUrl::List targetUrlList() const;
703
704 // TODO KDE-5 add d pointer here so that we can merge KFileItemListProperties into KFileItemList
705};
706
707KIO_EXPORT QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
708KIO_EXPORT QDataStream & operator>> ( QDataStream & s, KFileItem & a );
709
714KIO_EXPORT QDebug operator<<(QDebug stream, const KFileItem& item);
715
716#endif
KACL
The KACL class encapsulates a POSIX Access Control List.
Definition: kacl.h:48
KDateTime
KFileItemList
List of KFileItems, which adds a few helper methods to QList<KFileItem>.
Definition: kfileitem.h:675
KFileItem
A KFileItem is a generic class to handle a file, local or remote.
Definition: kfileitem.h:46
KFileItem::FileTimes
FileTimes
The timestamps associated with a file.
Definition: kfileitem.h:56
KFileMetaInfo
KFileMetaInfo provides metadata extracted from a file or other resource.
Definition: kfilemetainfo.h:56
KFileMetaInfo::ContentInfo
@ ContentInfo
read information about the content of the file like comments or id3 tags
Definition: kfilemetainfo.h:75
KFileMetaInfo::TechnicalInfo
@ TechnicalInfo
extract technical details about the file, like e.g.
Definition: kfilemetainfo.h:72
KIO::UDSEntry
Universal Directory Service.
Definition: udsentry.h:59
KSharedPtr< KMimeType >
KUrl::List
KUrl
QList
QWidget
global.h
kacl.h
operator==
bool operator==(const KEntry &k1, const KEntry &k2)
operator!=
bool operator!=(const KEntry &k1, const KEntry &k2)
kdatetime.h
operator>>
QDataStream & operator>>(QDataStream &s, KFileItem &a)
Definition: kfileitem.cpp:1514
operator<<
QDataStream & operator<<(QDataStream &s, const KFileItem &a)
Definition: kfileitem.cpp:1497
qHash
Q_CORE_EXPORT uint qHash(const QString &key)
kfilemetainfo.h
kmimetype.h
kurl.h
Unknown
Unknown
KIO::filesize_t
qulonglong filesize_t
64-bit file size
Definition: global.h:57
group
group
name
const char * name(StandardAction id)
udsentry.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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.14.38 API Reference

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