* save applet config on exit
* introduce Applet::destroy which will perform cleanups, like deleting config files, etc.. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=696586
This commit is contained in:
parent
21c804908e
commit
0eafb46fc4
27
applet.cpp
27
applet.cpp
@ -340,6 +340,15 @@ Applet::Applet(QObject* parent, const QStringList& args)
|
||||
Applet::~Applet()
|
||||
{
|
||||
needsFocus( false );
|
||||
|
||||
if (d->appletConfig) {
|
||||
d->appletConfig->sync();
|
||||
}
|
||||
|
||||
if (d->globalConfig) {
|
||||
d->globalConfig->sync();
|
||||
}
|
||||
|
||||
delete d;
|
||||
}
|
||||
|
||||
@ -365,7 +374,23 @@ KConfigGroup Applet::globalConfig() const
|
||||
return KConfigGroup(d->globalConfig, "General");
|
||||
}
|
||||
|
||||
ConfigXml* Applet::configXml()
|
||||
void Applet::destroy()
|
||||
{
|
||||
if (d->configXml) {
|
||||
d->configXml->setDefaults();
|
||||
}
|
||||
|
||||
if (d->appletConfig) {
|
||||
foreach (const QString& group, d->appletConfig->groupList()) {
|
||||
d->appletConfig->deleteGroup(group);
|
||||
}
|
||||
d->appletConfig = 0;
|
||||
}
|
||||
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
ConfigXml* Applet::configXml() const
|
||||
{
|
||||
return d->configXml;
|
||||
}
|
||||
|
8
applet.h
8
applet.h
@ -128,7 +128,7 @@ class PLASMA_EXPORT Applet : public Widget
|
||||
*
|
||||
* @return config skeleton object, or 0 if none
|
||||
**/
|
||||
ConfigXml* configXml();
|
||||
ConfigXml* configXml() const;
|
||||
|
||||
/**
|
||||
* Loads the given DataEngine
|
||||
@ -476,6 +476,12 @@ class PLASMA_EXPORT Applet : public Widget
|
||||
**/
|
||||
void requestFocus( bool focus );
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Destroys the applet; it will be deleted and configurations reset.
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Returns the name of the applet.
|
||||
|
Loading…
Reference in New Issue
Block a user