org.kde.koala
public class KDirLister extends QObject
UNKNOWN: Helper class for the kiojob used to list and update a directory.
Field Summary | |
---|---|
static int | AllItems
Used by items() and itemsForDir() to specify whether you want
all items for a directory or just the filtered ones. |
static int | DIR_ONLY_MODE |
static int | DOT_FILES |
static int | FilteredItems |
static int | MIME_FILTER |
static int | NAME_FILTER |
static int | NONE |
Constructor Summary | |
---|---|
protected | KDirLister(Class dummy) |
KDirLister(boolean _delayedMimeTypes)
Create a directory lister. | |
KDirLister() |
Method Summary | |
---|---|
boolean | autoErrorHandlingEnabled()
Check whether auto error handling is enabled.
|
boolean | autoUpdate()
Checks whether KDirWatch will automatically update directories. |
String | className() |
void | clearMimeFilter()
Clears the mime based filter. |
ArrayList | directories()
Returns all URLs that are listed by this KDirLister. |
boolean | dirOnlyMode()
Checks whether the KDirLister only lists directories or all
files.
|
void | dispose() Delete the wrapped C++ instance ahead of finalize() |
protected boolean | doMimeExcludeFilter(String mimeExclude, String[] filters) |
protected boolean | doMimeFilter(String mime, String[] filters)
Called by the public matchesMimeFilter() to do the
actual filtering. |
void | emitChanges()
Actually emit the changes made with setShowingDotFiles, setDirOnlyMode,
setNameFilter and setMimeFilter. |
protected void | finalize() Deletes the wrapped C++ instance |
KFileItem | find(KURL _url) |
KFileItem | findByName(String name)
Find an item by its name. |
KFileItem | findByURL(KURL _url)
Find an item by its URL. |
protected void | handleError(Job arg1) Reimplement to customize error handling @short Reimplement to customize error handling |
boolean | isDisposed() Has the wrapped C++ instance been deleted? |
boolean | isFinished()
Returns true if no io operation is currently in progress. |
ArrayList | items(int which)
Returns the items listed for the current url().
|
ArrayList | items() |
ArrayList | itemsForDir(KURL dir, int which)
Returns the items listed for the given dir.
This method will NOT start listing dir , you should only call
this when receiving the finished() signal.
|
ArrayList | itemsForDir(KURL dir) |
QWidget | mainWindow()
Returns the main window associated with this object. |
boolean | matchesFilter(String name)
Checks whether name matches a filter in the list of name filters. |
protected boolean | matchesFilter(KFileItem arg1)
Called for every new item before emitting newItems().
|
boolean | matchesMimeFilter(String mime)
Checks whether mime matches a filter in the list of mime types |
protected boolean | matchesMimeFilter(KFileItem arg1)
Called for every new item before emitting newItems().
|
QMetaObject | metaObject() |
ArrayList | mimeFilters()
Returns the list of mime based filters, as set via setMimeFilter(). |
String | nameFilter()
Returns the current name filter, as set via setNameFilter() |
boolean | openURL(KURL _url, boolean _keep, boolean _reload)
Run the directory lister on the given url.
|
boolean | openURL(KURL _url, boolean _keep) |
boolean | openURL(KURL _url) |
KFileItem | rootItem()
Returns the file item of the URL. |
void | setAutoErrorHandlingEnabled(boolean enable, QWidget parent)
Enable or disable auto error handling is enabled.
|
void | setAutoUpdate(boolean enable)
Enable/disable automatic directory updating, when a directory changes
(using KDirWatch). |
void | setDirOnlyMode(boolean dirsOnly)
Call this to list only directories.
|
void | setMainWindow(QWidget window)
Pass the main window this object is associated with
this is used for caching authentication data |
void | setMimeExcludeFilter(String[] mimeList)
Filtering should be done with KFileFilter. |
void | setMimeFilter(String[] mimeList)
Set mime-based filter to only list items matching the given mimetypes.
|
void | setNameFilter(String filter)
Set a name filter to only list items matching this name, e.g. |
void | setShowingDotFiles(boolean _showDotFiles)
Changes the "is viewing dot files" setting.
|
boolean | showingDotFiles()
Checks whether hidden files (files beginning with a dot) will be
shown.
|
void | stop()
Stop listing all directories currently being listed.
|
void | stop(KURL _url)
Stop listing the given directory.
|
void | updateDirectory(KURL _dir)
Update the directory _dir. This method causes KDirLister to _only_ emit
the items of _dir that actually changed compared to the current state in the
cache and updates the cache.
|
KURL | url()
Returns the top level URL that is listed by this KDirLister.
|
protected boolean | validURL(KURL arg1)
Checks if an url is malformed or not and displays an error message
if it is and autoErrorHandling is set to true. |
UNKNOWN: Used by items() and itemsForDir() to specify whether you want all items for a directory or just the filtered ones.
Parameters: _delayedMimeTypes if true, mime types will be fetched on demand. If false, they will always be fetched immediately
UNKNOWN: Create a directory lister.
Returns: true if auto error handling is enabled, false otherwise
See Also: KDirLister
UNKNOWN: Check whether auto error handling is enabled.
Returns: true if KDirWatch is used to automatically update directories.
UNKNOWN: Checks whether KDirWatch will automatically update directories.
See Also: KDirLister
UNKNOWN: Clears the mime based filter.
_keep
== true, as it happens in a
treeview, for example. (Note that the base url is included in the list
as well, of course.)Returns: the list of all listed URLs
UNKNOWN: Returns all URLs that are listed by this KDirLister.
Returns: true if setDirOnlyMode(true) was called
UNKNOWN: Checks whether the KDirLister only lists directories or all files.
UNKNOWN:
Parameters: mime the mime type to filter filters the list of mime types to filter
UNKNOWN: Called by the public matchesMimeFilter() to do the actual filtering.
UNKNOWN: Actually emit the changes made with setShowingDotFiles, setDirOnlyMode, setNameFilter and setMimeFilter.
Parameters: name the item name
Returns: the pointer to the KFileItem
UNKNOWN: Find an item by its name.
Parameters: _url the item URL
Returns: the pointer to the KFileItem
UNKNOWN: Find an item by its URL.
Returns: true if finished, false otherwise
UNKNOWN: Returns true if no io operation is currently in progress.
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().
UNKNOWN: Returns the items listed for the current url().
dir.
This method will NOT start listing dir
, 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.Parameters: dir specifies the url for which the items should be returned. This is only useful if you use KDirLister with multiple URLs i.e. using boolean keep = true 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 dir.
UNKNOWN: Returns the items listed for the given dir.
Returns: the associated main window, or 0 if there is none
UNKNOWN: Returns the main window associated with this object.
name
matches a filter in the list of name filters.Returns: true if name
matches a filter in the list,
otherwise false.
See Also: KDirLister
UNKNOWN: Checks whether name
matches a filter in the list of name filters.
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: KDirLister KDirLister
UNKNOWN: Called for every new item before emitting newItems().
mime
matches a filter in the list of mime typesParameters: mime the mimetype to find in the filter list.
Returns: true if name
matches a filter in the list,
otherwise false.
See Also: #
UNKNOWN: Checks whether mime
matches a filter in the list of mime types
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: KDirLister KDirLister
UNKNOWN: Called for every new item before emitting newItems().
Returns: the list of mime based filters. Empty, when no mime filter is set.
UNKNOWN: Returns the list of mime based filters, as set via setMimeFilter().
Returns: the current name filter, can be null if filtering is turned off
UNKNOWN: Returns the current name filter, as set via setNameFilter()
_url
, in any case.
Depending on _keep
either clear() or clear(KURL) 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: _url the directory URL. _keep if true the previous directories aren't forgotten (they are still watched by kdirwatch and their items are kept for this KDirLister). This is useful for e.g. a treeview. _reload indicates wether to use the cache (false) 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.
Returns: true if successful,
false otherwise (e.g. invalid _url
)
UNKNOWN: Run the directory lister on the given url.
Returns: the file item for url() itself (".")
UNKNOWN: Returns the file item of the URL.
Parameters: enable true to enable auto error handling, false to disable parent the parent widget for the error dialogs, can be 0 for top-level
See Also: KDirLister
UNKNOWN: Enable or disable auto error handling is enabled.
Parameters: enable true to enable, false to disable
UNKNOWN: Enable/disable automatic directory updating, when a directory changes (using KDirWatch).
Parameters: dirsOnly true to list only directories
UNKNOWN: Call this to list only directories.
Parameters: window the window to associate with, 0 to disassociate
UNKNOWN: Pass the main window this object is associated with this is used for caching authentication data
Parameters: mimeList a list of mime-types.
See Also: KDirLister KDirLister
UNKNOWN: Filtering should be done with KFileFilter.
Parameters: mimeList a list of mime-types.
See Also: KDirLister KDirLister
UNKNOWN: Set mime-based filter to only list items matching the given mimetypes.
Parameters: filter the new filter, null to disable filtering
See Also: KDirLister
UNKNOWN: Set a name filter to only list items matching this name, e.
Parameters: _showDotFiles true to enable showing hidden files, false to disable
See Also: KDirLister
UNKNOWN: Changes the "is viewing dot files" setting.
Returns: true if dot files are shown, false otherwise
See Also: KDirLister
UNKNOWN: Checks whether hidden files (files beginning with a dot) will be shown.
UNKNOWN: Stop listing all directories currently being listed.
_url.
Parameters: _url the directory URL
UNKNOWN: Stop listing the given directory.
_dir.
This method causes KDirLister to _only_ emit
the items of _dir
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: _dir the directory URL
UNKNOWN: Update the directory _dir.
_keep
== true 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.
UNKNOWN: Returns the top level URL that is listed by this KDirLister.
Returns: true if url is valid, otherwise false.
UNKNOWN: Checks if an url is malformed or not and displays an error message if it is and autoErrorHandling is set to true.