KIO

kcoredirlister.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org>
4 SPDX-FileCopyrightText: 2001, 2002, 2004-2006 Michael Brade <brade@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KCOREDIRLISTER_H
10#define KCOREDIRLISTER_H
11
12#include "kfileitem.h"
13
14#include <QString>
15#include <QStringList>
16#include <QUrl>
17
18#include <memory>
19
20class KJob;
21namespace KIO
22{
23class Job;
24class ListJob;
25}
26
27class KCoreDirListerPrivate;
28
29/**
30 * @class KCoreDirLister kcoredirlister.h <KCoreDirLister>
31 *
32 * @short Helper class for the kiojob used to list and update a directory.
33 *
34 * The dir lister deals with the kiojob used to list and update a directory
35 * and has signals for the user of this class (e.g. konqueror view or
36 * kdesktop) to create/destroy its items when asked.
37 *
38 * This class is independent from the graphical representation of the dir
39 * (icon container, tree view, ...) and it stores the items (as KFileItems).
40 *
41 * Typical usage :
42 * @li Create an instance.
43 * @li Connect to at least update, clear, itemsAdded, and itemsDeleted.
44 * @li Call openUrl - the signals will be called.
45 * @li Reuse the instance when opening a new url (openUrl).
46 * @li Destroy the instance when not needed anymore (usually destructor).
47 *
48 * Advanced usage : call openUrl with OpenUrlFlag::Keep to list directories
49 * without forgetting the ones previously read (e.g. for a tree view)
50 *
51 * @author Michael Brade <brade@kde.org>
52 */
53class KIOCORE_EXPORT KCoreDirLister : public QObject
54{
55 friend class KCoreDirListerCache;
56 friend struct KCoreDirListerCacheDirectoryData;
57
59 Q_PROPERTY(bool autoUpdate READ autoUpdate WRITE setAutoUpdate)
60 Q_PROPERTY(bool showHiddenFiles READ showHiddenFiles WRITE setShowHiddenFiles)
61 Q_PROPERTY(bool dirOnlyMode READ dirOnlyMode WRITE setDirOnlyMode)
62 Q_PROPERTY(bool delayedMimeTypes READ delayedMimeTypes WRITE setDelayedMimeTypes)
63 Q_PROPERTY(bool requestMimeTypeWhileListing READ requestMimeTypeWhileListing WRITE setRequestMimeTypeWhileListing)
64 Q_PROPERTY(QString nameFilter READ nameFilter WRITE setNameFilter)
66 Q_PROPERTY(bool autoErrorHandlingEnabled READ autoErrorHandlingEnabled WRITE setAutoErrorHandlingEnabled)
67
68public:
69 /**
70 * @see OpenUrlFlags
71 */
73 NoFlags = 0x0, ///< No additional flags specified.
74
75 Keep = 0x1, ///< Previous directories aren't forgotten
76 ///< (they are still watched by kdirwatch and their items
77 ///< are kept for this KCoreDirLister). This is useful for e.g.
78 ///< a treeview.
79
80 Reload = 0x2, ///< Indicates whether to use the cache or to reread
81 ///< the directory from the disk.
82 ///< Use only when opening a dir not yet listed by this lister
83 ///< without using the cache. Otherwise use updateDirectory.
84 };
85
86 /**
87 * Stores a combination of #OpenUrlFlag values.
88 */
89 Q_DECLARE_FLAGS(OpenUrlFlags, OpenUrlFlag)
90
91 /**
92 * Create a directory lister.
93 */
94 KCoreDirLister(QObject *parent = nullptr);
95
96 /**
97 * Destroy the directory lister.
98 */
99 ~KCoreDirLister() override;
100
101 /**
102 * Run the directory lister on the given url.
103 *
104 * This method causes KCoreDirLister to emit @em all the items of @p dirUrl, in any case.
105 * Depending on @p flags, either clear() or clearDir(const QUrl &) will be emitted first.
106 *
107 * The newItems() signal may be emitted more than once to supply you with KFileItems, up
108 * until the signal completed() is emitted (and isFinished() returns @c true).
109 *
110 * @param dirUrl the directory URL.
111 * @param flags whether to keep previous directories, and whether to reload, see OpenUrlFlags
112 * @return @c true if successful, @c false otherwise (e.g. if @p dirUrl is invalid)
113 */
114 bool openUrl(const QUrl &dirUrl, OpenUrlFlags flags = NoFlags); // TODO KF6: change bool to void
115
116 /**
117 * Stop listing all directories currently being listed.
118 *
119 * Emits canceled() if there was at least one job running.
120 * Emits listingDirCanceled(const QUrl &) for each stopped job if there is more than one
121 * directory being watched by this KCoreDirLister.
122 */
123 void stop();
124
125 /**
126 * Stop listing the given directory.
127 *
128 * Emits canceled() if the killed job was the last running one.
129 * Emits listingDirCanceled(const QUrl &) for the killed job if there is more than one
130 * directory being watched by this KCoreDirLister.
131 *
132 * No signal is emitted if there was no job running for @p dirUrl.
133 *
134 * @param dirUrl the directory URL
135 */
136 void stop(const QUrl &dirUrl);
137
138 /**
139 * Stop listening for further changes in the given directory.
140 * 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.
141 * This call selectively removes a directory from sending future notifications to this KCoreDirLister.
142 *
143 * @param dirUrl the directory URL.
144 * @since 5.91
145 */
146 void forgetDirs(const QUrl &dirUrl);
147
148 /**
149 * @return @c true if the "delayed MIME types" feature was enabled
150 * @see setDelayedMimeTypes
151 */
152 bool delayedMimeTypes() const;
153
154 /**
155 * Delayed MIME types feature:
156 * If enabled, MIME types will be fetched on demand, which leads to a
157 * faster initial directory listing, where icons get progressively replaced
158 * with the correct one while KMimeTypeResolver is going through the items
159 * with unknown or imprecise MIME type (e.g. files with no extension or an
160 * unknown extension).
161 */
162 void setDelayedMimeTypes(bool delayedMimeTypes);
163
164 /**
165 * Checks whether KDirWatch will automatically update directories. This is
166 * enabled by default.
167 *
168 * @return @c true if KDirWatch is used to automatically update directories
169 */
170 bool autoUpdate() const;
171
172 /**
173 * Toggle automatic directory updating, when a directory changes (using KDirWatch).
174 *
175 * @param enable set to @c true to enable or @c false to disable
176 */
177 void setAutoUpdate(bool enable);
178
179 /**
180 * Checks whether hidden files (e.g. files whose name start with '.' on Unix) will be shown.
181 * By default this option is disabled (hidden files are not shown).
182 *
183 * @return @c true if hidden files are shown, @c false otherwise
184 *
185 * @see setShowHiddenFiles()
186 * @since 5.100
187 */
188 bool showHiddenFiles() const;
189
190 /**
191 * Toggles whether hidden files (e.g. files whose name start with '.' on Unix) are shown/
192 * By default hidden files are not shown.
193 *
194 * You need to call emitChanges() afterwards.
195 *
196 * @param showHiddenFiles set to @c true/false to show/hide hidden files respectively
197 *
198 * @see showHiddenFiles()
199 * @since 5.100
200 */
201 void setShowHiddenFiles(bool showHiddenFiles);
202
203 /**
204 * Checks whether this KCoreDirLister only lists directories or all items (directories and
205 * files), by default all items are listed.
206 *
207 * @return @c true if only directories are listed, @c false otherwise
208 *
209 * @see setDirOnlyMode(bool)
210 */
211 bool dirOnlyMode() const;
212
213 /**
214 * Call this to list only directories (by default all items (directories and files)
215 * are listed).
216 *
217 * You need to call emitChanges() afterwards.
218 *
219 * @param dirsOnly set to @c true to list only directories
220 */
221 void setDirOnlyMode(bool dirsOnly);
222
223 /**
224 * Returns true if quickfiltering is enabled.
225 * If true, list only files that match the filter text.
226 *
227 * @return @c true if any files and folders matching filter are listed, @c false otherwise.
228 *
229 * @see setQuickFilterMode(bool)
230 */
231 bool quickFilterMode() const;
232
233 /**
234 * Call this to set the quick filtering mode on, which will filter through all the
235 * items based by their name, ignoring them if the name does not fit.
236 * This is equal to the Dolphin quick filter mode.
237 *
238 * You need to call emitChanges() afterwards.
239 *
240 * @param quickFilterMode set to @c true to list only files and folders that match the filter text.
241 */
243
244 /**
245 * Checks whether this KCoreDirLister requests the MIME type of files from the worker.
246 *
247 * Enabling this will tell the worker used for listing that it should try to
248 * determine the mime type of entries while listing them. This potentially
249 * reduces the speed at which entries are listed but ensures mime types are
250 * immediately available when an entry is added, greatly speeding up things
251 * like mime type filtering.
252 *
253 * By default this is disabled.
254 *
255 * @return @c true if the worker is asked for MIME types, @c false otherwise.
256 *
257 * @see setRequestMimeTypeWhileListing(bool)
258 *
259 * @since 5.82
260 */
261 bool requestMimeTypeWhileListing() const;
262
263 /**
264 * Toggles whether to request MIME types from the worker or in-process.
265 *
266 * @param request set to @c true to request MIME types from the worker.
267 *
268 * @note If this is changed while the lister is already listing a directory,
269 * it will only have an effect the next time openUrl() is called.
270 *
271 * @see requestMimeTypeWhileListing()
272 *
273 * @since 5.82
274 */
275 void setRequestMimeTypeWhileListing(bool request);
276
277 /**
278 * Returns the top level URL that is listed by this KCoreDirLister.
279 *
280 * It might be different from the one given with openUrl() if there was a
281 * redirection. If you called openUrl() with OpenUrlFlag::Keep this is the
282 * first url opened (e.g. in a treeview this is the root).
283 *
284 * @return the url used by this instance to list the files
285 */
286 QUrl url() const;
287
288 /**
289 * Returns all URLs that are listed by this KCoreDirLister. This is only
290 * useful if you called openUrl() with OpenUrlFlag::Keep, as it happens in a
291 * treeview, for example. (Note that the base url is included in the list
292 * as well, of course.)
293 *
294 * @return a list of all listed URLs
295 */
296 QList<QUrl> directories() const;
297
298 /**
299 * Actually emit the changes made with setShowHiddenFiles, setDirOnlyMode,
300 * setNameFilter and setMimeFilter.
301 */
302 void emitChanges();
303
304 /**
305 * Update the directory @p dirUrl. This method causes KCoreDirLister to @em only emit
306 * the items of @p dirUrl that actually changed compared to the current state in the
307 * cache, and updates the cache.
308 *
309 * The current implementation calls updateDirectory automatically for local files, using
310 * KDirWatch (if autoUpdate() is @c true), but it might be useful to force an update manually.
311 *
312 * @param dirUrl the directory URL
313 */
314 void updateDirectory(const QUrl &dirUrl);
315
316 /**
317 * Returns @c true if no I/O operation is currently in progress.
318 *
319 * @return @c true if finished, @c false otherwise
320 */
321 bool isFinished() const;
322
323 /**
324 * Returns the file item of the URL.
325 *
326 * Can return an empty KFileItem.
327 * @return the file item for url() itself (".")
328 */
329 KFileItem rootItem() const;
330
331 /**
332 * Find an item by its URL.
333 * @param url the item URL
334 * @return the KFileItem
335 */
336 KFileItem findByUrl(const QUrl &url) const;
337
338 /**
339 * Find an item by its name.
340 * @param name the item name
341 * @return the KFileItem
342 */
343 KFileItem findByName(const QString &name) const;
344
345 /**
346 * Set a name filter to only list items matching this name, e.g.\ "*.cpp".
347 *
348 * You can set more than one filter by separating them with whitespace, e.g
349 * "*.cpp *.h".
350 * Note: the directory is not automatically reloaded.
351 * You need to call emitChanges() afterwards.
352 *
353 * @param filter the new filter, QString() to disable filtering
354 * @see matchesFilter
355 */
356 void setNameFilter(const QString &filter);
357
358 /**
359 * Returns the current name filter, as set via setNameFilter()
360 * @return the current name filter, can be QString() if filtering
361 * is turned off
362 */
363 QString nameFilter() const;
364
365 /**
366 * Set MIME type based filter to only list items matching the given MIME types.
367 *
368 * NOTE: setting the filter does not automatically reload directory.
369 * Also calling this function will not affect any named filter already set.
370 *
371 * You need to call emitChanges() afterwards.
372 *
373 * @param mimeList a list of MIME types
374 *
375 * @see clearMimeFilter
376 * @see matchesMimeFilter
377 */
378 void setMimeFilter(const QStringList &mimeList);
379
380 /**
381 * Filtering should be done with KFileFilter. This will be implemented in a later
382 * revision of KCoreDirLister. This method may be removed then.
383 *
384 * Set MIME type based exclude filter to only list items not matching the given MIME types
385 *
386 * NOTE: setting the filter does not automatically reload directory.
387 * Also calling this function will not affect any named filter already set.
388 *
389 * @param mimeList a list of MIME types
390 * @see clearMimeFilter
391 * @see matchesMimeFilter
392 */
393 void setMimeExcludeFilter(const QStringList &mimeList);
394
395 /**
396 * Clears the MIME type based filter.
397 *
398 * You need to call emitChanges() afterwards.
399 *
400 * @see setMimeFilter
401 */
402 void clearMimeFilter();
403
404 /**
405 * Returns the list of MIME type based filters, as set via setMimeFilter().
406 * @return the list of MIME type based filters. Empty, when no MIME type filter is set.
407 */
408 QStringList mimeFilters() const;
409
410 /**
411 * Used by items() and itemsForDir() to specify whether you want
412 * all items for a directory or just the filtered ones.
413 */
415 AllItems = 0,
416 FilteredItems = 1,
417 };
418
419 /**
420 * Returns the items listed for the current url().
421 *
422 * This method will @em not start listing a directory, you should only call
423 * this in a slot connected to the finished() signal.
424 *
425 * The items in the KFileItemList are copies of the items used by KCoreDirLister.
426 *
427 * @param which specifies whether the returned list will contain all entries
428 * or only the ones that passed the nameFilter(), mimeFilter(),
429 * etc. Note that the latter causes iteration over all the
430 * items, filtering them. If this is too slow for you, use the
431 * newItems() signal, sending out filtered items in chunks
432 * @return the items listed for the current url()
433 */
434 KFileItemList items(WhichItems which = FilteredItems) const;
435
436 /**
437 * Returns the items listed for the given @p dirUrl.
438 * This method will @em not start listing @p dirUrl, you should only call
439 * this in a slot connected to the finished() signal.
440 *
441 * The items in the KFileItemList are copies of the items used by KCoreDirLister.
442 *
443 * @param dirUrl specifies the url for which the items should be returned. This
444 * is only useful if you use KCoreDirLister with multiple URLs
445 * i.e. using bool OpenUrlFlag::Keep in openUrl()
446 * @param which specifies whether the returned list will contain all entries
447 * or only the ones that passed the nameFilter, mimeFilter, etc.
448 * Note that the latter causes iteration over all the items,
449 * filtering them. If this is too slow for you, use the
450 * newItems() signal, sending out filtered items in chunks
451 *
452 * @return the items listed for @p dirUrl
453 */
454 KFileItemList itemsForDir(const QUrl &dirUrl, WhichItems which = FilteredItems) const;
455
456 /**
457 * Return the KFileItem for the given URL, if it was listed recently and it's
458 * still in the cache, which is always the case if a directory view is currently
459 * showing this item. If not, then it might be in the cache; if not in the cache a
460 * a null KFileItem will be returned.
461 *
462 * If you really need a KFileItem for this URL in all cases, then use KIO::stat() instead.
463 *
464 */
465 static KFileItem cachedItemForUrl(const QUrl &url);
466
467 /**
468 * Checks whether auto error handling is enabled.
469 * If enabled, it will show an error dialog to the user when an
470 * error occurs (assuming the application links to KIOWidgets).
471 * It is turned on by default.
472 * @return @c true if auto error handling is enabled, @c false otherwise
473 * @see setAutoErrorHandlingEnabled()
474 * @since 5.82
475 */
476 bool autoErrorHandlingEnabled() const;
477
478 /**
479 * Enable or disable auto error handling.
480 * If enabled, it will show an error dialog to the user when an
481 * error occurs. It is turned on by default.
482 * @param enable true to enable auto error handling, false to disable
483 * @param parent the parent widget for the error dialogs, can be @c nullptr for
484 * top-level
485 * @see autoErrorHandlingEnabled()
486 * @since 5.82
487 */
488 void setAutoErrorHandlingEnabled(bool enable);
489
490Q_SIGNALS:
491 /**
492 * Tell the view that this KCoreDirLister has started to list @p dirUrl. Note that this
493 * does @em not imply that there is really a job running! I.e. KCoreDirLister::jobs()
494 * may return an empty list, in which case the items are taken from the cache.
495 *
496 * The view knows that openUrl should start it, so this might seem useless, but the view
497 * also needs to know when an automatic update happens.
498 * @param dirUrl the URL to list
499 */
500 void started(const QUrl &dirUrl);
501
502 /**
503 * Tell the view that listing is finished. There are no jobs running anymore.
504 */
505 void completed();
506
507 /**
508 * Tell the view that the listing of the directory @p dirUrl is finished.
509 * There might be other running jobs left.
510 *
511 * @param dirUrl the directory URL
512 *
513 * @since 5.79
514 */
515 void listingDirCompleted(const QUrl &dirUrl);
516
517 /**
518 * Tell the view that the user canceled the listing. No running jobs are left.
519 */
520 void canceled();
521
522 /**
523 * Tell the view that the listing of the directory @p dirUrl was canceled.
524 * There might be other running jobs left.
525 *
526 * @param dirUrl the directory URL
527 *
528 * @since 5.79
529 */
530 void listingDirCanceled(const QUrl &dirUrl);
531
532 /**
533 * Signals a redirection.
534 *
535 * @param oldUrl the original URL
536 * @param newUrl the new URL
537 */
538 void redirection(const QUrl &oldUrl, const QUrl &newUrl);
539
540 /**
541 * Signals to the view to remove all items (when e.g.\ going from dirA to dirB).
542 * Make sure to connect to this signal to avoid having duplicate items in the view.
543 */
544 void clear();
545
546 /**
547 * Signals to the view to clear all items from directory @p dirUrl.
548 *
549 * This is only emitted if the lister is holding more than one directory.
550 *
551 * @param dirUrl the directory that the view should clear all items from
552 *
553 * @since 5.79
554 */
555 void clearDir(const QUrl &dirUrl);
556
557 /**
558 * Signal new items.
559 *
560 * @param items a list of new items
561 */
563
564 /**
565 * Signal that new items were found during directory listing.
566 * Alternative signal emitted at the same time as newItems(),
567 * but itemsAdded also passes the url of the parent directory.
568 *
569 * @param items a list of new items
570 */
571 void itemsAdded(const QUrl &directoryUrl, const KFileItemList &items);
572
573 /**
574 * Send a list of items filtered-out by MIME type.
575 * @param items the list of filtered items
576 *
577 */
579
580 /**
581 * Signal that items have been deleted
582 *
583 * @since 4.1.2
584 * @param items the list of deleted items
585 */
587
588 /**
589 * Signal an item to refresh (its MIME-type/icon/name has changed).
590 * Note: KFileItem::refresh has already been called on those items.
591 * @param items the items to refresh. This is a list of pairs, where
592 * the first item in the pair is the OLD item, and the second item is the
593 * NEW item. This allows to track which item has changed, especially after
594 * a renaming.
595 */
596 void refreshItems(const QList<QPair<KFileItem, KFileItem>> &items);
597
598 /**
599 * Emitted to display information about running jobs.
600 * Examples of message are "Resolving host", "Connecting to host...", etc.
601 * @param msg the info message
602 */
603 void infoMessage(const QString &msg);
604
605 /**
606 * Progress signal showing the overall progress of the KCoreDirLister.
607 * This allows using a progress bar very easily. (see QProgressBar)
608 * @param percent the progress in percent
609 */
610 void percent(int percent);
611
612 /**
613 * Emitted when we know the size of the jobs.
614 * @param size the total size in bytes
615 */
617
618 /**
619 * Regularly emitted to show the progress of this KCoreDirLister.
620 * @param size the processed size in bytes
621 */
623
624 /**
625 * Emitted to display information about the speed of the jobs.
626 * @param bytes_per_second the speed in bytes/s
627 */
628 void speed(int bytes_per_second);
629
630 /**
631 * Emitted if listing a directory fails with an error.
632 * A typical implementation in a widgets-based application
633 * would show a message box by calling this in a slot connected to this signal:
634 * <tt>job->uiDelegate()->showErrorMessage()</tt>
635 * Many applications might prefer to embed the error message though
636 * (e.g. by using the KMessageWidget class, from the KWidgetsAddons Framework).
637 * @param the job with an error
638 * @since 5.82
639 */
640 void jobError(KIO::Job *job);
641
642protected:
643 /**
644 * Reimplemented by KDirLister to associate windows with jobs
645 * @since 5.0
646 */
647 virtual void jobStarted(KIO::ListJob *);
648
649private:
650 friend class KCoreDirListerPrivate;
651 std::unique_ptr<KCoreDirListerPrivate> d;
652};
653
654Q_DECLARE_OPERATORS_FOR_FLAGS(KCoreDirLister::OpenUrlFlags)
655
656#endif
void emitChanges()
Actually emit the changes made with setShowHiddenFiles, setDirOnlyMode, setNameFilter and setMimeFilt...
void speed(int bytes_per_second)
Emitted to display information about the speed of the jobs.
virtual void jobStarted(KIO::ListJob *)
Reimplemented by KDirLister to associate windows with jobs.
void percent(int percent)
Progress signal showing the overall progress of the KCoreDirLister.
void forgetDirs(const QUrl &dirUrl)
Stop listening for further changes in the given directory.
QFlags< OpenUrlFlag > OpenUrlFlags
Stores a combination of OpenUrlFlag values.
void setShowHiddenFiles(bool showHiddenFiles)
Toggles whether hidden files (e.g.
void totalSize(KIO::filesize_t size)
Emitted when we know the size of the jobs.
void listingDirCompleted(const QUrl &dirUrl)
Tell the view that the listing of the directory dirUrl is finished.
WhichItems
Used by items() and itemsForDir() to specify whether you want all items for a directory or just the f...
void updateDirectory(const QUrl &dirUrl)
Update the directory dirUrl.
void clear()
Signals to the view to remove all items (when e.g. going from dirA to dirB).
void setNameFilter(const QString &filter)
Set a name filter to only list items matching this name, e.g. "*.cpp".
QList< QUrl > directories() const
Returns all URLs that are listed by this KCoreDirLister.
bool openUrl(const QUrl &dirUrl, OpenUrlFlags flags=NoFlags)
Run the directory lister on the given url.
void setMimeExcludeFilter(const QStringList &mimeList)
Filtering should be done with KFileFilter.
QUrl url() const
Returns the top level URL that is listed by this KCoreDirLister.
void itemsFilteredByMime(const KFileItemList &items)
Send a list of items filtered-out by MIME type.
void setRequestMimeTypeWhileListing(bool request)
Toggles whether to request MIME types from the worker or in-process.
void jobError(KIO::Job *job)
Emitted if listing a directory fails with an error.
void started(const QUrl &dirUrl)
Tell the view that this KCoreDirLister has started to list dirUrl.
KFileItemList items(WhichItems which=FilteredItems) const
Returns the items listed for the current url().
KFileItem findByUrl(const QUrl &url) const
Find an item by its URL.
void setDelayedMimeTypes(bool delayedMimeTypes)
Delayed MIME types feature: If enabled, MIME types will be fetched on demand, which leads to a faster...
QStringList mimeFilters() const
Returns the list of MIME type based filters, as set via setMimeFilter().
void clearDir(const QUrl &dirUrl)
Signals to the view to clear all items from directory dirUrl.
void setAutoUpdate(bool enable)
Toggle automatic directory updating, when a directory changes (using KDirWatch).
void refreshItems(const QList< QPair< KFileItem, KFileItem > > &items)
Signal an item to refresh (its MIME-type/icon/name has changed).
void redirection(const QUrl &oldUrl, const QUrl &newUrl)
Signals a redirection.
void setMimeFilter(const QStringList &mimeList)
Set MIME type based filter to only list items matching the given MIME types.
KFileItem findByName(const QString &name) const
Find an item by its name.
void itemsDeleted(const KFileItemList &items)
Signal that items have been deleted.
void setDirOnlyMode(bool dirsOnly)
Call this to list only directories (by default all items (directories and files) are listed).
KCoreDirLister(QObject *parent=nullptr)
Create a directory lister.
@ Reload
Indicates whether to use the cache or to reread the directory from the disk.
@ Keep
Previous directories aren't forgotten.
@ NoFlags
No additional flags specified.
void setQuickFilterMode(bool quickFilterMode)
Call this to set the quick filtering mode on, which will filter through all the items based by their ...
KFileItem rootItem() const
Returns the file item of the URL.
void listingDirCanceled(const QUrl &dirUrl)
Tell the view that the listing of the directory dirUrl was canceled.
bool isFinished() const
Returns true if no I/O operation is currently in progress.
void infoMessage(const QString &msg)
Emitted to display information about running jobs.
void canceled()
Tell the view that the user canceled the listing.
void newItems(const KFileItemList &items)
Signal new items.
void completed()
Tell the view that listing is finished.
void clearMimeFilter()
Clears the MIME type based filter.
void setAutoErrorHandlingEnabled(bool enable)
Enable or disable auto error handling.
void itemsAdded(const QUrl &directoryUrl, const KFileItemList &items)
Signal that new items were found during directory listing.
bool quickFilterMode() const
Returns true if quickfiltering is enabled.
void processedSize(KIO::filesize_t size)
Regularly emitted to show the progress of this KCoreDirLister.
List of KFileItems, which adds a few helper methods to QList<KFileItem>.
Definition kfileitem.h:632
A KFileItem is a generic class to handle a file, local or remote.
Definition kfileitem.h:36
The base class for all jobs.
Definition job_base.h:45
A ListJob is allows you to get the get the content of a directory.
Definition listjob.h:28
void stop(Ekos::AlignState mode)
A namespace for KIO globals.
qulonglong filesize_t
64-bit file size
Definition global.h:35
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 12:02:23 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.