kio Library API Documentation

kfilefilter.h

00001 /* This file is part of the KDE libraries
00002 
00003    Copyright (c) 2001,2002 Carsten Pfeiffer <pfeiffer@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License (LGPL) as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef KFILEFILTER_H
00022 #define KFILEFILTER_H
00023 
00024 #include <qptrlist.h>
00025 #include <qstringlist.h>
00026 
00027 #include <sys/types.h>
00028 #include <sys/stat.h>
00029 #include <unistd.h>
00030 
00031 class QRegExp;
00032 class KFileItem;
00033 
00034 class KFileFilter
00035 {
00036 public:
00037     virtual bool passesFilter( const KFileItem *item ) const = 0;
00038 protected:
00039     virtual void virtual_hook( int id, void* data );
00040 };
00041 
00042 
00043 class KSimpleFileFilter : public KFileFilter
00044 {
00045 public:
00046     KSimpleFileFilter();
00047     virtual ~KSimpleFileFilter();
00048 
00049     virtual void setFilterDotFiles( bool filter );
00050     bool filterDotFiles() const { return m_filterDotFiles; }
00051 
00055     virtual void setFilterSpecials( bool filter );
00056     bool filterSpecials() const { return m_filterSpecials; }
00057 
00058     // ### KDE4 make virtual and bool caseSensitive = false
00060     void setNameFilters( const QString& nameFilters, bool caseSensitive,
00061                          const QChar& separator = ' ' );
00062     virtual void setNameFilters( const QString& nameFilters );
00063     QString nameFilters() const;
00064 
00065     virtual void setMimeFilters( const QStringList& mimeFilters );
00066     QStringList mimeFilters() const { return m_mimeFilters; }
00067 
00068     virtual void setModeFilter( mode_t mode );
00069     mode_t modeFilter() const { return m_modeFilter; }
00070 
00071     virtual bool passesFilter( const KFileItem *item ) const;
00072 
00073 protected:
00074     QPtrList<QRegExp>   m_nameFilters;
00075 
00076 private:
00077     QStringList         m_mimeFilters;
00078     bool                m_filterDotFiles :1;
00079     bool                m_filterSpecials :1;
00080     mode_t              m_modeFilter;
00081 protected:
00082     virtual void virtual_hook( int id, void* data );
00083 private:
00084     class KSimpleFileFilterPrivate* d;
00085 };
00086 
00087 #endif // KFILEFILTER_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:30 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001