From e1a0d5bb9cf1a5665e6b9f2caa0e57c1c1431131 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Thu, 25 Sep 2008 16:26:04 +0000 Subject: [PATCH] * 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 --- applet.cpp | 20 ++++++++++++++++++-- private/applet_p.h | 10 ++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/applet.cpp b/applet.cpp index ed0777ea8..1ce002035 100644 --- a/applet.cpp +++ b/applet.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -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() diff --git a/private/applet_p.h b/private/applet_p.h index d084ea043..c6a3e17b4 100644 --- a/private/applet_p.h +++ b/private/applet_p.h @@ -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 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;