* save the size/rotation shortly after it's made .. should help preserve those changes in cases of crashes mor consistently

* delete the script before deleting the items it might rely on (e.g. the package!)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=864835
This commit is contained in:
Aaron J. Seigo 2008-09-25 16:26:04 +00:00
parent ee8d547da8
commit e1a0d5bb9c
2 changed files with 22 additions and 8 deletions

View File

@ -39,7 +39,6 @@
#include <QSize>
#include <QStyleOptionGraphicsItem>
#include <QTextDocument>
#include <QTimer>
#include <QUiLoader>
#include <KAction>
@ -1446,6 +1445,13 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
break;
case ItemPositionHasChanged:
emit geometryChanged();
// fall through!
case ItemTransformHasChanged: {
if (d->modificationsTimerId) {
killTimer(d->modificationsTimerId);
}
d->modificationsTimerId = startTimer(1000);
}
break;
default:
break;
@ -1500,6 +1506,11 @@ void Applet::timerEvent(QTimerEvent *event)
killTimer(d->constraintsTimerId);
d->constraintsTimerId = 0;
flushPendingConstraintsEvents();
} else if (event->timerId() == d->modificationsTimerId) {
killTimer(d->modificationsTimerId);
KConfigGroup cg = config();
save(cg);
emit configNeedsSaving();
}
}
@ -1566,10 +1577,10 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet
extender(0),
backgroundHints(Applet::StandardBackground),
appletDescription(service),
package(0),
needsConfigOverlay(0),
background(0),
script(0),
package(0),
configXml(0),
mainConfig(0),
pendingConstraints(NoConstraint),
@ -1602,9 +1613,14 @@ AppletPrivate::~AppletPrivate()
DataEngineManager::self()->unloadEngine( engine );
}
delete script;
script = 0;
delete package;
package = 0;
delete configXml;
configXml = 0;
delete mainConfig;
mainConfig = 0;
}
void AppletPrivate::init()

View File

@ -29,7 +29,6 @@ namespace Plasma
class PanelSvg;
class AppletScript;
class ShadowItem;
class Wallpaper;
class AppletOverlayWidget : public QGraphicsWidget
@ -62,7 +61,6 @@ public:
QString instanceName();
void scheduleConstraintsUpdate(Plasma::Constraints c);
KConfigGroup* mainConfigGroup();
void copyEntries(KConfigGroup *source, KConfigGroup *destination);
QString visibleFailureText(const QString& reason);
void checkImmutability();
void themeChanged();
@ -82,18 +80,17 @@ public:
// number of members at this point.
uint appletId;
Applet *q;
Extender *extender;
Applet::BackgroundHints backgroundHints;
KPluginInfo appletDescription;
Package* package;
AppletOverlayWidget *needsConfigOverlay;
QList<QGraphicsItem*> registeredAsDragHandle;
QStringList loadedEngines;
Plasma::PanelSvg *background;
//Plasma::LineEdit *failureText;
AppletScript *script;
ConfigXml* configXml;
ShadowItem* shadow;
Package *package;
ConfigXml *configXml;
KConfigGroup *mainConfig;
Plasma::Constraints pendingConstraints;
Plasma::AspectRatioMode aspectRatioMode;
@ -101,6 +98,7 @@ public:
KActionCollection actions;
KAction *activationAction;
int constraintsTimerId;
int modificationsTimerId;
bool hasConfigurationInterface : 1;
bool failed : 1;
bool isContainment : 1;