diff options
Diffstat (limited to 'kue/pluginloader.cpp')
-rw-r--r-- | kue/pluginloader.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/kue/pluginloader.cpp b/kue/pluginloader.cpp new file mode 100644 index 00000000..39a64d63 --- /dev/null +++ b/kue/pluginloader.cpp @@ -0,0 +1,40 @@ +#include <tqstring.h> +#include <tqvaluelist.h> +#include <tdeglobal.h> +#include <kstandarddirs.h> +#include <tqfile.h> +#include <ksimpleconfig.h> +#include <limits.h> + +#include "pluginloader.h" + +TQValueList<KuePluginInfo> KuePluginLoader::available() { + TQValueList<KuePluginInfo> items; + + TQStringList files=TDEGlobal::dirs()->findAllResources("appdata", "*.plugin", false, true); + for (TQStringList::Iterator i=files.begin(); i!=files.end(); ++i) { + items.append(getInformation(*i)); + } + + return items; +} + +KuePluginInfo KuePluginLoader::getInformation(const TQString &filename) { + KuePluginInfo info; + + if (!TQFile::exists(filename)) + return info; + + KSimpleConfig file(filename); + + info.filename = file.readPathEntry("Filename"); + info.type = file.readEntry("Type"); + info.name = file.readEntry("Name"); + info.description = file.readEntry("Description"); + + info.minTeams = TQMAX(file.readUnsignedNumEntry("MinTeams", 1), 1); + info.maxTeams = TQMAX(file.readUnsignedNumEntry("MaxTeams", UINT_MAX), 1); + + return info; +} + |