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

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • kio
kdirlister.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 1999 David Faure <faure@kde.org>
3  2001, 2002, 2004-2006 Michael Brade <brade@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef kdirlister_h
22 #define kdirlister_h
23 
24 #include "kfileitem.h"
25 #include "kdirnotify.h"
26 
27 #include <QtCore/QString>
28 #include <QtCore/QStringList>
29 
30 #include <kurl.h>
31 
32 class KJob;
33 namespace KIO { class Job; class ListJob; }
34 
57 class KIO_EXPORT KDirLister : public QObject
58 {
59  friend class KDirListerCache;
60  friend struct KDirListerCacheDirectoryData;
61 
62  Q_OBJECT
63  Q_PROPERTY( bool autoUpdate READ autoUpdate WRITE setAutoUpdate )
64  Q_PROPERTY( bool showingDotFiles READ showingDotFiles WRITE setShowingDotFiles )
65  Q_PROPERTY( bool dirOnlyMode READ dirOnlyMode WRITE setDirOnlyMode )
66  Q_PROPERTY( bool autoErrorHandlingEnabled READ autoErrorHandlingEnabled )
67  Q_PROPERTY( bool delayedMimeTypes READ delayedMimeTypes WRITE setDelayedMimeTypes )
68  Q_PROPERTY( QString nameFilter READ nameFilter WRITE setNameFilter )
69  Q_PROPERTY( QStringList mimeFilter READ mimeFilters WRITE setMimeFilter RESET clearMimeFilter )
70 
71 public:
72  enum OpenUrlFlag
73  {
74  NoFlags = 0x0,
75 
76  Keep = 0x1,
77 
81  Reload = 0x2
82  };
86 
87  Q_DECLARE_FLAGS(OpenUrlFlags, OpenUrlFlag)
88 
89 
92  KDirLister( QObject* parent = 0 );
93 
97  virtual ~KDirLister();
98 
115  virtual bool openUrl( const KUrl& _url, OpenUrlFlags _flags = NoFlags );
116 
124  virtual void stop();
125 
135  virtual void stop( const KUrl& _url );
136 
141  bool delayedMimeTypes() const;
142 
151  void setDelayedMimeTypes( bool delayedMimeTypes );
152 
153 
159  bool autoUpdate() const;
160 
166  virtual void setAutoUpdate( bool enable );
167 
175  bool autoErrorHandlingEnabled() const;
176 
186  void setAutoErrorHandlingEnabled( bool enable, QWidget *parent );
187 
195  bool showingDotFiles() const;
196 
205  virtual void setShowingDotFiles( bool _showDotFiles );
206 
213  bool dirOnlyMode() const;
214 
221  virtual void setDirOnlyMode( bool dirsOnly );
222 
231  KUrl url() const;
232 
241  KUrl::List directories() const;
242 
247  virtual void emitChanges();
248 
260  virtual void updateDirectory( const KUrl& _dir );
261 
266  bool isFinished() const;
267 
274  KFileItem rootItem() const;
275 
281  virtual KFileItem findByUrl( const KUrl& _url ) const;
282 
288  virtual KFileItem findByName( const QString& name ) const;
289 
301  virtual void setNameFilter( const QString &filter );
302 
308  QString nameFilter() const;
309 
323  virtual void setMimeFilter( const QStringList &mimeList );
324 
339  void setMimeExcludeFilter(const QStringList &mimeList );
340 
341 
349  virtual void clearMimeFilter();
350 
355  QStringList mimeFilters() const;
356 
363  bool matchesFilter( const QString& name ) const;
364 
372  bool matchesMimeFilter( const QString& mime ) const;
373 
379  void setMainWindow( QWidget *window );
380 
385  QWidget *mainWindow();
386 
391  enum WhichItems
392  {
393  AllItems = 0,
394  FilteredItems = 1
395  };
396 
412  KFileItemList items( WhichItems which = FilteredItems ) const;
413 
432  KFileItemList itemsForDir( const KUrl& dir,
433  WhichItems which = FilteredItems ) const;
434 
445  static KFileItem cachedItemForUrl(const KUrl& url);
446 
447 Q_SIGNALS:
448 
458  void started( const KUrl& _url );
459 
463  void completed();
464 
470  void completed( const KUrl& _url );
471 
475  void canceled();
476 
482  void canceled( const KUrl& _url );
483 
490  void redirection( const KUrl& _url );
491 
497  void redirection( const KUrl& oldUrl, const KUrl& newUrl );
498 
503  void clear();
504 
510  void clear( const KUrl& _url );
511 
517  void newItems( const KFileItemList& items );
518 
527  void itemsAdded(const KUrl& directoryUrl, const KFileItemList& items);
528 
533  void itemsFilteredByMime( const KFileItemList& items );
534 
542  QT_MOC_COMPAT void deleteItem( const KFileItem &_fileItem ); // KDE5: remove, and port to itemsDeleted
543 
550  void itemsDeleted( const KFileItemList& items );
551 
560  void refreshItems( const QList<QPair<KFileItem, KFileItem> >& items );
561 
567  void infoMessage( const QString& msg );
568 
574  void percent( int percent );
575 
580  void totalSize( KIO::filesize_t size );
581 
586  void processedSize( KIO::filesize_t size );
587 
592  void speed( int bytes_per_second );
593 
594 protected:
596  enum Changes { NONE=0, NAME_FILTER=1, MIME_FILTER=2, DOT_FILES=4, DIR_ONLY_MODE=8 };
597 
610  virtual bool matchesFilter( const KFileItem& ) const;
611 
624  virtual bool matchesMimeFilter( const KFileItem& ) const;
625 
633  virtual bool doNameFilter( const QString& name, const QList<QRegExp>& filters ) const;
634 
642  virtual bool doMimeFilter( const QString& mime, const QStringList& filters ) const;
643 
645  virtual void handleError( KIO::Job * );
646 
647 private:
648  class Private;
649  Private* const d;
650  friend class Private;
651 
652  Q_PRIVATE_SLOT( d, void _k_slotInfoMessage( KJob*, const QString& ) )
653  Q_PRIVATE_SLOT( d, void _k_slotPercent( KJob*, unsigned long ) )
654  Q_PRIVATE_SLOT( d, void _k_slotTotalSize( KJob*, qulonglong ) )
655  Q_PRIVATE_SLOT( d, void _k_slotProcessedSize( KJob*, qulonglong ) )
656  Q_PRIVATE_SLOT( d, void _k_slotSpeed( KJob*, unsigned long ) )
657 };
658 
659 Q_DECLARE_OPERATORS_FOR_FLAGS(KDirLister::OpenUrlFlags)
660 
661 #endif
662 
QWidget
KDirListerCacheDirectoryData
Definition: kdirlister_p.h:448
KIO::filesize_t
qulonglong filesize_t
64-bit file size
Definition: global.h:57
kurl.h
kdirnotify.h
KUrl
QObject
NoFlags
KFileItemList
List of KFileItems, which adds a few helper methods to QList.
Definition: kfileitem.h:674
clear
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
KDirLister::OpenUrlFlag
OpenUrlFlag
Definition: kdirlister.h:72
QString
QList
QStringList
QPair
KDirLister::Private
Definition: kdirlister_p.h:42
KDirLister::Changes
Changes
Definition: kdirlister.h:596
KDirLister::WhichItems
WhichItems
Used by items() and itemsForDir() to specify whether you want all items for a directory or just the f...
Definition: kdirlister.h:391
KDirListerCache
Design of the cache: There is a single KDirListerCache for the whole process.
Definition: kdirlister_p.h:181
KRecentDirs::dir
QString dir(const QString &fileClass)
Returns the most recently used directory accociated with this file-class.
Definition: krecentdirs.cpp:68
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
Reload
KDirLister
Helper class for the kiojob used to list and update a directory.
Definition: kdirlister.h:57
KJob
kfileitem.h
KFileItem
A KFileItem is a generic class to handle a file, local or remote.
Definition: kfileitem.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:53 by doxygen 1.8.7 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 API Reference

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

Search



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