summaryrefslogtreecommitdiffabout
path: root/microkde/kresources
Side-by-side diff
Diffstat (limited to 'microkde/kresources') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/resource.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h
index 7ff4f23..64e7424 100644
--- a/microkde/kresources/resource.h
+++ b/microkde/kresources/resource.h
@@ -1,88 +1,89 @@
/*
This file is part of libkresources
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_RESOURCE_H
#define KRESOURCES_RESOURCE_H
//US
#ifdef QT_THREAD_SUPPORT
#include <qmutex.h>
#endif //QT_THREAD_SUPPORT
#include <qvaluelist.h>
#include <qwidget.h>
#include <qobject.h>
+#include <klibloader.h>
+
class KConfig;
namespace KRES {
-class KLibFactory;
class ConfigWidget;
/**
* @internal
* @libdoc The KDE Resource library
*
* NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
* interface, it is in constant flux.
*
* The KDE Resource framework can be used to manage resources of
* different types, organized in families. The Resource framework
* is currently used for addressbook resources in libkabc and for
* calendar resources in libkcal.
*
* When you want to use the framework for a new family, you need to
* <ul><li>Define a name for your resource family</li>
* <li>subclass Resource and add the fields and method that are needed
* in your application</li>
* <li>If needed, override the doOpen() and doClose() methods.
* <li> Provide a configuration possibility for resources in your
* new family. You can use @ref ResourcesConfigPage to easily create a
* KControl applet</li>
* <li>In your application, you can use @ref ResourceManager to keep track
* of the resources in your family, and you can use @ref ResourceSelectDialog
* to let the user select a single resource.</li>
* </ul>
*
* When you want to add a new resource type to an existing resource family,
* you need to
* <ul><li>Further subclass the family-specific Resource to implement
* resource type-specific operation</li>
* <li>Subclass ResourceConfigWidget to provide a configuration widget
* for your new resource type</li>
* <li>Provide a .desktop file so that the new resource type can be found
* automatically by the ResourceManager</li>
* </ul>
*
* Example:
*
<B>resourceexample.h</B>:
<pre>
#include <kconfig.h>
#include <kresources/resource.h>
class ResourceExample : public KRES::ResourceExample
{
public:
ResourceExample( const KConfig * );
@@ -318,84 +319,83 @@ class Resource : public QObject
* Returns the name of resource.
*/
virtual QString resourceName() const;
/**
Sets, if the resource is active.
*/
void setActive( bool active );
/**
Return true, if the resource is active.
*/
bool isActive() const;
friend class Factory;
friend class ManagerImpl;
/**
Print resource information as debug output.
*/
virtual void dump() const;
protected:
/**
* Open this resource. When called, the resource must be in
* a closed state.
*
* Returns true if the resource was opened successfully;
* returns false if the resource was not opened successfully.
*
* The result of this call can be accessed later by @ref isOpen()
*/
virtual bool doOpen() { return true; }
/**
* Close this resource. Pre-condition: resource is open.
* Post-condition: resource is closed.
*/
virtual void doClose() {}
void setIdentifier( const QString& identifier );
void setType( const QString& type );
private:
class ResourcePrivate;
ResourcePrivate *d;
};
-//US class PluginFactoryBase : public KLibFactory
-class PluginFactoryBase
+class PluginFactoryBase : public KLibFactory
{
public:
virtual Resource *resource( const KConfig *config ) = 0;
virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
protected:
virtual QObject* createObject( QObject*, const char*, const char*,
const QStringList & )
{
return 0;
}
};
template<class TR,class TC>
class PluginFactory : public PluginFactoryBase
{
public:
Resource *resource( const KConfig *config )
{
return new TR( config );
}
ConfigWidget *configWidget( QWidget *parent )
{
return new TC( parent );
}
};
}
#endif