diff --git a/includes/CMakeLists.txt b/includes/CMakeLists.txt index 4ebce440..c3a1f496 100644 --- a/includes/CMakeLists.txt +++ b/includes/CMakeLists.txt @@ -570,8 +570,6 @@ install( FILES KParts/Factory KParts/FileInfoExtension KParts/GUIActivateEvent - KParts/GenericFactory - KParts/GenericFactoryBase KParts/HistoryProvider KParts/HtmlExtension KParts/LiveConnectExtension diff --git a/includes/KParts/GenericFactory b/includes/KParts/GenericFactory deleted file mode 100644 index cfcd07d6..00000000 --- a/includes/KParts/GenericFactory +++ /dev/null @@ -1 +0,0 @@ -#include "../../kparts/genericfactory.h" diff --git a/includes/KParts/GenericFactoryBase b/includes/KParts/GenericFactoryBase deleted file mode 100644 index cfcd07d6..00000000 --- a/includes/KParts/GenericFactoryBase +++ /dev/null @@ -1 +0,0 @@ -#include "../../kparts/genericfactory.h" diff --git a/kparts/CMakeLists.txt b/kparts/CMakeLists.txt index 1b36db49..7aa2fe95 100644 --- a/kparts/CMakeLists.txt +++ b/kparts/CMakeLists.txt @@ -43,7 +43,7 @@ install(TARGETS kparts EXPORT kdelibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_AR install( FILES kpart.desktop krop.desktop krwp.desktop browserview.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) install( FILES kparts_export.h part.h plugin.h partmanager.h mainwindow.h event.h - browserextension.h factory.h historyprovider.h browserinterface.h genericfactory.h + browserextension.h factory.h historyprovider.h browserinterface.h componentfactory.h browserrun.h statusbarextension.h browseropenorsavequestion.h scriptableextension.h textextension.h htmlextension.h fileinfoextension.h listingextension.h diff --git a/kparts/genericfactory.h b/kparts/genericfactory.h deleted file mode 100644 index dc5e0de4..00000000 --- a/kparts/genericfactory.h +++ /dev/null @@ -1,214 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2001 Simon Hausmann - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KPARTS_GENERICFACTORY_H -#define KPARTS_GENERICFACTORY_H - -#include -#include -#include -#include - -namespace KParts -{ - - /** - * @internal - */ - template - class GenericFactoryBase : public KParts::Factory - { - public: - GenericFactoryBase() - { - if ( s_self ) - { - kWarning() << "KParts::GenericFactory instantiated more than once!"; - } - s_self = this; - } - virtual ~GenericFactoryBase() - { - delete s_aboutData; - delete s_componentData; - s_aboutData = 0; - s_componentData = 0; - s_self = 0; - } - - static const KComponentData &componentData(); - static KAboutData *aboutData(); - virtual KComponentData partComponentData() - { - return componentData(); - } - - - protected: - virtual KComponentData *createComponentData() - { - return new KComponentData(aboutData()); - } - - - private: - static GenericFactoryBase *s_self; - static KComponentData *s_componentData; - static KAboutData *s_aboutData; - }; - - /** - * A template for a KParts::Factory implementation. It implements the pure virtual - * createPartObject method by instantiating the template argument when requested - * through the className field. In addition it is a container for a part's KComponentData - * object, by providing a static KComponentData componentData() method. - * - * The template argument has to inherit from KParts::Part and has to implement two methods: - * 1) There needs to be a public constructor with the following signature: - * MyPart( QWidget *parentWidget, QObject *parent, const QStringList& args ) - * - * 2) It needs to provide one static method to create a KAboutData object per - * request, holding information about the component's name, its authors, license, etc. - * The signature of that static method has to be - * KAboutData *createAboutData() - * - * The template will take care of memory management of the KComponentData and the KAboutData object, - * meaning ownership of what createAboutData returns is passed to the caller (this template) . - * - * For advanced use you can also inherit from the template and re-implement additionally the - * virtual KComponentData createComponentData() method, for example in case you want to extend the - * paths of your instance's KStandardDirs object. - * - * If a KParts::ReadOnlyPart is requested through this factory and the template argument - * implements a KParts::ReadWritePart then setReadWrite( false ) will automatically be - * called in createPartObject. - * - * Use the factory through the K_EXPORT_COMPONENT_FACTORY macro, like that: - * \code - * typedef KParts::GenericFactory<YourKPart> YourKPartFactory; - * K_EXPORT_COMPONENT_FACTORY( yourlibrary, YourKPartFactory ) - * \endcode - * yourlibrary is the library name that you compiled your KPart into. - */ - template - class KDE_DEPRECATED GenericFactory : public GenericFactoryBase - { - public: - GenericFactory() { } - - virtual KParts::Part *createPartObject( QWidget *parentWidget, - QObject *parent, - const char *className, - const QStringList &args ) - { - T *part = KDEPrivate::ConcreteFactory::create( parentWidget, - parent, - className, - args ); - - if ( part && !qstrcmp( className, "KParts::ReadOnlyPart" ) ) - { - KParts::ReadWritePart *rwp = dynamic_cast( part ); - if ( rwp ) - rwp->setReadWrite( false ); - } - return part; - } - }; - - template - class GenericFactory< KTypeList > : public GenericFactoryBase - { - public: - GenericFactory() { } - - virtual KParts::Part *createPartObject( QWidget *parentWidget, - QObject *parent, - const char *className, - const QStringList &args ) - { - QObject *object = KDEPrivate::MultiFactory< KTypeList >::create( parentWidget, - parent, - className, - args ); - - // (this cast is guaranteed to work...) - KParts::Part *part = dynamic_cast( object ); - - if ( part && !qstrcmp( className, "KParts::ReadOnlyPart" ) ) - { - KParts::ReadWritePart *rwp = dynamic_cast( part ); - if ( rwp ) - rwp->setReadWrite( false ); - } - return part; - } - }; - - /** - * @internal - */ - template - GenericFactoryBase *GenericFactoryBase::s_self = 0; - - /** - * @internal - */ - template - KComponentData *GenericFactoryBase::s_componentData = 0; - - /** - * @internal - */ - template - KAboutData *GenericFactoryBase::s_aboutData = 0; - - /** - * @internal - */ - template - const KComponentData &GenericFactoryBase::componentData() - { - if ( !s_componentData ) - { - if ( s_self ) - s_componentData = s_self->createComponentData(); - else - s_componentData = new KComponentData(aboutData()); - } - return *s_componentData; - } - - /** - * @internal - */ - template - KAboutData *GenericFactoryBase::aboutData() - { - if ( !s_aboutData ) - s_aboutData = T::createAboutData(); - return s_aboutData; - } - -} - -#endif - -/** - * vim: et sw=4 - */