fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / kded / kbuildservicefactory.h
blob20beb965b9ae9536894d7fb5166f14c8da202d9c
1 /* This file is part of the KDE project
2 Copyright (C) 1999, 2007 David Faure <faure@kde.org>
3 1999 Waldo Bastian <bastian@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
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 KDED_KBUILD_SERVICE_FACTORY_H
22 #define KDED_KBUILD_SERVICE_FACTORY_H
24 #include <QtCore/QStringList>
26 #include "kmimeassociations.h"
27 #include <kmimetype.h>
28 #include <kservicefactory.h>
29 // We export the services to the service group factory!
30 class KBuildServiceGroupFactory;
31 class KBuildMimeTypeFactory;
33 /**
34 * Service factory for building ksycoca
35 * @internal
37 class KBuildServiceFactory : public KServiceFactory
39 public:
40 /**
41 * Create factory
43 KBuildServiceFactory( KSycocaFactory *serviceTypeFactory,
44 KBuildMimeTypeFactory *mimeTypeFactory,
45 KBuildServiceGroupFactory *serviceGroupFactory );
47 virtual ~KBuildServiceFactory();
49 /// Reimplemented from KServiceFactory
50 virtual KService::Ptr findServiceByDesktopName(const QString &name);
51 /// Reimplemented from KServiceFactory
52 virtual KService::Ptr findServiceByDesktopPath(const QString &name);
53 /// Reimplemented from KServiceFactory
54 virtual KService::Ptr findServiceByMenuId(const QString &menuId);
56 /**
57 * Construct a KService from a config file.
59 virtual KSycocaEntry * createEntry(const QString &file, const char *resource) const;
61 virtual KService * createEntry( int ) const { assert(0); return 0; }
63 /**
64 * Add a new entry.
66 virtual void addEntry(const KSycocaEntry::Ptr& newEntry);
68 /**
69 * Write out service specific index files.
71 virtual void save(QDataStream &str);
73 /**
74 * Write out header information
76 * Don't forget to call the parent first when you override
77 * this function.
79 virtual void saveHeader(QDataStream &str);
81 /**
82 * Returns all resource types for this service factory
84 static QStringList resourceTypes();
86 void postProcessServices();
88 private:
89 void populateServiceTypes();
90 void saveOfferList(QDataStream &str);
91 void collectInheritedServices();
92 void collectInheritedServices(KMimeType::Ptr mime, QSet<KMimeType::Ptr>& visitedMimes);
94 QHash<QString, KService::Ptr> m_nameMemoryHash; // m_nameDict is not useable while building ksycoca
95 QHash<QString, KService::Ptr> m_relNameMemoryHash; // m_relNameDict is not useable while building ksycoca
96 QHash<QString, KService::Ptr> m_menuIdMemoryHash; // m_menuIdDict is not useable while building ksycoca
97 QSet<KSycocaEntry::Ptr> m_dupeDict;
99 KOfferHash m_offerHash;
101 KSycocaFactory *m_serviceTypeFactory;
102 KBuildMimeTypeFactory *m_mimeTypeFactory;
103 KBuildServiceGroupFactory *m_serviceGroupFactory;
106 #endif