KDECore
kpluginloader.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2007 Bernhard Loos <nhuh.put@web.de> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef KDECORE_KPLUGINLOADER_H 00019 #define KDECORE_KPLUGINLOADER_H 00020 00021 #include <kglobal.h> 00022 #include <kdeversion.h> 00023 #include <kexportplugin.h> 00024 00025 #include <QtCore/QPluginLoader> 00026 #include <QtCore/QtPlugin> 00027 00028 00029 class KComponentData; 00030 class KPluginFactory; 00031 class KService; 00032 00033 class KPluginLoaderPrivate; 00034 00079 class KDECORE_EXPORT KPluginLoader : public QPluginLoader 00080 { 00081 Q_OBJECT 00082 Q_PROPERTY(QString fileName READ fileName) 00083 Q_PROPERTY(QString pluginName READ fileName) 00084 public: 00094 explicit KPluginLoader(const QString &plugin, const KComponentData &componentdata = KGlobal::mainComponent(), QObject *parent = 0); 00095 00105 explicit KPluginLoader(const KService &service, const KComponentData &componentdata = KGlobal::mainComponent(), QObject *parent = 0); 00106 00110 ~KPluginLoader(); 00111 00118 KPluginFactory *factory(); 00119 00124 QString pluginName() const; 00125 00130 quint32 pluginVersion() const; 00131 00136 QString errorString() const; 00137 00138 bool isLoaded() const; 00139 00140 protected: 00144 bool load(); 00145 private: 00146 Q_DECLARE_PRIVATE(KPluginLoader) 00147 Q_DISABLE_COPY(KPluginLoader) 00148 00149 using QPluginLoader::setFileName; 00150 00151 KPluginLoaderPrivate *const d_ptr; 00152 }; 00153 00154 00155 #endif