give the configxml object our config object; probably works better that way ;)
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=694408
This commit is contained in:
parent
b1fafa0edc
commit
8d5d8daeb3
42
applet.cpp
42
applet.cpp
@ -149,7 +149,7 @@ public:
|
||||
QString xmlPath = package->filePath("mainconfigxml");
|
||||
if (!xmlPath.isEmpty()) {
|
||||
QFile file(xmlPath);
|
||||
configXml = new ConfigXml(xmlPath, &file);
|
||||
configXml = new ConfigXml(config(), &file);
|
||||
}
|
||||
|
||||
if (!package->filePath("mainconfigui").isEmpty()) {
|
||||
@ -258,6 +258,26 @@ public:
|
||||
return s_maxAppletId;
|
||||
}
|
||||
|
||||
KSharedConfig::Ptr config() {
|
||||
if (!appletConfig) {
|
||||
QString file = KStandardDirs::locateLocal("appdata",
|
||||
"applets/" + instanceName() + "rc",
|
||||
true);
|
||||
appletConfig = KSharedConfig::openConfig(file);
|
||||
}
|
||||
|
||||
return appletConfig;
|
||||
}
|
||||
|
||||
QString instanceName()
|
||||
{
|
||||
if (!appletDescription.isValid()) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
return appletDescription.service()->library() + QString::number(appletId);
|
||||
}
|
||||
|
||||
//TODO: examine the usage of memory here; there's a pretty large
|
||||
// number of members at this point.
|
||||
uint appletId;
|
||||
@ -309,14 +329,7 @@ Applet::~Applet()
|
||||
|
||||
KConfigGroup Applet::config() const
|
||||
{
|
||||
if (!d->appletConfig) {
|
||||
QString file = KStandardDirs::locateLocal( "appdata",
|
||||
"applets/" + instanceName() + "rc",
|
||||
true );
|
||||
d->appletConfig = KSharedConfig::openConfig( file );
|
||||
}
|
||||
|
||||
return KConfigGroup(d->appletConfig, "General");
|
||||
return KConfigGroup(d->config(), "General");
|
||||
}
|
||||
|
||||
KConfigGroup Applet::config(const QString& group) const
|
||||
@ -336,6 +349,11 @@ KConfigGroup Applet::globalConfig() const
|
||||
return KConfigGroup(d->globalConfig, "General");
|
||||
}
|
||||
|
||||
ConfigXml* Applet::configXml()
|
||||
{
|
||||
return d->configXml;
|
||||
}
|
||||
|
||||
DataEngine* Applet::dataEngine(const QString& name) const
|
||||
{
|
||||
int index = d->loadedEngines.indexOf(name);
|
||||
@ -622,11 +640,7 @@ QString Applet::globalName() const
|
||||
|
||||
QString Applet::instanceName() const
|
||||
{
|
||||
if (!d->appletDescription.isValid()) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
return d->appletDescription.service()->library() + QString::number( d->appletId );
|
||||
d->instanceName();
|
||||
}
|
||||
|
||||
void Applet::watchForFocus(QObject *widget, bool watch)
|
||||
|
9
applet.h
9
applet.h
@ -26,6 +26,7 @@
|
||||
#include <ksharedconfig.h>
|
||||
#include <kgenericfactory.h>
|
||||
|
||||
#include <plasma/configxml.h>
|
||||
#include <plasma/plasma.h>
|
||||
#include <plasma/widgets/widget.h>
|
||||
|
||||
@ -119,6 +120,14 @@ class PLASMA_EXPORT Applet : public QObject, public Widget
|
||||
*/
|
||||
KConfigGroup globalConfig() const;
|
||||
|
||||
/**
|
||||
* Returns the config skeleton object from this applet's package,
|
||||
* if any.
|
||||
*
|
||||
* @return config skeleton object, or 0 if none
|
||||
**/
|
||||
ConfigXml* configXml();
|
||||
|
||||
/**
|
||||
* Loads the given DataEngine
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user