* appletConfig -> config
* globalAppletConfig -> globalConfig * add a convenience and safety method for accessing groups in the applet config, which namespaces the groups appropriately svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=687046
This commit is contained in:
parent
843ab6a69f
commit
94a57ed051
15
applet.cpp
15
applet.cpp
@ -128,11 +128,11 @@ Applet::~Applet()
|
||||
|
||||
void Applet::init()
|
||||
{
|
||||
setImmutable(globalAppletConfig().isImmutable() ||
|
||||
appletConfig().isImmutable());
|
||||
setImmutable(globalConfig().isImmutable() ||
|
||||
config().isImmutable());
|
||||
}
|
||||
|
||||
KConfigGroup Applet::appletConfig() const
|
||||
KConfigGroup Applet::config() const
|
||||
{
|
||||
if ( !d->appletConfig ) {
|
||||
QString file = KStandardDirs::locateLocal( "appdata",
|
||||
@ -144,7 +144,14 @@ KConfigGroup Applet::appletConfig() const
|
||||
return KConfigGroup(d->appletConfig, "General");
|
||||
}
|
||||
|
||||
KConfigGroup Applet::globalAppletConfig() const
|
||||
KConfigGroup Applet::config(const QString& group) const
|
||||
{
|
||||
KConfigGroup cg = config();
|
||||
cg.changeGroup(instanceName() + "-" + group);
|
||||
return cg;
|
||||
}
|
||||
|
||||
KConfigGroup Applet::globalConfig() const
|
||||
{
|
||||
if ( !d->globalConfig ) {
|
||||
QString file = KStandardDirs::locateLocal( "config", "plasma_" + globalName() + "rc" );
|
||||
|
13
applet.h
13
applet.h
@ -79,7 +79,16 @@ class PLASMA_EXPORT Applet : public QObject, public Widget
|
||||
* specific config file named \<appletname\>\<instanceid\>rc
|
||||
* in the Plasma appdata directory.
|
||||
**/
|
||||
KConfigGroup appletConfig() const;
|
||||
KConfigGroup config() const;
|
||||
|
||||
/**
|
||||
* Returns a config group with the name provided. This ensures
|
||||
* that the group name is properly namespaced to avoid collision
|
||||
* with other applets that may be sharing this config file
|
||||
*
|
||||
* @param group the name of the group to access
|
||||
**/
|
||||
KConfigGroup config(const QString& group) const;
|
||||
|
||||
/**
|
||||
* Returns a KConfigGroup object to be shared by all applets of this
|
||||
@ -88,7 +97,7 @@ class PLASMA_EXPORT Applet : public QObject, public Widget
|
||||
* This config object will write to an applet-specific config object
|
||||
* named plasma_\<appletname\>rc in the local config directory.
|
||||
*/
|
||||
KConfigGroup globalAppletConfig() const;
|
||||
KConfigGroup globalConfig() const;
|
||||
|
||||
/**
|
||||
* Loads the given DataEngine
|
||||
|
Loading…
Reference in New Issue
Block a user