KDirLister Class Reference
#include <kdirlister.h>
Inheritance diagram for KDirLister:

Detailed Description
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.Helper class for the kiojob used to list and update a directory.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, newItem, and deleteItem.
- 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).
- Author:
- Michael Brade <brade@kde.org>
Definition at line 55 of file kdirlister.h.
Public Types | |
enum | WhichItems { AllItems = 0, FilteredItems = 1 } |
Signals | |
void | started (const KURL &_url) |
void | completed () |
void | completed (const KURL &_url) |
void | canceled () |
void | canceled (const KURL &_url) |
void | redirection (const KURL &_url) |
void | redirection (const KURL &oldUrl, const KURL &newUrl) |
void | clear () |
void | clear (const KURL &_url) |
void | newItems (const KFileItemList &items) |
void | itemsFilteredByMime (const KFileItemList &items) |
void | deleteItem (KFileItem *_fileItem) |
void | refreshItems (const KFileItemList &items) |
void | infoMessage (const QString &msg) |
void | percent (int percent) |
void | totalSize (KIO::filesize_t size) |
void | processedSize (KIO::filesize_t size) |
void | speed (int bytes_per_second) |
Public Member Functions | |
KDirLister (bool _delayedMimeTypes=false) | |
virtual | ~KDirLister () |
virtual bool | openURL (const KURL &_url, bool _keep=false, bool _reload=false) |
virtual void | stop () |
virtual void | stop (const KURL &_url) |
bool | autoUpdate () const |
virtual void | setAutoUpdate (bool enable) |
bool | autoErrorHandlingEnabled () const |
void | setAutoErrorHandlingEnabled (bool enable, QWidget *parent) |
bool | showingDotFiles () const |
virtual void | setShowingDotFiles (bool _showDotFiles) |
bool | dirOnlyMode () const |
virtual void | setDirOnlyMode (bool dirsOnly) |
const KURL & | url () const |
const KURL::List & | directories () const |
virtual void | emitChanges () |
virtual void | updateDirectory (const KURL &_dir) |
bool | isFinished () const |
KFileItem * | rootItem () const |
virtual KFileItem * | findByURL (const KURL &_url) const |
KFileItem * | find (const KURL &_url) const |
virtual KFileItem * | findByName (const QString &name) const |
virtual void | setNameFilter (const QString &filter) |
const QString & | nameFilter () const |
virtual void | setMimeFilter (const QStringList &mimeList) |
void | setMimeExcludeFilter (const QStringList &mimeList) |
virtual void | clearMimeFilter () |
const QStringList & | mimeFilters () const |
bool | matchesFilter (const QString &name) const |
bool | matchesMimeFilter (const QString &mime) const |
void | setMainWindow (QWidget *window) |
QWidget * | mainWindow () |
KFileItemList | items (WhichItems which=FilteredItems) const |
KFileItemList | itemsForDir (const KURL &dir, WhichItems which=FilteredItems) const |
Protected Types | |
enum | Changes { NONE = 0, NAME_FILTER = 1, MIME_FILTER = 2, DOT_FILES = 4, DIR_ONLY_MODE = 8 } |
Protected Member Functions | |
virtual bool | matchesFilter (const KFileItem *) const |
virtual bool | matchesMimeFilter (const KFileItem *) const |
virtual bool | doNameFilter (const QString &name, const QPtrList< QRegExp > &filters) const |
virtual bool | doMimeFilter (const QString &mime, const QStringList &filters) const |
bool | doMimeExcludeFilter (const QString &mimeExclude, const QStringList &filters) const |
virtual bool | validURL (const KURL &) const |
virtual void | handleError (KIO::Job *) |
virtual void | virtual_hook (int id, void *data) |
Properties | |
bool | autoUpdate |
bool | showingDotFiles |
bool | dirOnlyMode |
bool | autoErrorHandlingEnabled |
QString | nameFilter |
QStringList | mimeFilter |
Friends | |
class | KDirListerPrivate |
class | KDirListerCache |
Member Enumeration Documentation
|
Used by items() and itemsForDir() to specify whether you want all items for a directory or just the filtered ones.
Definition at line 363 of file kdirlister.h. |
Constructor & Destructor Documentation
|
Create a directory lister.
Definition at line 1786 of file kdirlister.cpp. |
|
Destroy the directory lister.
Definition at line 1802 of file kdirlister.cpp. |
Member Function Documentation
|
Check whether auto error handling is enabled. If enabled, it will show an error dialog to the user when an error occurs. It is turned on by default.
|
|
Checks whether KDirWatch will automatically update directories. This is enabled by default.
|
|
Tell the view that the listing of the directory There might be other running jobs left. This signal is only emitted if KDirLister is watching more than one directory.
|
|
Tell the view that the user canceled the listing. No running jobs are left. |
|
Signal to empty the directory It is only emitted if the lister is holding more than one directory.
|
|
Signal to clear all items. It must always be connected to this signal to avoid doubled items! |
|
Clears the mime based filter.
Definition at line 2084 of file kdirlister.cpp. |
|
Tell the view that the listing of the directory There might be other running jobs left. This signal is only emitted if KDirLister is watching more than one directory.
|
|
Tell the view that listing is finished. There are no jobs running anymore. |
|
Signal an item to remove.
ATTENTION: if
|
|
Returns all URLs that are listed by this KDirLister.
This is only useful if you called openURL() with
Definition at line 1905 of file kdirlister.cpp. |
|
Checks whether the KDirLister only lists directories or all files. By default this option is disabled (all files will be shown).
|
|
Called by the public matchesMimeFilter() to do the actual filtering. Those methods may be reimplemented to customize filtering.
Definition at line 2148 of file kdirlister.cpp. |
|
Called by the public matchesFilter() to do the actual filtering. Those methods may be reimplemented to customize filtering.
Definition at line 2139 of file kdirlister.cpp. |
|
Actually emit the changes made with setShowingDotFiles, setDirOnlyMode, setNameFilter and setMimeFilter.
Definition at line 1910 of file kdirlister.cpp. |
|
Find an item by its name.
Definition at line 2019 of file kdirlister.cpp. |
|
Find an item by its URL.
Definition at line 2014 of file kdirlister.cpp. |
|
Reimplement to customize error handling.
Definition at line 2196 of file kdirlister.cpp. |
|
Emitted to display information about running jobs. Examples of message are "Resolving host", "Connecting to host...", etc.
|
|
Returns true if no io operation is currently in progress.
Definition at line 2004 of file kdirlister.cpp. |
|
Returns the items listed for the current url(). This method will NOT start listing a directory, you should only call this when receiving the finished() signal. The items in the KFileItemList are references to the items used by KDirLister, so e.g. an item gets destroyed when the deleteItem() signal is emitted.
Definition at line 2449 of file kdirlister.cpp. |
|
Send a list of items filtered-out by mime-type.
|
|
Returns the items listed for the given
This method will NOT start listing The items in the KFileItemList are references to the items used by KDirLister, so e.g. an item gets destroyed when the deleteItem() signal is emitted.
Definition at line 2454 of file kdirlister.cpp. |
|
Returns the main window associated with this object.
Definition at line 2444 of file kdirlister.cpp. |
|
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)
Definition at line 2113 of file kdirlister.cpp. |
|
Checks whether
Definition at line 2101 of file kdirlister.cpp. |
|
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)
Definition at line 2130 of file kdirlister.cpp. |
|
Checks whether
Definition at line 2106 of file kdirlister.cpp. |
|
Returns the list of mime based filters, as set via setMimeFilter().
Definition at line 2096 of file kdirlister.cpp. |
|
Returns the current name filter, as set via setNameFilter().
|
|
Signal new items.
|
|
Run the directory lister on the given url.
This method causes KDirLister to emit _all_ the items of 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).
Definition at line 1816 of file kdirlister.cpp. |
|
Progress signal showing the overall progress of the KDirLister. This allows using a progress bar very easily. (see KProgress)
|
|
Regularly emitted to show the progress of this KDirLister.
|
|
Signal a redirection.
|
|
Signal a redirection.
Only emitted if there's just one directory to list, i.e. most probably openURL() has been called with
|
|
Signal an item to refresh (its mimetype/icon/name has changed). Note: KFileItem::refresh has already been called on those items.
|
|
Returns the file item of the URL.
Definition at line 2009 of file kdirlister.cpp. |
|
Enable or disable auto error handling is enabled. If enabled, it will show an error dialog to the user when an error occurs. It is turned on by default.
Definition at line 1894 of file kdirlister.cpp. |
|
Enable/disable automatic directory updating, when a directory changes (using KDirWatch).
Definition at line 1852 of file kdirlister.cpp. |
|
Call this to list only directories. By default this option is disabled (all files will be shown).
Definition at line 1880 of file kdirlister.cpp. |
|
Pass the main window this object is associated with this is used for caching authentication data.
Definition at line 2439 of file kdirlister.cpp. |
|
Filtering should be done with KFileFilter. This will be implemented in a later revision of KDirLister. This method may be removed then. Set mime-based exclude filter to only list items not matching the given mimetypes NOTE: setting the filter does not automatically reload direcory. Also calling this function will not affect any named filter already set.
Definition at line 2074 of file kdirlister.cpp. |
|
Set mime-based filter to only list items matching the given mimetypes. NOTE: setting the filter does not automatically reload direcory. Also calling this function will not affect any named filter already set.
Definition at line 2060 of file kdirlister.cpp. |
|
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 direcory is not automatically reloaded.
Definition at line 2034 of file kdirlister.cpp. |
|
Changes the "is viewing dot files" setting. Calls updateDirectory() if setting changed. By default this option is disabled (hidden files will not be shown).
Definition at line 1866 of file kdirlister.cpp. |
|
Checks whether hidden files (files beginning with a dot) will be shown. By default this option is disabled (hidden files will be not shown).
|
|
Emitted to display information about the speed of the jobs.
|
|
Tell the view that we started to list NOTE: this does _not_ imply that there is really a job running! I.e. KDirLister::jobs() may return an empty list. In this case the items are taken from the cache. The view knows that openURL should start it, so it might seem useless, but the view also needs to know when an automatic update happens.
|
|
Stop listing the given directory.
Emits canceled() if the killed job was the last running one. Emits canceled( const KURL& ) for the killed job if there are at least two directories being watched by KDirLister. No signal is emitted if there was no job running for
Definition at line 1841 of file kdirlister.cpp. |
|
Stop listing all directories currently being listed. Emits canceled() if there was at least one job running. Emits canceled( const KURL& ) for each stopped job if there are at least two dirctories being watched by KDirLister. Definition at line 1835 of file kdirlister.cpp. |
|
Emitted when we know the size of the jobs.
|
|
Update the directory
This method causes KDirLister to _only_ emit the items of 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.
Definition at line 1999 of file kdirlister.cpp. |
|
Returns the top level URL that is listed by this KDirLister.
It might be different from the one given with openURL() if there was a redirection. If you called openURL() with
Definition at line 1900 of file kdirlister.cpp. |
|
Checks if an url is malformed or not and displays an error message if it is and autoErrorHandling is set to true.
Definition at line 2179 of file kdirlister.cpp. |
The documentation for this class was generated from the following files: