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

KIO

  • 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
32class KJob;
33namespace KIO { class Job; class ListJob; }
34
57class 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
71public:
72 enum OpenUrlFlag
73 {
74 NoFlags = 0x0,
75
76 Keep = 0x1,
80
81 Reload = 0x2
85 };
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
447Q_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
594protected:
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
647private:
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
659Q_DECLARE_OPERATORS_FOR_FLAGS(KDirLister::OpenUrlFlags)
660
661#endif
662
KDirListerCache
Design of the cache: There is a single KDirListerCache for the whole process.
Definition: kdirlister_p.h:182
KDirLister::Private
Definition: kdirlister_p.h:43
KDirLister
Helper class for the kiojob used to list and update a directory.
Definition: kdirlister.h:58
KDirLister::newItems
void newItems(const KFileItemList &items)
Signal new items.
KDirLister::redirection
void redirection(const KUrl &_url)
Signal a redirection.
KDirLister::speed
void speed(int bytes_per_second)
Emitted to display information about the speed of the jobs.
KDirLister::refreshItems
void refreshItems(const QList< QPair< KFileItem, KFileItem > > &items)
Signal an item to refresh (its mimetype/icon/name has changed).
KDirLister::itemsDeleted
void itemsDeleted(const KFileItemList &items)
Signal that items have been deleted.
KDirLister::infoMessage
void infoMessage(const QString &msg)
Emitted to display information about running jobs.
KDirLister::totalSize
void totalSize(KIO::filesize_t size)
Emitted when we know the size of the jobs.
KDirLister::canceled
void canceled()
Tell the view that the user canceled the listing.
KDirLister::deleteItem
QT_MOC_COMPAT void deleteItem(const KFileItem &_fileItem)
Signals that an item has been deleted.
KDirLister::OpenUrlFlag
OpenUrlFlag
Definition: kdirlister.h:73
KDirLister::completed
void completed()
Tell the view that listing is finished.
KDirLister::itemsAdded
void itemsAdded(const KUrl &directoryUrl, const KFileItemList &items)
Signal that new items were found during directory listing.
KDirLister::Changes
Changes
Definition: kdirlister.h:596
KDirLister::processedSize
void processedSize(KIO::filesize_t size)
Regularly emitted to show the progress of this KDirLister.
KDirLister::completed
void completed(const KUrl &_url)
Tell the view that the listing of the directory _url is finished.
KDirLister::canceled
void canceled(const KUrl &_url)
Tell the view that the listing of the directory _url was canceled.
KDirLister::clear
void clear()
Signal to clear all items.
KDirLister::started
void started(const KUrl &_url)
Tell the view that we started to list _url.
KDirLister::redirection
void redirection(const KUrl &oldUrl, const KUrl &newUrl)
Signal a redirection.
KDirLister::itemsFilteredByMime
void itemsFilteredByMime(const KFileItemList &items)
Send a list of items filtered-out by mime-type.
KDirLister::clear
void clear(const KUrl &_url)
Signal to empty the directory _url.
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:392
KDirLister::percent
void percent(int percent)
Progress signal showing the overall progress of the KDirLister.
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
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
KJob
KUrl::List
KUrl
QList
QObject
QPair
QWidget
kdirnotify.h
kfileitem.h
kurl.h
NoFlags
NoFlags
KIO
A namespace for KIO globals.
Definition: kbookmarkmenu.h:55
KIO::filesize_t
qulonglong filesize_t
64-bit file size
Definition: global.h:57
stop
KGuiItem stop()
Reload
Reload
KDirListerCacheDirectoryData
Definition: kdirlister_p.h:449
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