KDED
kbuildservicefactory.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 1999, 2007 David Faure <faure@kde.org> 00003 1999 Waldo Bastian <bastian@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KDED_KBUILD_SERVICE_FACTORY_H 00022 #define KDED_KBUILD_SERVICE_FACTORY_H 00023 00024 #include <QtCore/QStringList> 00025 00026 #include "kmimeassociations.h" 00027 #include <kservicefactory.h> 00028 // We export the services to the service group factory! 00029 class KBuildServiceGroupFactory; 00030 class KBuildMimeTypeFactory; 00031 00036 class KBuildServiceFactory : public KServiceFactory 00037 { 00038 public: 00042 KBuildServiceFactory( KSycocaFactory *serviceTypeFactory, 00043 KBuildMimeTypeFactory *mimeTypeFactory, 00044 KBuildServiceGroupFactory *serviceGroupFactory ); 00045 00046 virtual ~KBuildServiceFactory(); 00047 00049 virtual KService::Ptr findServiceByDesktopName(const QString &name); 00051 virtual KService::Ptr findServiceByDesktopPath(const QString &name); 00053 virtual KService::Ptr findServiceByMenuId(const QString &menuId); 00054 00058 virtual KSycocaEntry * createEntry(const QString &file, const char *resource) const; 00059 00060 virtual KService * createEntry( int ) const { assert(0); return 0; } 00061 00065 virtual void addEntry(const KSycocaEntry::Ptr& newEntry); 00066 00070 virtual void save(QDataStream &str); 00071 00078 virtual void saveHeader(QDataStream &str); 00079 00083 static QStringList resourceTypes(); 00084 00085 void populateServiceTypes(); 00086 00087 private: 00088 void saveOfferList(QDataStream &str); 00089 void collectInheritedServices(); 00090 00091 QHash<QString, KService::Ptr> m_nameMemoryHash; // m_nameDict is not useable while building ksycoca 00092 QHash<QString, KService::Ptr> m_relNameMemoryHash; // m_relNameDict is not useable while building ksycoca 00093 QHash<QString, KService::Ptr> m_menuIdMemoryHash; // m_menuIdDict is not useable while building ksycoca 00094 QSet<KSycocaEntry::Ptr> m_dupeDict; 00095 00096 KOfferHash m_offerHash; 00097 00098 KSycocaFactory *m_serviceTypeFactory; 00099 KBuildMimeTypeFactory *m_mimeTypeFactory; 00100 KBuildServiceGroupFactory *m_serviceGroupFactory; 00101 }; 00102 00103 #endif