sort these out so we can look at them later for possible streamlining
svn path=/trunk/KDE/kdelibs/; revision=979909
This commit is contained in:
parent
5cbc9e157d
commit
1e4a7ee457
34
applet.cpp
34
applet.cpp
@ -1972,6 +1972,24 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ItemParentChange:
|
||||||
|
if (d->mainConfig && !d->isContainment &&
|
||||||
|
!containment() &&
|
||||||
|
dynamic_cast<Containment*>(value.value<QGraphicsItem *>())) {
|
||||||
|
// if this is an applet, and we've just been assigned to our first containment,
|
||||||
|
// but the applet did something stupid like ask for the config() object prior to
|
||||||
|
// this happening (e.g. inits ctor) then let's repair that situation for them.
|
||||||
|
kWarning() << "Configuration object was requested prior to init(), which is too early. "
|
||||||
|
"Please fix this item:" << parentItem() << value.value<QGraphicsItem *>()
|
||||||
|
<< name();
|
||||||
|
KConfigGroup *old = d->mainConfig;
|
||||||
|
KConfigGroup appletConfig = dynamic_cast<Containment*>(value.value<QGraphicsItem *>())->config();
|
||||||
|
appletConfig = KConfigGroup(&appletConfig, "Applets");
|
||||||
|
d->mainConfig = new KConfigGroup(&appletConfig, QString::number(d->appletId));
|
||||||
|
old->copyTo(d->mainConfig);
|
||||||
|
old->deleteGroup();
|
||||||
|
delete old;
|
||||||
|
}
|
||||||
case ItemPositionChange:
|
case ItemPositionChange:
|
||||||
return (immutability() == Mutable || isContainment() || formFactor() == Horizontal || formFactor() == Vertical) ? value : pos();
|
return (immutability() == Mutable || isContainment() || formFactor() == Horizontal || formFactor() == Vertical) ? value : pos();
|
||||||
break;
|
break;
|
||||||
@ -2124,23 +2142,23 @@ bool Applet::isContainment() const
|
|||||||
AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet)
|
AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet)
|
||||||
: appletId(uniqueID),
|
: appletId(uniqueID),
|
||||||
q(applet),
|
q(applet),
|
||||||
extender(0),
|
|
||||||
backgroundHints(Applet::StandardBackground),
|
backgroundHints(Applet::StandardBackground),
|
||||||
|
aspectRatioMode(Plasma::KeepAspectRatio),
|
||||||
|
immutability(Mutable),
|
||||||
appletDescription(service),
|
appletDescription(service),
|
||||||
messageOverlay(0),
|
extender(0),
|
||||||
busyWidget(0),
|
|
||||||
background(0),
|
background(0),
|
||||||
|
mainConfig(0),
|
||||||
|
pendingConstraints(NoConstraint),
|
||||||
|
messageOverlay(0),
|
||||||
|
messageOverlayProxy(0),
|
||||||
|
busyWidget(0),
|
||||||
script(0),
|
script(0),
|
||||||
package(0),
|
package(0),
|
||||||
configLoader(0),
|
configLoader(0),
|
||||||
mainConfig(0),
|
|
||||||
pendingConstraints(NoConstraint),
|
|
||||||
aspectRatioMode(Plasma::KeepAspectRatio),
|
|
||||||
immutability(Mutable),
|
|
||||||
actions(AppletPrivate::defaultActions(applet)),
|
actions(AppletPrivate::defaultActions(applet)),
|
||||||
activationAction(0),
|
activationAction(0),
|
||||||
shortcutEditor(0),
|
shortcutEditor(0),
|
||||||
messageOverlayProxy(0),
|
|
||||||
constraintsTimerId(0),
|
constraintsTimerId(0),
|
||||||
modificationsTimerId(-1),
|
modificationsTimerId(-1),
|
||||||
hasConfigurationInterface(false),
|
hasConfigurationInterface(false),
|
||||||
|
@ -111,27 +111,44 @@ public:
|
|||||||
uint appletId;
|
uint appletId;
|
||||||
Applet *q;
|
Applet *q;
|
||||||
|
|
||||||
Extender *extender;
|
// applet attributes
|
||||||
Applet::BackgroundHints backgroundHints;
|
Applet::BackgroundHints backgroundHints;
|
||||||
KPluginInfo appletDescription;
|
|
||||||
AppletOverlayWidget *messageOverlay;
|
|
||||||
Plasma::BusyWidget *busyWidget;
|
|
||||||
QSet<QGraphicsItem*> registeredAsDragHandle;
|
|
||||||
Plasma::FrameSvg *background;
|
|
||||||
AppletScript *script;
|
|
||||||
QVariantList args;
|
|
||||||
Package *package;
|
|
||||||
ConfigLoader *configLoader;
|
|
||||||
KConfigGroup *mainConfig;
|
|
||||||
Plasma::Constraints pendingConstraints;
|
|
||||||
Plasma::AspectRatioMode aspectRatioMode;
|
Plasma::AspectRatioMode aspectRatioMode;
|
||||||
ImmutabilityType immutability;
|
ImmutabilityType immutability;
|
||||||
|
|
||||||
|
// applet info we keep around in case its needed
|
||||||
|
KPluginInfo appletDescription;
|
||||||
|
QVariantList args;
|
||||||
|
|
||||||
|
// bookkeeping
|
||||||
|
Extender *extender;
|
||||||
|
QSet<QGraphicsItem*> registeredAsDragHandle;
|
||||||
|
Plasma::FrameSvg *background;
|
||||||
|
KConfigGroup *mainConfig;
|
||||||
|
Plasma::Constraints pendingConstraints;
|
||||||
|
|
||||||
|
// overlays and messages
|
||||||
|
AppletOverlayWidget *messageOverlay;
|
||||||
|
QGraphicsProxyWidget *messageOverlayProxy;
|
||||||
|
Plasma::BusyWidget *busyWidget;
|
||||||
|
|
||||||
|
// sripting and package stuff
|
||||||
|
AppletScript *script;
|
||||||
|
Package *package;
|
||||||
|
ConfigLoader *configLoader;
|
||||||
|
|
||||||
|
// actions stuff; put activationAction into actions?
|
||||||
KActionCollection *actions;
|
KActionCollection *actions;
|
||||||
KAction *activationAction;
|
KAction *activationAction;
|
||||||
|
|
||||||
|
// configuration
|
||||||
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
||||||
QGraphicsProxyWidget *messageOverlayProxy;
|
|
||||||
|
// timerEvent bookkeeping
|
||||||
int constraintsTimerId;
|
int constraintsTimerId;
|
||||||
int modificationsTimerId;
|
int modificationsTimerId;
|
||||||
|
|
||||||
|
// a great green field of booleans :)
|
||||||
bool hasConfigurationInterface : 1;
|
bool hasConfigurationInterface : 1;
|
||||||
bool failed : 1;
|
bool failed : 1;
|
||||||
bool isContainment : 1;
|
bool isContainment : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user