summaryrefslogtreecommitdiffstats
path: root/kue/pluginloader.cpp
blob: 39a64d63c291beda2410092de2d50938e79bdf65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
}