Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konqueror / src / konqfactory.h
blob3b311d1a95e8321ab9a61d6fdf695f6e860f2813
1 /* This file is part of the KDE project
2 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
3 Copyright (C) 1999 David Faure <faure@kde.org>
4 Copyright (C) 1999 Torben Weis <weis@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef __konq_factory_h__
23 #define __konq_factory_h__
25 #include "konqprivate_export.h"
27 #include <kservice.h>
29 class KAboutData;
30 class KPluginFactory;
31 namespace KParts { class ReadOnlyPart; }
33 class KonqViewFactory // TODO rename to KonqPartLoader?
35 public:
36 /**
37 * Create null factory
39 KonqViewFactory() : m_factory(0), m_args() {}
41 KonqViewFactory(const QString& libName, KPluginFactory* factory);
43 // The default copy ctor and operator= can be used, this is a value class.
45 void setArgs(const QVariantList &args);
47 KParts::ReadOnlyPart *create(QWidget *parentWidget, QObject *parent);
49 bool isNull() const { return m_factory ? false : true; }
51 private:
52 QString m_libName;
53 KPluginFactory *m_factory;
54 QVariantList m_args;
57 /**
58 * Factory for creating (loading) parts when creating a view.
60 class KONQ_TESTS_EXPORT KonqFactory
62 public:
63 /**
64 * Return the factory that can be used to actually create the part inside a view.
66 * The implementation locates the part module (library), using the trader
67 * and opens it (using klibfactory), which gives us a factory that can be used to
68 * actually create the part (later on, when the KonqView exists).
70 * Not a static method so that we can define an abstract base class
71 * with another implementation, for unit tests, if wanted.
73 KonqViewFactory createView( const QString &serviceType,
74 const QString &serviceName = QString(),
75 KService::Ptr *serviceImpl = 0,
76 KService::List *partServiceOffers = 0,
77 KService::List *appServiceOffers = 0,
78 bool forceAutoEmbed = false );
80 static void getOffers( const QString & serviceType,
81 KService::List *partServiceOffers = 0,
82 KService::List *appServiceOffers = 0);
84 static const KAboutData* aboutData();
87 #endif