1 /* This file is part of the KDE libraries
2 Copyright (C) 2000, 2006 David Faure <faure@kde.org>
3 Copyright (C) 2000 Rik Hemsley <rik@kde.org>
4 Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef KMIMETYPERESOLVER_H
22 #define KMIMETYPERESOLVER_H
24 #include <QtCore/QObject>
25 #include <kio/kio_export.h>
27 class QAbstractItemView
;
28 class QAbstractProxyModel
;
30 class KMimeTypeResolverPrivate
;
31 class KAbstractViewAdapter
;
34 * This class implements the "delayed-mimetype-determination" feature,
35 * for directory views.
37 * It determines the mimetypes of the icons in the background, but giving
38 * preferrence to the visible icons.
41 class KIO_EXPORT KMimeTypeResolver
: public QObject
46 * The mimetype resolver is made a child of the view.
47 * It is OK to have one resolver per view, and have those views share a common model;
48 * this way the mimetypes will only be determined once per item in the model, which saves time.
50 * WARNING: if you call KDirModel::setDirLister, do it before creating the KMimeTypeResolver
51 * If this is a problem, tell me and I'll add a signal...
53 explicit KMimeTypeResolver(QAbstractItemView
* view
, KDirModel
* model
);
56 * This constructor should be used when the view uses a proxy model instead of a KDirModel.
57 * The source model must be a KDirModel however, and the above warning applies
58 * to this constructor as well.
60 explicit KMimeTypeResolver(QAbstractItemView
* view
, QAbstractProxyModel
* model
);
65 explicit KMimeTypeResolver(KAbstractViewAdapter
* adapter
);
70 KMimeTypeResolverPrivate
*const d
;
72 Q_PRIVATE_SLOT( d
, void _k_slotRowsInserted(const QModelIndex
&,int,int) )
73 Q_PRIVATE_SLOT( d
, void _k_slotViewportAdjusted() )
74 Q_PRIVATE_SLOT( d
, void _k_slotProcessMimeIcons() )
77 #endif /* KMIMETYPERESOLVER_H */