1/* This file is part of the KDE project
2 Copyright 1999-2007 David Faure <faure@kde.org>
3
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.
8
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.
13
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.
18*/
19
20#ifndef KDED_KBUILD_MIME_TYPE_FACTORY_H
21#define KDED_KBUILD_MIME_TYPE_FACTORY_H
22
23#include <kmimetypefactory.h>
24#include <QtCore/QStringList>
25#include <kmimeglobsfileparser_p.h>
26#include <kmimetype.h>
27
28/**
29 * Mime-type factory for building ksycoca
30 * @internal
31 */
32class KBuildMimeTypeFactory : public KMimeTypeFactory
33{
34public:
35 /**
36 * Create factory
37 */
38 KBuildMimeTypeFactory();
39
40 virtual ~KBuildMimeTypeFactory();
41
42 /**
43 * Find a mime type entry in the database file
44 * @return a pointer to the mimetype in the memory dict (don't free!)
45 */
46 MimeTypeEntry::Ptr findMimeTypeEntryByName(const QString &_name, KMimeType::FindByNameOption options = KMimeType::DontResolveAlias);
47
48 virtual KSycocaEntry::List allEntries() const;
49
50 /**
51 * Construct a KMimeType from a config file.
52 */
53 virtual KSycocaEntry * createEntry(const QString &file, const char *resource) const;
54
55 virtual MimeTypeEntry * createEntry( int ) const { assert(0); return 0L; }
56
57 void createFakeMimeType(const QString& name);
58
59 /**
60 * Write out mime type specific index files.
61 */
62 virtual void save(QDataStream &str);
63
64 /**
65 * Write out header information
66 *
67 * Don't forget to call the parent first when you override
68 * this function.
69 */
70 virtual void saveHeader(QDataStream &str);
71
72 /**
73 * Returns all resource types for this factory
74 */
75 static QStringList resourceTypes();
76};
77
78#endif
79