* prevent some possibe crash interactions between extenders and applets
* proper save of geometry, transform and position post startup svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=866823
This commit is contained in:
parent
2f87c469f7
commit
a062bbc901
42
applet.cpp
42
applet.cpp
@ -178,6 +178,7 @@ void Applet::save(KConfigGroup &g) const
|
|||||||
group = *d->mainConfigGroup();
|
group = *d->mainConfigGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kDebug() << "saving to" << group.name();
|
||||||
// we call the dptr member directly for locked since isImmutable()
|
// we call the dptr member directly for locked since isImmutable()
|
||||||
// also checks kiosk and parent containers
|
// also checks kiosk and parent containers
|
||||||
group.writeEntry("immutability", (int)d->immutability);
|
group.writeEntry("immutability", (int)d->immutability);
|
||||||
@ -252,6 +253,11 @@ void Applet::restore(KConfigGroup &group)
|
|||||||
//TODO: implement; the shortcut
|
//TODO: implement; the shortcut
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
// start up is done, we can now go do a mod timer
|
||||||
|
if (d->modificationsTimerId > 0) {
|
||||||
|
killTimer(d->modificationsTimerId);
|
||||||
|
}
|
||||||
|
d->modificationsTimerId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletPrivate::setFocus()
|
void AppletPrivate::setFocus()
|
||||||
@ -1206,6 +1212,15 @@ void Applet::resizeEvent(QGraphicsSceneResizeEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateConstraints(Plasma::SizeConstraint);
|
updateConstraints(Plasma::SizeConstraint);
|
||||||
|
|
||||||
|
if (d->modificationsTimerId != -1) {
|
||||||
|
// schedule a save
|
||||||
|
if (d->modificationsTimerId) {
|
||||||
|
killTimer(d->modificationsTimerId);
|
||||||
|
}
|
||||||
|
d->modificationsTimerId = startTimer(1000);
|
||||||
|
}
|
||||||
|
|
||||||
emit geometryChanged();
|
emit geometryChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1447,10 +1462,12 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
|
|||||||
emit geometryChanged();
|
emit geometryChanged();
|
||||||
// fall through!
|
// fall through!
|
||||||
case ItemTransformHasChanged: {
|
case ItemTransformHasChanged: {
|
||||||
if (d->modificationsTimerId) {
|
if (d->modificationsTimerId != -1) {
|
||||||
killTimer(d->modificationsTimerId);
|
if (d->modificationsTimerId) {
|
||||||
|
killTimer(d->modificationsTimerId);
|
||||||
|
}
|
||||||
|
d->modificationsTimerId = startTimer(1000);
|
||||||
}
|
}
|
||||||
d->modificationsTimerId = startTimer(1000);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1502,13 +1519,21 @@ QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
|
|||||||
|
|
||||||
void Applet::timerEvent(QTimerEvent *event)
|
void Applet::timerEvent(QTimerEvent *event)
|
||||||
{
|
{
|
||||||
|
if (d->transient) {
|
||||||
|
killTimer(d->constraintsTimerId);
|
||||||
|
killTimer(d->modificationsTimerId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event->timerId() == d->constraintsTimerId) {
|
if (event->timerId() == d->constraintsTimerId) {
|
||||||
killTimer(d->constraintsTimerId);
|
killTimer(d->constraintsTimerId);
|
||||||
d->constraintsTimerId = 0;
|
d->constraintsTimerId = 0;
|
||||||
flushPendingConstraintsEvents();
|
flushPendingConstraintsEvents();
|
||||||
} else if (event->timerId() == d->modificationsTimerId) {
|
} else if (event->timerId() == d->modificationsTimerId) {
|
||||||
killTimer(d->modificationsTimerId);
|
killTimer(d->modificationsTimerId);
|
||||||
KConfigGroup cg = config();
|
d->modificationsTimerId = 0;
|
||||||
|
// invalid group, will result in save using the default group
|
||||||
|
KConfigGroup cg;
|
||||||
save(cg);
|
save(cg);
|
||||||
emit configNeedsSaving();
|
emit configNeedsSaving();
|
||||||
}
|
}
|
||||||
@ -1589,6 +1614,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet
|
|||||||
actions(applet),
|
actions(applet),
|
||||||
activationAction(0),
|
activationAction(0),
|
||||||
constraintsTimerId(0),
|
constraintsTimerId(0),
|
||||||
|
modificationsTimerId(-1),
|
||||||
hasConfigurationInterface(false),
|
hasConfigurationInterface(false),
|
||||||
failed(false),
|
failed(false),
|
||||||
isContainment(false),
|
isContainment(false),
|
||||||
@ -1604,6 +1630,8 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet
|
|||||||
|
|
||||||
AppletPrivate::~AppletPrivate()
|
AppletPrivate::~AppletPrivate()
|
||||||
{
|
{
|
||||||
|
modificationsTimerId = -1;
|
||||||
|
|
||||||
if (activationAction && activationAction->isGlobalShortcutEnabled()) {
|
if (activationAction && activationAction->isGlobalShortcutEnabled()) {
|
||||||
//kDebug() << "reseting global action for" << q->name() << activationAction->objectName();
|
//kDebug() << "reseting global action for" << q->name() << activationAction->objectName();
|
||||||
activationAction->forgetGlobalShortcut();
|
activationAction->forgetGlobalShortcut();
|
||||||
@ -1613,6 +1641,11 @@ AppletPrivate::~AppletPrivate()
|
|||||||
DataEngineManager::self()->unloadEngine( engine );
|
DataEngineManager::self()->unloadEngine( engine );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (extender) {
|
||||||
|
delete extender;
|
||||||
|
extender = 0;
|
||||||
|
}
|
||||||
|
|
||||||
delete script;
|
delete script;
|
||||||
script = 0;
|
script = 0;
|
||||||
delete package;
|
delete package;
|
||||||
@ -1731,6 +1764,7 @@ void AppletPrivate::scheduleConstraintsUpdate(Plasma::Constraints c)
|
|||||||
if (!constraintsTimerId && !(c & Plasma::StartupCompletedConstraint)) {
|
if (!constraintsTimerId && !(c & Plasma::StartupCompletedConstraint)) {
|
||||||
constraintsTimerId = q->startTimer(0);
|
constraintsTimerId = q->startTimer(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pendingConstraints |= c;
|
pendingConstraints |= c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ namespace Plasma
|
|||||||
{
|
{
|
||||||
|
|
||||||
// constant controlling how long between requesting a configuration sync
|
// constant controlling how long between requesting a configuration sync
|
||||||
// and one happening should occur. currently 30 seconds
|
// and one happening should occur. currently 10 seconds
|
||||||
const int CONFIG_SYNC_TIMEOUT = 30000;
|
const int CONFIG_SYNC_TIMEOUT = 10000;
|
||||||
|
|
||||||
class CoronaPrivate
|
class CoronaPrivate
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,7 @@ Extender::Extender(Applet *applet)
|
|||||||
|
|
||||||
Extender::~Extender()
|
Extender::~Extender()
|
||||||
{
|
{
|
||||||
|
d->applet->d->extender = 0;
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user