KFileFilter

Search for usage in LXR

#include <KFileFilter>

Public Member Functions

 KFileFilter ()
 
 KFileFilter (const KFileFilter &other)
 
 KFileFilter (const QString &label, const QStringList &filePatterns, const QStringList &mimePatterns)
 
QStringList filePatterns () const
 
bool isEmpty () const
 
bool isValid () const
 
QString label () const
 
QStringList mimePatterns () const
 
KFileFilteroperator= (const KFileFilter &other)
 
bool operator== (const KFileFilter &other) const
 
QString toFilterString () const
 

Static Public Member Functions

static KFileFilter fromMimeType (const QString &mimeType)
 
static QList< KFileFilterfromMimeTypes (const QStringList &mimeTypes)
 

Detailed Description

Encapsulates rules to filter a list of files.

Files can be filtered based on name patterns (e.g. *.cpp), MIME types, or both. Filters also optionally have a user-facing label.

Since
5.101

Definition at line 28 of file kfilefilter.h.

Constructor & Destructor Documentation

◆ KFileFilter() [1/3]

KFileFilter::KFileFilter ( )
explicit

Creates an empty filter.

Definition at line 91 of file kfilefilter.cpp.

◆ KFileFilter() [2/3]

KFileFilter::KFileFilter ( const QString & label,
const QStringList & filePatterns,
const QStringList & mimePatterns )
explicit

Creates a filter with a given label, name patterns, and MIME types.

Parameters
labelThe user-facing label for this filter.
filePatternsA list of file name patterns that should be included, e.g. ("*.cpp", "*.cxx").
mimePatternsA list of MIME types that should be included, e.g. ("text/plain", "image/png").

Definition at line 96 of file kfilefilter.cpp.

◆ KFileFilter() [3/3]

KFileFilter::KFileFilter ( const KFileFilter & other)

Definition at line 106 of file kfilefilter.cpp.

Member Function Documentation

◆ filePatterns()

QStringList KFileFilter::filePatterns ( ) const

List of file name patterns that are included by this filter.

Definition at line 125 of file kfilefilter.cpp.

◆ fromMimeType()

KFileFilter KFileFilter::fromMimeType ( const QString & mimeType)
static

Definition at line 175 of file kfilefilter.cpp.

◆ fromMimeTypes()

QList< KFileFilter > KFileFilter::fromMimeTypes ( const QStringList & mimeTypes)
static

Creates filters from a list of MIME types.

The user-facing label is automatically determined from the MIME type.

Since
6.0

Definition at line 200 of file kfilefilter.cpp.

◆ isEmpty()

bool KFileFilter::isEmpty ( ) const

Whether the filer is empty, i.e. matches all files.

Definition at line 140 of file kfilefilter.cpp.

◆ isValid()

bool KFileFilter::isValid ( ) const

Whether the filter is valid.

Creating a filter from an invalid/unkown MIME type will result in an invalid filter.

Since
6.0

Definition at line 145 of file kfilefilter.cpp.

◆ label()

QString KFileFilter::label ( ) const

The user-facing label for this filter.

If no label is passed on creation one is created based on the patterns.

Definition at line 120 of file kfilefilter.cpp.

◆ mimePatterns()

QStringList KFileFilter::mimePatterns ( ) const

List of MIME types that are included by this filter;.

Definition at line 130 of file kfilefilter.cpp.

◆ operator=()

KFileFilter & KFileFilter::operator= ( const KFileFilter & other)

Definition at line 111 of file kfilefilter.cpp.

◆ operator==()

bool KFileFilter::operator== ( const KFileFilter & other) const

Checks whether two filters are equal.

Filters are considered equal if their file and name patters match. The label is ignored here.

Definition at line 135 of file kfilefilter.cpp.

◆ toFilterString()

QString KFileFilter::toFilterString ( ) const

Converts this filter to a string representation.

Definition at line 150 of file kfilefilter.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.