only expose a KConfigGroup to applet subclasses to encourage correctness and allow for future flexibility.

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=668085
This commit is contained in:
Aaron J. Seigo 2007-05-25 02:36:22 +00:00
parent 8288d58356
commit a62bd49c9a
2 changed files with 15 additions and 15 deletions

View File

@ -98,7 +98,7 @@ Applet::~Applet()
delete d;
}
KSharedConfig::Ptr Applet::appletConfig() const
KConfigGroup Applet::appletConfig() const
{
if ( !d->appletConfig ) {
QString file = KStandardDirs::locateLocal( "appdata",
@ -107,17 +107,17 @@ KSharedConfig::Ptr Applet::appletConfig() const
d->appletConfig = KSharedConfig::openConfig( file );
}
return d->appletConfig;
return KConfigGroup(d->appletConfig, "General");
}
KSharedConfig::Ptr Applet::globalAppletConfig() const
KConfigGroup Applet::globalAppletConfig() const
{
if ( !d->globalConfig ) {
QString file = KStandardDirs::locateLocal( "config", "plasma_" + globalName() + "rc" );
d->globalConfig = KSharedConfig::openConfig( file );
}
return d->globalConfig;
return KConfigGroup(d->globalConfig, "General");
}
bool Applet::loadDataEngine( const QString& name )

View File

@ -54,6 +54,7 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup
Applet(QGraphicsItem* parent,
const QString& serviceId,
int appletId);
/**
* This constructor is to be used with the plugin loading systems
* found in KPluginInfo and KService. The argument list is expected
@ -69,23 +70,22 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup
~Applet();
/**
* Returns the KConfig object to access the applets configuration.
* Returns the KConfigGroup to access the applets configuration.
*
* For unique applets this config object will write to a config file
* named \<appletname\>rc in the user's local %KDE directory.
*
* For normal applets this config object will write to an instance
* This config object will write to an instance
* specific config file named \<appletname\>\<instanceid\>rc
* in the user's local %KDE directory.
* in the Plasma appdata directory.
**/
KSharedConfig::Ptr appletConfig() const;
KConfigGroup appletConfig() const;
/**
* Returns a KConfig object to be shared by all applets of this type
* For unique applets, this will return the same config object as
* appletConfig()
* Returns a KConfigGroup object to be shared by all applets of this
* type.
*
* This config object will write to an applet-specific config object
* named plasma_\<appletname\>rc in the local config directory.
*/
KSharedConfig::Ptr globalAppletConfig() const;
KConfigGroup globalAppletConfig() const;
/**
* Ensures that the DataEngine named name is loaded and ready to be used