merge-squash of first containment-removal branch

svn path=/trunk/KDE/kdelibs/; revision=1027320
This commit is contained in:
Chani Armitage 2009-09-23 20:37:17 +00:00
parent b363df741e
commit ba3b1b753b
4 changed files with 20 additions and 14 deletions

View File

@ -514,7 +514,19 @@ void AppletPrivate::cleanUpAndDelete()
resetConfigurationObject();
QGraphicsScene *s = q->scene();
q->scene()->removeItem(q);
kDebug();
//a hack to try and avoid crashes. doesn't seem to work.
QGraphicsItem *f = s->focusItem();
if (f) {
QGraphicsItem *top = f->topLevelItem();
kDebug() << "focus exists" << top;
if (top == q) {
kDebug() << "clearing focus";
s->setFocusItem(0);
}
}
q->deleteLater();
}

View File

@ -1947,16 +1947,6 @@ void Containment::destroy(bool confirm)
}
if (isContainment()) {
//don't remove a desktop that's in use
//FIXME: this should probably be based on whether any views care or not!
// sth like: foreach (view) { view->requires(this); }
Q_ASSERT(corona());
if (d->type != PanelContainment && d->type != CustomPanelContainment &&
(d->screen != -1 || d->screen >= corona()->numScreens())) {
kDebug() << (QObject*)this << "containment has a screen number?" << d->screen;
return;
}
//FIXME maybe that %1 should be the containment type not the name
if (!confirm ||
KMessageBox::warningContinueCancel(
@ -2047,10 +2037,7 @@ void ContainmentPrivate::handleDisappeared(AppletHandle *handle)
void ContainmentPrivate::checkRemoveAction()
{
q->enableAction("remove", (q->immutability() == Mutable &&
(screen == -1 ||
type == Plasma::Containment::PanelContainment ||
type == Plasma::Containment::CustomPanelContainment)));
q->enableAction("remove", q->immutability() == Mutable);
}
void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constraints)

View File

@ -93,6 +93,7 @@ public:
void containmentDestroyed()
{
containment = 0;
emit q->lostContainment();
}
void containmentScreenChanged(int wasScreen, int newScreen, Plasma::Containment *containment)

6
view.h
View File

@ -178,6 +178,12 @@ Q_SIGNALS:
*/
void sceneRectChanged();
/**
* This is emitted after the containment is destroyed, for views that need to do something about
* it (like find a new one).
*/
void lostContainment();
public Q_SLOTS:
/**
* Sets the containment for this view, which will also cause the view