1/* This file is part of the KDE project
2 Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
3 Copyright (C) 2003 David Faure <faure@kde.org>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License version 2 or at your option version 3 as published by
8 the Free Software Foundation.
9
10 This program 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 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef TYPESLISTITEM_H
22#define TYPESLISTITEM_H
23
24#include "mimetypedata.h"
25#include <QTreeWidgetItem>
26
27#include <kmimetype.h>
28
29// TODO different subclasses for mimetypes and groups?
30class TypesListItem : public QTreeWidgetItem
31{
32public:
33 /**
34 * Create a filetype group
35 */
36 TypesListItem(QTreeWidget *parent, const QString &major);
37
38 /**
39 * Create a filetype item inside a group, for an existing mimetype
40 */
41 TypesListItem(TypesListItem *parent, KMimeType::Ptr mimetype);
42
43 /**
44 * Create a filetype item inside a group, for a new mimetype
45 */
46 TypesListItem(TypesListItem *parent, const QString& newMimetype);
47
48 ~TypesListItem();
49
50 void setIcon( const QString& icon );
51
52 QString name() const { return m_mimetypeData.name(); }
53 const MimeTypeData& mimeTypeData() const { return m_mimetypeData; }
54 MimeTypeData& mimeTypeData() { return m_mimetypeData; }
55
56 void loadIcon(bool forceReload = false);
57
58private:
59 MimeTypeData m_mimetypeData;
60};
61
62#endif
63