26#include <tdesimpleconfig.h>
27#include <tdestandarddirs.h>
28#include <kstaticdeleter.h>
61 TDETrader::OfferList
plugins = TDETrader::self()->query(
"TDEResources/Plugin", TQString(
"[X-TDE-ResourceFamily] == '%1'" )
63 TDETrader::OfferList::ConstIterator
it;
65 TQVariant type = (*it)->property(
"X-TDE-ResourceType" );
66 if ( !type.toString().
isEmpty() )
67 mTypeMap.insert( type.toString(), *
it );
77 return mTypeMap.keys();
82 if ( type.isEmpty() || !mTypeMap.contains( type ) )
85 KService::Ptr
ptr = mTypeMap[ type ];
86 KLibFactory *
factory = KLibLoader::self()->factory(
ptr->library().latin1() );
88 kdDebug(5650) <<
"KRES::Factory::configWidget(): Factory creation failed "
89 << KLibLoader::self()->lastErrorMessage() <<
endl;
96 kdDebug(5650) <<
"KRES::Factory::configWidget(): no plugin factory."
103 kdDebug(5650) <<
"'" <<
ptr->library() <<
"' doesn't provide a ConfigWidget" <<
endl;
112 if ( type.isEmpty() || !mTypeMap.contains( type ) )
115 KService::Ptr
ptr = mTypeMap[ type ];
121 if ( type.isEmpty() || !mTypeMap.contains( type ) )
124 KService::Ptr
ptr = mTypeMap[ type ];
125 return ptr->comment();
130 kdDebug(5650) <<
"Factory::resource( " << type <<
", config )" <<
endl;
132 if ( type.isEmpty() || !mTypeMap.contains( type ) ) {
133 kdDebug(5650) <<
"Factory::resource() no such type " << type <<
endl;
137 KService::Ptr
ptr = mTypeMap[ type ];
138 KLibFactory *
factory = KLibLoader::self()->factory(
ptr->library().latin1() );
140 kdDebug(5650) <<
"KRES::Factory::resource(): Factory creation failed "
141 << KLibLoader::self()->lastErrorMessage() <<
endl;
148 kdDebug(5650) <<
"KRES::Factory::resource(): no plugin factory." <<
endl;
154 kdDebug(5650) <<
"'" <<
ptr->library() <<
"' is not a " + mResourceFamily +
Class for loading resource plugins.
TQStringList typeNames() const
Returns a list of all available resource types.
Resource * resource(const TQString &type, const TDEConfig *config)
Returns a pointer to a resource object or a null pointer if resource type doesn't exist.
static Factory * self(const TQString &resourceFamily)
Returns the global resource factory.
TQString typeDescription(const TQString &type) const
Returns the description for a special type.
TQString typeName(const TQString &type) const
Returns the name for a special type.
ConfigWidget * configWidget(const TQString &type, TQWidget *parent=0)
Returns the config widget for the given resource type, or a null pointer if resource type doesn't exi...
This class provides a manager for resources of a specified family.
Iterator end()
Return Iterator indicating end of resource list.
Iterator begin()
Return Iterator on first resource.
bool isEmpty() const
Return true, if manager doesn't hold any resources.
This class provides a resource which is managed in a general way.