* bring back a publicly available scheduleConfigSync, but as requestConfigSync; the host app may need to trigger this
* signal when the config is sync'd, so the host app (or whomever else cares to) can hook into these syncs as well. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=820383
This commit is contained in:
parent
32705801ba
commit
92390049ed
17
corona.cpp
17
corona.cpp
@ -105,6 +105,7 @@ public:
|
||||
void syncConfig()
|
||||
{
|
||||
q->config()->sync();
|
||||
emit q->configSynced();
|
||||
}
|
||||
|
||||
Containment* addContainment(const QString& name, const QVariantList& args, uint id, bool delayedInit)
|
||||
@ -145,7 +146,7 @@ public:
|
||||
|
||||
containments.append(containment);
|
||||
connect(containment, SIGNAL(destroyed(QObject*)), q, SLOT(containmentDestroyed(QObject*)));
|
||||
connect(containment, SIGNAL(configNeedsSaving()), q, SLOT(scheduleConfigSync()));
|
||||
connect(containment, SIGNAL(configNeedsSaving()), q, SLOT(requestConfigSync()));
|
||||
connect(containment, SIGNAL(releaseVisualFocus()), q, SIGNAL(releaseVisualFocus()));
|
||||
connect(containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)),
|
||||
q, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)));
|
||||
@ -161,7 +162,7 @@ public:
|
||||
* Called when there have been changes made to configuration that should be saved
|
||||
* to disk at the next convenient moment
|
||||
*/
|
||||
void scheduleConfigSync();
|
||||
void requestConfigSync();
|
||||
|
||||
Corona *q;
|
||||
ImmutabilityType immutability;
|
||||
@ -213,7 +214,7 @@ void Corona::saveLayout(const QString &configName) const
|
||||
d->saveLayout(c);
|
||||
}
|
||||
|
||||
void Corona::Private::scheduleConfigSync()
|
||||
void Corona::requestConfigSync()
|
||||
{
|
||||
// TODO: should we check into our immutability before doing this?
|
||||
|
||||
@ -222,8 +223,8 @@ void Corona::Private::scheduleConfigSync()
|
||||
// it should at least compress these activities a bit and provide a way for applet
|
||||
// authors to ween themselves from the sync() disease. A more interesting/dynamic
|
||||
// algorithm for determining when to actually sync() to disk might be better, though.
|
||||
if (!configSyncTimer.isActive()) {
|
||||
configSyncTimer.start(CONFIG_SYNC_TIMEOUT);
|
||||
if (!d->configSyncTimer.isActive()) {
|
||||
d->configSyncTimer.start(CONFIG_SYNC_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +236,7 @@ void Corona::initializeLayout(const QString &configName)
|
||||
if (d->containments.isEmpty()) {
|
||||
loadDefaultLayout();
|
||||
if (!d->containments.isEmpty()) {
|
||||
d->scheduleConfigSync();
|
||||
requestConfigSync();
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,7 +331,7 @@ KSharedConfigPtr Corona::config() const
|
||||
Containment* Corona::addContainment(const QString& name, const QVariantList& args)
|
||||
{
|
||||
Containment *c = d->addContainment(name, args, 0, false);
|
||||
d->scheduleConfigSync();
|
||||
requestConfigSync();
|
||||
return c;
|
||||
}
|
||||
|
||||
@ -350,7 +351,7 @@ void Corona::destroyContainment(Containment *c)
|
||||
removeItem(c);
|
||||
c->config().deleteGroup();
|
||||
c->deleteLater();
|
||||
d->scheduleConfigSync();
|
||||
requestConfigSync();
|
||||
}
|
||||
|
||||
void Corona::loadDefaultLayout()
|
||||
|
12
corona.h
12
corona.h
@ -134,6 +134,12 @@ public Q_SLOTS:
|
||||
*/
|
||||
void setImmutability(const ImmutabilityType immutable);
|
||||
|
||||
/**
|
||||
* Schedules a flush-to-disk synchronization of the configuration state
|
||||
* at the next convenient moment.
|
||||
*/
|
||||
void requestConfigSync();
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal indicates a new containment has been added to
|
||||
@ -159,6 +165,11 @@ Q_SIGNALS:
|
||||
*/
|
||||
void releaseVisualFocus();
|
||||
|
||||
/**
|
||||
* This signal indicates that the configuration file was flushed to disc.
|
||||
*/
|
||||
void configSynced();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Loads the default (system wide) layout for this user
|
||||
@ -176,7 +187,6 @@ private:
|
||||
|
||||
Q_PRIVATE_SLOT(d, void containmentDestroyed(QObject*))
|
||||
Q_PRIVATE_SLOT(d, void syncConfig())
|
||||
Q_PRIVATE_SLOT(d, void scheduleConfigSync())
|
||||
};
|
||||
|
||||
} // namespace Plasma
|
||||
|
Loading…
x
Reference in New Issue
Block a user