KCoreDirLister
#include <KCoreDirLister>

Public Types | |
enum | OpenUrlFlag { NoFlags = 0x0, Keep = 0x1, Reload = 0x2 } |
typedef QFlags< OpenUrlFlag > | OpenUrlFlags |
enum | WhichItems { AllItems = 0, FilteredItems = 1 } |
Properties | |
bool | autoErrorHandlingEnabled |
bool | autoUpdate |
bool | delayedMimeTypes |
bool | dirOnlyMode |
QStringList | mimeFilter |
QString | nameFilter |
bool | requestMimeTypeWhileListing |
bool | showHiddenFiles |
bool | showingDotFiles |
![]() | |
objectName | |
Signals | |
void | canceled () |
void | canceled (const QUrl &dirUrl) |
void | clear () |
void | clear (const QUrl &dirUrl) |
void | clearDir (const QUrl &dirUrl) |
void | completed () |
void | completed (const QUrl &dirUrl) |
void | infoMessage (const QString &msg) |
void | itemsAdded (const QUrl &directoryUrl, const KFileItemList &items) |
void | itemsDeleted (const KFileItemList &items) |
void | itemsFilteredByMime (const KFileItemList &items) |
void | jobError (KIO::Job *job) |
void | listingDirCanceled (const QUrl &dirUrl) |
void | listingDirCompleted (const QUrl &dirUrl) |
void | newItems (const KFileItemList &items) |
void | percent (int percent) |
void | processedSize (KIO::filesize_t size) |
void | redirection (const QUrl &_url) |
void | redirection (const QUrl &oldUrl, const QUrl &newUrl) |
void | refreshItems (const QList< QPair< KFileItem, KFileItem >> &items) |
void | speed (int bytes_per_second) |
void | started (const QUrl &dirUrl) |
void | totalSize (KIO::filesize_t size) |
Public Member Functions | |
KCoreDirLister (QObject *parent=nullptr) | |
~KCoreDirLister () override | |
bool | autoErrorHandlingEnabled () const |
bool | autoUpdate () const |
virtual void | clearMimeFilter () |
bool | delayedMimeTypes () const |
QList< QUrl > | directories () const |
bool | dirOnlyMode () const |
virtual void | emitChanges () |
virtual KFileItem | findByName (const QString &name) const |
virtual KFileItem | findByUrl (const QUrl &url) const |
void | forgetDirs (const QUrl &dirUrl) |
bool | isFinished () const |
KFileItemList | items (WhichItems which=FilteredItems) const |
KFileItemList | itemsForDir (const QUrl &dirUrl, WhichItems which=FilteredItems) const |
bool | matchesFilter (const QString &name) const |
bool | matchesMimeFilter (const QString &mimeType) const |
QStringList | mimeFilters () const |
QString | nameFilter () const |
virtual bool | openUrl (const QUrl &dirUrl, OpenUrlFlags flags=NoFlags) |
bool | requestMimeTypeWhileListing () const |
KFileItem | rootItem () const |
void | setAutoErrorHandlingEnabled (bool enable) |
virtual void | setAutoUpdate (bool enable) |
void | setDelayedMimeTypes (bool delayedMimeTypes) |
virtual void | setDirOnlyMode (bool dirsOnly) |
void | setMimeExcludeFilter (const QStringList &mimeList) |
virtual void | setMimeFilter (const QStringList &mimeList) |
virtual void | setNameFilter (const QString &filter) |
void | setRequestMimeTypeWhileListing (bool request) |
void | setShowHiddenFiles (bool showHiddenFiles) |
virtual void | setShowingDotFiles (bool showDotFiles) |
bool | showHiddenFiles () const |
bool | showingDotFiles () const |
virtual void | stop () |
virtual void | stop (const QUrl &dirUrl) |
virtual void | updateDirectory (const QUrl &dirUrl) |
QUrl | url () const |
![]() | |
QObject (QObject *parent) | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Static Public Member Functions | |
static KFileItem | cachedItemForUrl (const QUrl &url) |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Types | |
enum | Changes { NONE = 0, NAME_FILTER = 1, MIME_FILTER = 2, DOT_FILES = 4, DIR_ONLY_MODE = 8 } |
Protected Member Functions | |
virtual bool | doMimeFilter (const QString &mimeType, const QStringList &filters) const |
virtual bool | doNameFilter (const QString &name, const QList< QRegExp > &filters) const |
virtual void | handleError (KIO::Job *) |
virtual void | handleErrorMessage (const QString &message) |
virtual void | jobStarted (KIO::ListJob *) |
virtual bool | matchesFilter (const KFileItem &) const |
virtual bool | matchesMimeFilter (const KFileItem &) const |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
![]() | |
typedef | QObjectList |
Detailed Description
Helper class for the kiojob used to list and update a directory.
The dir lister deals with the kiojob used to list and update a directory and has signals for the user of this class (e.g. konqueror view or kdesktop) to create/destroy its items when asked.
This class is independent from the graphical representation of the dir (icon container, tree view, ...) and it stores the items (as KFileItems).
Typical usage :
- Create an instance.
- Connect to at least update, clear, itemsAdded, and itemsDeleted.
- Call openUrl - the signals will be called.
- Reuse the instance when opening a new url (openUrl).
- Destroy the instance when not needed anymore (usually destructor).
Advanced usage : call openUrl with OpenUrlFlag::Keep to list directories without forgetting the ones previously read (e.g. for a tree view)
Definition at line 54 of file kcoredirlister.h.
Member Typedef Documentation
◆ OpenUrlFlags
typedef QFlags< OpenUrlFlag > KCoreDirLister::OpenUrlFlags |
Stores a combination of OpenUrlFlag values.
Definition at line 93 of file kcoredirlister.h.
Member Enumeration Documentation
◆ Changes
|
protected |
- Deprecated:
- Since 4.3, and unused, ignore this
Definition at line 765 of file kcoredirlister.h.
◆ OpenUrlFlag
- See also
- OpenUrlFlags
Enumerator | |
---|---|
NoFlags | No additional flags specified. |
Keep | Previous directories aren't forgotten. (they are still watched by kdirwatch and their items are kept for this KCoreDirLister). This is useful for e.g. a treeview. |
Reload | Indicates whether to use the cache or to reread the directory from the disk. Use only when opening a dir not yet listed by this lister without using the cache. Otherwise use updateDirectory. |
Definition at line 76 of file kcoredirlister.h.
◆ WhichItems
Used by items() and itemsForDir() to specify whether you want all items for a directory or just the filtered ones.
Definition at line 474 of file kcoredirlister.h.
Constructor & Destructor Documentation
◆ KCoreDirLister()
KCoreDirLister::KCoreDirLister | ( | QObject * | parent = nullptr | ) |
Create a directory lister.
Definition at line 2098 of file kcoredirlister.cpp.
◆ ~KCoreDirLister()
|
override |
Destroy the directory lister.
Definition at line 2111 of file kcoredirlister.cpp.
Member Function Documentation
◆ autoErrorHandlingEnabled()
bool KCoreDirLister::autoErrorHandlingEnabled | ( | ) | const |
Checks whether auto error handling is enabled.
If enabled, it will show an error dialog to the user when an error occurs (assuming the application links to KIOWidgets). It is turned on by default.
- Returns
true
if auto error handling is enabled,false
otherwise
- See also
- setAutoErrorHandlingEnabled()
- Since
- 5.82
◆ autoUpdate()
bool KCoreDirLister::autoUpdate | ( | ) | const |
◆ cachedItemForUrl()
Return the KFileItem for the given URL, if it was listed recently and it's still in the cache, which is always the case if a directory view is currently showing this item.
If not, then it might be in the cache; if not in the cache a a null KFileItem will be returned.
If you really need a KFileItem for this URL in all cases, then use KIO::stat() instead.
- Since
- 4.2
Definition at line 2834 of file kcoredirlister.cpp.
◆ canceled [1/2]
|
signal |
Tell the view that the user canceled the listing.
No running jobs are left.
◆ canceled [2/2]
|
signal |
Tell the view that the listing of the directory dirUrl
was canceled.
There might be other running jobs left.
- Parameters
-
dirUrl the directory URL
- Deprecated:
- since 5.79, use KCoreDirLister::listingDirCanceled(const QUrl &)
◆ clear [1/2]
|
signal |
Signals to the view to remove all items (when e.g. going from dirA to dirB).
Make sure to connect to this signal to avoid having duplicate items in the view.
◆ clear [2/2]
|
signal |
Signals to the view to clear all items from directory dirUrl
.
This is only emitted if the lister is holding more than one directory.
- Parameters
-
dirUrl the directory that the view should clear all items from
- Deprecated:
- since 5.79, use clearDir(const QUrl &)
◆ clearDir
|
signal |
Signals to the view to clear all items from directory dirUrl
.
This is only emitted if the lister is holding more than one directory.
- Parameters
-
dirUrl the directory that the view should clear all items from
- Since
- 5.79
◆ clearMimeFilter()
|
virtual |
Clears the MIME type based filter.
You need to call emitChanges() afterwards.
- See also
- setMimeFilter
Definition at line 2395 of file kcoredirlister.cpp.
◆ completed [1/2]
|
signal |
Tell the view that listing is finished.
There are no jobs running anymore.
◆ completed [2/2]
|
signal |
Tell the view that the listing of the directory dirUrl
is finished.
There might be other running jobs left.
- Parameters
-
dirUrl the directory URL
- Deprecated:
- since 5.79, use KCoreDirLister::listingDirCompleted(const QUrl &)
◆ delayedMimeTypes()
bool KCoreDirLister::delayedMimeTypes | ( | ) | const |
- Returns
true
if the "delayed MIME types" feature was enabled
- See also
- setDelayedMimeTypes
◆ directories()
Returns all URLs that are listed by this KCoreDirLister.
This is only useful if you called openUrl() with OpenUrlFlag::Keep, as it happens in a treeview, for example. (Note that the base url is included in the list as well, of course.)
- Returns
- a list of all listed URLs
Definition at line 2234 of file kcoredirlister.cpp.
◆ dirOnlyMode()
bool KCoreDirLister::dirOnlyMode | ( | ) | const |
Checks whether this KCoreDirLister only lists directories or all items (directories and files), by default all items are listed.
- Returns
true
if only directories are listed,false
otherwise
- See also
- setDirOnlyMode(bool)
◆ doMimeFilter()
|
protectedvirtual |
Called by the public matchesMimeFilter() to do the actual filtering.
Those methods may be reimplemented to customize filtering.
- Parameters
-
mimeType the MIME type to filter filters the list of MIME types to filter
Definition at line 2473 of file kcoredirlister.cpp.
◆ doNameFilter()
|
protectedvirtual |
Called by the public matchesFilter() to do the actual filtering.
Those methods may be reimplemented to customize filtering.
- Parameters
-
name the name to filter filters a list of regular expressions for filtering
- Deprecated:
- Since 5.90, removed from the public API as it has no users.
Definition at line 2465 of file kcoredirlister.cpp.
◆ emitChanges()
|
virtual |
Actually emit the changes made with setShowHiddenFiles, setDirOnlyMode, setNameFilter and setMimeFilter.
Definition at line 2239 of file kcoredirlister.cpp.
◆ findByName()
Find an item by its name.
- Parameters
-
name the item name
- Returns
- the KFileItem
Definition at line 2324 of file kcoredirlister.cpp.
◆ findByUrl()
Find an item by its URL.
- Parameters
-
url the item URL
- Returns
- the KFileItem
Definition at line 2319 of file kcoredirlister.cpp.
◆ forgetDirs()
void KCoreDirLister::forgetDirs | ( | const QUrl & | dirUrl | ) |
Stop listening for further changes in the given directory.
When a new directory is opened with OpenUrlFlag::Keep the caller will keep being notified of file changes for all directories that were kept open. This call selectively removes a directory from sending future notifications to this KCoreDirLister.
- Parameters
-
dirUrl the directory URL.
- Since
- 5.91
Definition at line 2145 of file kcoredirlister.cpp.
◆ handleError()
|
protectedvirtual |
Reimplement to customize error handling.
- Deprecated:
- since 5.82, connect to the jobError() signal instead
Reimplemented in KDirLister.
Definition at line 2499 of file kcoredirlister.cpp.
◆ handleErrorMessage()
|
protectedvirtual |
Reimplement to customize error handling.
- Deprecated:
- since 5.81, use handleError.
Since 5.82, jobError() is emitted instead for the two cases where handleErrorMessage was emitted (invalid URL, protocol not supporting listing).
Reimplemented in KDirLister.
Definition at line 2506 of file kcoredirlister.cpp.
◆ infoMessage
|
signal |
Emitted to display information about running jobs.
Examples of message are "Resolving host", "Connecting to host...", etc.
- Parameters
-
msg the info message
◆ isFinished()
bool KCoreDirLister::isFinished | ( | ) | const |
Returns true
if no I/O operation is currently in progress.
- Returns
true
if finished,false
otherwise
Definition at line 2309 of file kcoredirlister.cpp.
◆ items()
KFileItemList KCoreDirLister::items | ( | WhichItems | which = FilteredItems | ) | const |
Returns the items listed for the current url().
This method will not start listing a directory, you should only call this in a slot connected to the finished() signal.
The items in the KFileItemList are copies of the items used by KCoreDirLister.
- Parameters
-
which specifies whether the returned list will contain all entries or only the ones that passed the nameFilter(), mimeFilter(), etc. Note that the latter causes iteration over all the items, filtering them. If this is too slow for you, use the newItems() signal, sending out filtered items in chunks
- Returns
- the items listed for the current url()
Definition at line 2737 of file kcoredirlister.cpp.
◆ itemsAdded
|
signal |
Signal that new items were found during directory listing.
Alternative signal emitted at the same time as newItems(), but itemsAdded also passes the url of the parent directory.
- Parameters
-
items a list of new items
- Since
- 4.2
◆ itemsDeleted
|
signal |
Signal that items have been deleted.
- Since
- 4.1.2
- Parameters
-
items the list of deleted items
◆ itemsFilteredByMime
|
signal |
Send a list of items filtered-out by MIME type.
- Parameters
-
items the list of filtered items
- Deprecated:
- since 5.100, no known users.
◆ itemsForDir()
KFileItemList KCoreDirLister::itemsForDir | ( | const QUrl & | dirUrl, |
WhichItems | which = FilteredItems |
||
) | const |
Returns the items listed for the given dirUrl
.
This method will not start listing dirUrl
, you should only call this in a slot connected to the finished() signal.
The items in the KFileItemList are copies of the items used by KCoreDirLister.
- Parameters
-
dirUrl specifies the url for which the items should be returned. This is only useful if you use KCoreDirLister with multiple URLs i.e. using bool OpenUrlFlag::Keep in openUrl() which specifies whether the returned list will contain all entries or only the ones that passed the nameFilter, mimeFilter, etc. Note that the latter causes iteration over all the items, filtering them. If this is too slow for you, use the newItems() signal, sending out filtered items in chunks
- Returns
- the items listed for
dirUrl
Definition at line 2742 of file kcoredirlister.cpp.
◆ jobError
|
signal |
Emitted if listing a directory fails with an error.
A typical implementation in a widgets-based application would show a message box by calling this in a slot connected to this signal: job->uiDelegate()->showErrorMessage()
Many applications might prefer to embed the error message though (e.g. by using the KMessageWidget class, from the KWidgetsAddons Framework).
- Parameters
-
the job with an error
- Since
- 5.82
◆ jobStarted()
|
protectedvirtual |
Reimplemented by KDirLister to associate windows with jobs.
- Since
- 5.0
Reimplemented in KDirLister.
Definition at line 2704 of file kcoredirlister.cpp.
◆ listingDirCanceled
|
signal |
Tell the view that the listing of the directory dirUrl
was canceled.
There might be other running jobs left.
- Parameters
-
dirUrl the directory URL
- Since
- 5.79
◆ listingDirCompleted
|
signal |
Tell the view that the listing of the directory dirUrl
is finished.
There might be other running jobs left.
- Parameters
-
dirUrl the directory URL
- Since
- 5.79
◆ matchesFilter() [1/2]
|
protectedvirtual |
Called for every new item before emitting newItems().
You may reimplement this method in a subclass to implement your own filtering. The default implementation filters out ".." and everything not matching the name filter(s)
- Returns
true
if the item is "ok".false
if the item shall not be shown in a view, e.g. files not matching a pattern *.cpp ( KFileItem::isHidden())
- See also
- matchesFilter
- setNameFilter
Definition at line 2435 of file kcoredirlister.cpp.
◆ matchesFilter() [2/2]
bool KCoreDirLister::matchesFilter | ( | const QString & | name | ) | const |
Checks whether name
matches a filter in the list of name filters.
- Returns
true
ifname
matches a filter in the list, otherwisefalse
.
- Deprecated:
- since 5.94, no known users.
- See also
- setNameFilter()
Definition at line 2408 of file kcoredirlister.cpp.
◆ matchesMimeFilter() [1/2]
|
protectedvirtual |
Called for every new item before emitting newItems().
You may reimplement this method in a subclass to implement your own filtering. The default implementation filters out everything not matching the mime filter(s)
- Returns
true
if the item is "ok".false
if the item shall not be shown in a view, e.g. files not matching the mime filter
- See also
- matchesMimeFilter
- setMimeFilter
Definition at line 2454 of file kcoredirlister.cpp.
◆ matchesMimeFilter() [2/2]
bool KCoreDirLister::matchesMimeFilter | ( | const QString & | mimeType | ) | const |
Checks whether mimeType
matches a filter in the list of MIME types.
- Parameters
-
mimeType the MIME type to find in the filter list
- Returns
true
ifmimeType
matches a filter in the list, otherwisefalse
- Deprecated:
- since 5.94, no known users.
- See also
- setMimeFilter.
Definition at line 2422 of file kcoredirlister.cpp.
◆ mimeFilters()
QStringList KCoreDirLister::mimeFilters | ( | ) | const |
Returns the list of MIME type based filters, as set via setMimeFilter().
- Returns
- the list of MIME type based filters. Empty, when no MIME type filter is set.
Definition at line 2402 of file kcoredirlister.cpp.
◆ nameFilter()
QString KCoreDirLister::nameFilter | ( | ) | const |
Returns the current name filter, as set via setNameFilter()
- Returns
- the current name filter, can be QString() if filtering is turned off
◆ newItems
|
signal |
Signal new items.
- Parameters
-
items a list of new items
◆ openUrl()
|
virtual |
Run the directory lister on the given url.
This method causes KCoreDirLister to emit all the items of dirUrl
, in any case. Depending on flags
, either clear() or clearDir(const QUrl &) will be emitted first.
The newItems() signal may be emitted more than once to supply you with KFileItems, up until the signal completed() is emitted (and isFinished() returns true
).
- Parameters
-
dirUrl the directory URL. flags whether to keep previous directories, and whether to reload, see OpenUrlFlags
- Returns
true
if successful,false
otherwise (e.g. ifdirUrl
is invalid)
- Note
- clearDir(const QUrl &) is emitted since 5.79; before that it was clear(const QUrl &) which has been deprecated.
Definition at line 2123 of file kcoredirlister.cpp.
◆ percent
|
signal |
Progress signal showing the overall progress of the KCoreDirLister.
This allows using a progress bar very easily. (see QProgressBar)
- Parameters
-
percent the progress in percent
◆ processedSize
|
signal |
Regularly emitted to show the progress of this KCoreDirLister.
- Parameters
-
size the processed size in bytes
◆ redirection [1/2]
|
signal |
Signal a redirection.
Only emitted if there's just one directory to list, i.e. most probably openUrl() has been called without OpenUrlFlag::Keep.
- Parameters
-
dirUrl the new URL
- Deprecated:
- since 5.80, use redirection(const QUrl &, const QUrl &)
◆ redirection [2/2]
Signals a redirection.
- Parameters
-
oldUrl the original URL newUrl the new URL
◆ refreshItems
Signal an item to refresh (its MIME-type/icon/name has changed).
Note: KFileItem::refresh has already been called on those items.
- Parameters
-
items the items to refresh. This is a list of pairs, where the first item in the pair is the OLD item, and the second item is the NEW item. This allows to track which item has changed, especially after a renaming.
◆ requestMimeTypeWhileListing()
bool KCoreDirLister::requestMimeTypeWhileListing | ( | ) | const |
Checks whether this KCoreDirLister requests the MIME type of files from the worker.
Enabling this will tell the worker used for listing that it should try to determine the mime type of entries while listing them. This potentially reduces the speed at which entries are listed but ensures mime types are immediately available when an entry is added, greatly speeding up things like mime type filtering.
By default this is disabled.
- Returns
true
if the worker is asked for MIME types,false
otherwise.
- Since
- 5.82
◆ rootItem()
KFileItem KCoreDirLister::rootItem | ( | ) | const |
Returns the file item of the URL.
Can return an empty KFileItem.
- Returns
- the file item for url() itself (".")
Definition at line 2314 of file kcoredirlister.cpp.
◆ setAutoErrorHandlingEnabled()
void KCoreDirLister::setAutoErrorHandlingEnabled | ( | bool | enable | ) |
Enable or disable auto error handling.
If enabled, it will show an error dialog to the user when an error occurs. It is turned on by default.
- Parameters
-
enable true to enable auto error handling, false to disable parent the parent widget for the error dialogs, can be nullptr
for top-level
- See also
- autoErrorHandlingEnabled()
- Since
- 5.82
Definition at line 2848 of file kcoredirlister.cpp.
◆ setAutoUpdate()
|
virtual |
Toggle automatic directory updating, when a directory changes (using KDirWatch).
- Parameters
-
enable set to true
to enable orfalse
to disable
Definition at line 2155 of file kcoredirlister.cpp.
◆ setDelayedMimeTypes()
void KCoreDirLister::setDelayedMimeTypes | ( | bool | delayedMimeTypes | ) |
Delayed MIME types feature: If enabled, MIME types will be fetched on demand, which leads to a faster initial directory listing, where icons get progressively replaced with the correct one while KMimeTypeResolver is going through the items with unknown or imprecise MIME type (e.g.
files with no extension or an unknown extension).
Definition at line 2765 of file kcoredirlister.cpp.
◆ setDirOnlyMode()
|
virtual |
Call this to list only directories (by default all items (directories and files) are listed).
You need to call emitChanges() afterwards.
- Parameters
-
dirsOnly set to true
to list only directories
Definition at line 2199 of file kcoredirlister.cpp.
◆ setMimeExcludeFilter()
void KCoreDirLister::setMimeExcludeFilter | ( | const QStringList & | mimeList | ) |
Filtering should be done with KFileFilter.
This will be implemented in a later revision of KCoreDirLister. This method may be removed then.
Set MIME type based exclude filter to only list items not matching the given MIME types
NOTE: setting the filter does not automatically reload directory. Also calling this function will not affect any named filter already set.
- Parameters
-
mimeList a list of MIME types
- See also
- clearMimeFilter
- matchesMimeFilter
- Deprecated:
- since 5.100, no known users.
Definition at line 2384 of file kcoredirlister.cpp.
◆ setMimeFilter()
|
virtual |
Set MIME type based filter to only list items matching the given MIME types.
NOTE: setting the filter does not automatically reload directory. Also calling this function will not affect any named filter already set.
You need to call emitChanges() afterwards.
- Parameters
-
mimeList a list of MIME types
- See also
- clearMimeFilter
- matchesMimeFilter
Definition at line 2369 of file kcoredirlister.cpp.
◆ setNameFilter()
|
virtual |
Set a name filter to only list items matching this name, e.g. "*.cpp".
You can set more than one filter by separating them with whitespace, e.g "*.cpp *.h". Note: the directory is not automatically reloaded. You need to call emitChanges() afterwards.
- Parameters
-
filter the new filter, QString() to disable filtering
- See also
- matchesFilter
Definition at line 2347 of file kcoredirlister.cpp.
◆ setRequestMimeTypeWhileListing()
void KCoreDirLister::setRequestMimeTypeWhileListing | ( | bool | request | ) |
Toggles whether to request MIME types from the worker or in-process.
- Parameters
-
request set to true
to request MIME types from the worker.
- Note
- If this is changed while the lister is already listing a directory, it will only have an effect the next time openUrl() is called.
- See also
- requestMimeTypeWhileListing()
- Since
- 5.82
Definition at line 2214 of file kcoredirlister.cpp.
◆ setShowHiddenFiles()
void KCoreDirLister::setShowHiddenFiles | ( | bool | showHiddenFiles | ) |
Toggles whether hidden files (e.g.
files whose name start with '.' on Unix) are shown/ By default hidden files are not shown.
You need to call emitChanges() afterwards.
- Parameters
-
showHiddenFiles set to true/false
to show/hide hidden files respectively
- See also
- showHiddenFiles()
- Since
- 5.100
Definition at line 2177 of file kcoredirlister.cpp.
◆ setShowingDotFiles()
|
virtual |
Toggles whether hidden files (files whose name start with '.
') are shown, by default hidden files are not shown.
You need to call emitChanges() afterwards.
- Parameters
-
showDotFiles set to true/false
to show/hide hidden files respectively
- Deprecated:
- since 5.100, use setShowHiddenFiles() instead.
- See also
- showingDotFiles()
Definition at line 2188 of file kcoredirlister.cpp.
◆ showHiddenFiles()
bool KCoreDirLister::showHiddenFiles | ( | ) | const |
Checks whether hidden files (e.g.
files whose name start with '.' on Unix) will be shown. By default this option is disabled (hidden files are not shown).
- Returns
true
if hidden files are shown,false
otherwise
- See also
- setShowHiddenFiles()
- Since
- 5.100
◆ showingDotFiles()
bool KCoreDirLister::showingDotFiles | ( | ) | const |
Checks whether hidden files (files whose name start with '.
') will be shown. By default this option is disabled (hidden files are not shown).
- Returns
true
if dot files are shown,false
otherwise
- Deprecated:
- since 5.100, use showHiddenFiles instead.
- See also
- setShowingDotFiles()
◆ speed
|
signal |
Emitted to display information about the speed of the jobs.
- Parameters
-
bytes_per_second the speed in bytes/s
◆ started
|
signal |
Tell the view that this KCoreDirLister has started to list dirUrl
.
Note that this does not imply that there is really a job running! I.e. KCoreDirLister::jobs() may return an empty list, in which case the items are taken from the cache.
The view knows that openUrl should start it, so this might seem useless, but the view also needs to know when an automatic update happens.
- Parameters
-
dirUrl the URL to list
◆ stop() [1/2]
|
virtual |
Stop listing all directories currently being listed.
Emits canceled() if there was at least one job running. Emits listingDirCanceled(const QUrl &) for each stopped job if there is more than one directory being watched by this KCoreDirLister.
- Note
- listingDirCanceled(const QUrl &) is emitted since 5.79; before that it was canceled(const QUrl &) which has been deprecated.
Definition at line 2135 of file kcoredirlister.cpp.
◆ stop() [2/2]
|
virtual |
Stop listing the given directory.
Emits canceled() if the killed job was the last running one. Emits listingDirCanceled(const QUrl &) for the killed job if there is more than one directory being watched by this KCoreDirLister.
No signal is emitted if there was no job running for dirUrl
.
- Parameters
-
dirUrl the directory URL
- Note
- listingDirCanceled(const QUrl &) is emitted since 5.79; before that it was canceled(const QUrl &) which has been deprecated.
Definition at line 2140 of file kcoredirlister.cpp.
◆ totalSize
|
signal |
Emitted when we know the size of the jobs.
- Parameters
-
size the total size in bytes
◆ updateDirectory()
|
virtual |
Update the directory dirUrl
.
This method causes KCoreDirLister to only emit the items of dirUrl
that actually changed compared to the current state in the cache, and updates the cache.
The current implementation calls updateDirectory automatically for local files, using KDirWatch (if autoUpdate() is true
), but it might be useful to force an update manually.
- Parameters
-
dirUrl the directory URL
Definition at line 2304 of file kcoredirlister.cpp.
◆ url()
QUrl KCoreDirLister::url | ( | ) | const |
Returns the top level URL that is listed by this KCoreDirLister.
It might be different from the one given with openUrl() if there was a redirection. If you called openUrl() with OpenUrlFlag::Keep this is the first url opened (e.g. in a treeview this is the root).
- Returns
- the url used by this instance to list the files
Definition at line 2229 of file kcoredirlister.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Mar 27 2023 04:04:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.