* make the layout removal general to all layout types, not just linear layouts
* call the ScriptEngine's config method if we fail on the automatic generation * use an internal timer id to trigger flush updated constraints calls so that if it gets called manually we prevent a future unecessary signal from happening svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=805631
This commit is contained in:
parent
987ca211c7
commit
1b437f7954
35
applet.cpp
35
applet.cpp
@ -257,13 +257,18 @@ void Applet::destroy()
|
|||||||
{
|
{
|
||||||
//kDebug() << "???????????????? DESTROYING APPLET" << name() << " ???????????????????????????";
|
//kDebug() << "???????????????? DESTROYING APPLET" << name() << " ???????????????????????????";
|
||||||
QGraphicsWidget * item = dynamic_cast<QGraphicsWidget *>(parentItem());
|
QGraphicsWidget * item = dynamic_cast<QGraphicsWidget *>(parentItem());
|
||||||
|
|
||||||
//is the applet in a containment and is the containment have a layout? if yes, we remove the applet in the layout
|
//is the applet in a containment and is the containment have a layout? if yes, we remove the applet in the layout
|
||||||
if (item) {
|
if (item && item->layout()) {
|
||||||
QGraphicsLinearLayout * lay = dynamic_cast<QGraphicsLinearLayout *>(item->layout());
|
QGraphicsLayout *l = item->layout();
|
||||||
if (lay) {
|
for (int i = 0; i < l->count(); ++i) {
|
||||||
lay->removeItem(this);
|
if (this == l->itemAt(i)) {
|
||||||
|
l->removeAt(i);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (d->configXml) {
|
if (d->configXml) {
|
||||||
d->configXml->setDefaults();
|
d->configXml->setDefaults();
|
||||||
}
|
}
|
||||||
@ -616,6 +621,11 @@ void Applet::flushPendingConstraintsEvents()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d->constraintsTimerId) {
|
||||||
|
killTimer(d->constraintsTimerId);
|
||||||
|
d->constraintsTimerId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
|
//kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
|
||||||
Plasma::Constraints c = d->pendingConstraints;
|
Plasma::Constraints c = d->pendingConstraints;
|
||||||
d->pendingConstraints = NoConstraint;
|
d->pendingConstraints = NoConstraint;
|
||||||
@ -908,6 +918,10 @@ void Applet::showConfigurationInterface()
|
|||||||
QFile f(uiFile);
|
QFile f(uiFile);
|
||||||
if (!f.open(QIODevice::ReadOnly)) {
|
if (!f.open(QIODevice::ReadOnly)) {
|
||||||
delete dialog;
|
delete dialog;
|
||||||
|
|
||||||
|
if (d->script) {
|
||||||
|
d->script->showConfigurationInterface();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1122,6 +1136,14 @@ QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
|
|||||||
return hint;
|
return hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Applet::timerEvent(QTimerEvent *event)
|
||||||
|
{
|
||||||
|
if (event->timerId() == d->constraintsTimerId) {
|
||||||
|
d->constraintsTimerId = 0;
|
||||||
|
flushPendingConstraintsEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Applet::setGeometry(const QRectF& geometry)
|
void Applet::setGeometry(const QRectF& geometry)
|
||||||
{
|
{
|
||||||
QRectF beforeGeom = QGraphicsWidget::geometry();
|
QRectF beforeGeom = QGraphicsWidget::geometry();
|
||||||
@ -1189,6 +1211,7 @@ Applet::Private::Private(KService::Ptr service, int uniqueID, Applet *applet)
|
|||||||
pendingConstraints(NoConstraint),
|
pendingConstraints(NoConstraint),
|
||||||
aspectRatioMode(Plasma::KeepAspectRatio),
|
aspectRatioMode(Plasma::KeepAspectRatio),
|
||||||
immutability(Mutable),
|
immutability(Mutable),
|
||||||
|
constraintsTimerId(0),
|
||||||
hasConfigurationInterface(false),
|
hasConfigurationInterface(false),
|
||||||
failed(false),
|
failed(false),
|
||||||
isContainment(false),
|
isContainment(false),
|
||||||
@ -1314,8 +1337,8 @@ QString Applet::Private::instanceName()
|
|||||||
|
|
||||||
void Applet::Private::scheduleConstraintsUpdate(Plasma::Constraints c)
|
void Applet::Private::scheduleConstraintsUpdate(Plasma::Constraints c)
|
||||||
{
|
{
|
||||||
if (pendingConstraints == NoConstraint) {
|
if (!constraintsTimerId) {
|
||||||
QTimer::singleShot(0, q, SLOT(flushPendingConstraintsEvents()));
|
constraintsTimerId = q->startTimer(0);
|
||||||
}
|
}
|
||||||
pendingConstraints |= c;
|
pendingConstraints |= c;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user