1 /* This file is part of the KDE libraries
2 Copyright (C) Stephan Kulow <coolo@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef KFILEFILTERCOMBO_H
21 #define KFILEFILTERCOMBO_H
23 #include <kfile_export.h>
25 #include <QtCore/QStringList>
27 #include <kcombobox.h>
29 class KFILE_EXPORT KFileFilterCombo
: public KComboBox
35 * Creates a new filter combo box.
37 * @param parent The parent widget.
39 KFileFilterCombo(QWidget
*parent
=0);
42 * Destroys the filter combo box.
47 * Sets the @p filter string.
49 void setFilter(const QString
& filter
);
52 * @returns the current filter, either something like "*.cpp *.h"
53 * or the current mimetype, like "text/html", or a list of those, like
54 " "text/html text/plain image/png", all separated with one space.
56 QString
currentFilter() const;
59 * Sets the current filter. Filter must match one of the filter items
60 * passed before to this widget.
62 void setCurrentFilter( const QString
& filter
);
65 * Sets a list of mimetypes.
66 * If @p defaultType is set, it will be set as the current item.
67 * Otherwise, a first item showing all the mimetypes will be created.
69 void setMimeFilter( const QStringList
& types
, const QString
& defaultType
);
72 * @return true if the filter's first item is the list of all mimetypes
74 bool showsAllTypes() const;
77 * This method allows you to set a default-filter, that is used when an
78 * empty filter is set. Make sure you call this before calling
81 * By default, this is set to i18n("*|All Files")
84 void setDefaultFilter( const QString
& filter
);
87 * @return the default filter, used when an empty filter is set.
88 * @see setDefaultFilter
90 QString
defaultFilter() const;
93 * @return all filters (this can be a list of patterns or a list of mimetypes)
95 QStringList
filters() const;
98 virtual bool eventFilter( QObject
*, QEvent
* );
102 * This signal is emitted whenever the filter has been changed.
104 void filterChanged();
110 Q_PRIVATE_SLOT( d
, void _k_slotFilterChanged() )