kio Library API Documentation

KSimpleFileFilter Class Reference

A simple file filter that can filter hidden dot files, by name, by mime type and by mode.A simple file filter. More...

#include <kfilefilter.h>

Inheritance diagram for KSimpleFileFilter:

Inheritance graph
[legend]
Collaboration diagram for KSimpleFileFilter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KSimpleFileFilter ()
virtual ~KSimpleFileFilter ()
virtual void setFilterDotFiles (bool filter)
bool filterDotFiles () const
virtual void setFilterSpecials (bool filter)
bool filterSpecials () const
void setNameFilters (const QString &nameFilters, bool caseSensitive, const QChar &separator= ' ')
virtual void setNameFilters (const QString &nameFilters)
virtual void setMimeFilters (const QStringList &mimeFilters)
QStringList mimeFilters () const
virtual void setModeFilter (mode_t mode)
mode_t modeFilter () const
virtual bool passesFilter (const KFileItem *item) const

Protected Member Functions

virtual void virtual_hook (int id, void *data)

Protected Attributes

QPtrList< QRegExpm_nameFilters

Detailed Description

A simple file filter that can filter hidden dot files, by name, by mime type and by mode.A simple file filter.

Definition at line 59 of file kfilefilter.h.


Constructor & Destructor Documentation

KSimpleFileFilter::KSimpleFileFilter  ) 
 

Creates a new filter.

By default, it filters only hidden dot files and "." and "..".

Definition at line 28 of file kfilefilter.cpp.

References m_nameFilters, and QPtrList::setAutoDelete().


Member Function Documentation

void KSimpleFileFilter::setFilterDotFiles bool  filter  )  [virtual]
 

Enable or disable filtering hidden dot files.

This option is enabled by default.

Parameters:
filter true to enable filtering dot files, false to disable
See also:
filterDotFiles

Definition at line 40 of file kfilefilter.cpp.

bool KSimpleFileFilter::filterDotFiles  )  const [inline]
 

Checks whether filtering dot files is enabled.

This option is enabled by default.

Returns:
true if filtering is enabled, false otherwise
See also:
setFilterDotFiles

Definition at line 83 of file kfilefilter.h.

void KSimpleFileFilter::setFilterSpecials bool  filter  )  [virtual]
 

Filters "." and "..", default is true.

Parameters:
filter true to enable, false otherwise

Definition at line 45 of file kfilefilter.cpp.

bool KSimpleFileFilter::filterSpecials  )  const [inline]
 

Checks whether it filters "." and "..", default is true.

Returns:
true if enabled, false otherwise

Definition at line 94 of file kfilefilter.h.

void KSimpleFileFilter::setNameFilters const QString nameFilters,
bool  caseSensitive,
const QChar separator = ' '
 

Sets a list of regular expressions to filter by name.

The file will only pass if its name matches one of the regular expressions.

Parameters:
nameFilters a list of regular expressions, separated by the character separator
caseSensitive if true, matches case sensitive. False otherwise
separator the separator in the nameFilter
Since:
3.1

Definition at line 56 of file kfilefilter.cpp.

References QPtrList::append(), QPtrList::clear(), m_nameFilters, and QStringList::split().

Referenced by setNameFilters().

void KSimpleFileFilter::setNameFilters const QString nameFilters  )  [virtual]
 

Sets a list of regular expressions to filter by name.

The file will only pass if its name matches one of the regular expressions.

Parameters:
nameFilters a list of regular expressions, separated by space (' ')

Definition at line 50 of file kfilefilter.cpp.

References setNameFilters().

void KSimpleFileFilter::setMimeFilters const QStringList mimeFilters  )  [virtual]
 

Sets a list of mime filters.

A file can only pass if its mime type is contained in this list.

Parameters:
mimeFilters the list of mime types
See also:
setMimeFilter

Definition at line 70 of file kfilefilter.cpp.

QStringList KSimpleFileFilter::mimeFilters  )  const [inline]
 

Returns the list of mime types.

Returns:
the list of mime types
See also:
mimeFilter

Definition at line 131 of file kfilefilter.h.

void KSimpleFileFilter::setModeFilter mode_t  mode  )  [virtual]
 

Sets the mode filter.

If the mode is 0, the filter is disabled. When enabled, a file will only pass if the files mode ANDed with mode is not zero.

Parameters:
mode the new mode. 0 to disable
See also:
modeFilter

Definition at line 75 of file kfilefilter.cpp.

mode_t KSimpleFileFilter::modeFilter  )  const [inline]
 

Returns the mode filter, as set by setModeFilter().

Returns:
the mode filter, 0 if disabled
See also:
setModeFilter

Definition at line 147 of file kfilefilter.h.

bool KSimpleFileFilter::passesFilter const KFileItem item  )  const [virtual]
 

Checks the given item.

Parameters:
item the item to filter
Returns:
true if the item passes the filter, false otherwise

Implements KFileFilter.

Definition at line 80 of file kfilefilter.cpp.

References QString::at(), QPtrListIterator::current(), QPtrList::isEmpty(), m_nameFilters, KFileItem::mimeTypePtr(), KFileItem::mode(), KFileItem::name(), and KGlobal::staticQString().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kio Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 16 06:59:12 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003