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 <kmimetype.h> 00028 #include <kservicefactory.h> 00029 // We export the services to the service group factory! 00030 class KBuildServiceGroupFactory; 00031 class KBuildMimeTypeFactory; 00032 00037 class KBuildServiceFactory : public KServiceFactory 00038 { 00039 public: 00043 KBuildServiceFactory( KSycocaFactory *serviceTypeFactory, 00044 KBuildMimeTypeFactory *mimeTypeFactory, 00045 KBuildServiceGroupFactory *serviceGroupFactory ); 00046 00047 virtual ~KBuildServiceFactory(); 00048 00050 virtual KService::Ptr findServiceByDesktopName(const QString &name); 00052 virtual KService::Ptr findServiceByDesktopPath(const QString &name); 00054 virtual KService::Ptr findServiceByMenuId(const QString &menuId); 00055 00059 virtual KSycocaEntry * createEntry(const QString &file, const char *resource) const; 00060 00061 virtual KService * createEntry( int ) const { assert(0); return 0; } 00062 00066 virtual void addEntry(const KSycocaEntry::Ptr& newEntry); 00067 00071 virtual void save(QDataStream &str); 00072 00079 virtual void saveHeader(QDataStream &str); 00080 00084 static QStringList resourceTypes(); 00085 00086 void populateServiceTypes(); 00087 00088 private: 00089 void saveOfferList(QDataStream &str); 00090 void collectInheritedServices(); 00091 void collectInheritedServices(KMimeType::Ptr mime, QSet<KMimeType::Ptr>& visitedMimes); 00092 00093 QHash<QString, KService::Ptr> m_nameMemoryHash; // m_nameDict is not useable while building ksycoca 00094 QHash<QString, KService::Ptr> m_relNameMemoryHash; // m_relNameDict is not useable while building ksycoca 00095 QHash<QString, KService::Ptr> m_menuIdMemoryHash; // m_menuIdDict is not useable while building ksycoca 00096 QSet<KSycocaEntry::Ptr> m_dupeDict; 00097 00098 KOfferHash m_offerHash; 00099 00100 KSycocaFactory *m_serviceTypeFactory; 00101 KBuildMimeTypeFactory *m_mimeTypeFactory; 00102 KBuildServiceGroupFactory *m_serviceGroupFactory; 00103 }; 00104 00105 #endif