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

View File

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