diff --git a/containment.cpp b/containment.cpp index 3b3a68ace..934a52bb1 100644 --- a/containment.cpp +++ b/containment.cpp @@ -1187,13 +1187,16 @@ void Containment::focusPreviousApplet() } void Containment::destroy() +{ + destroy(true); +} + +void Containment::destroy(bool confirm) { if (immutability() != Mutable) { return; } - //TODO For desktop containment change we need to remove containment so do we need these? - #if 0 if (isContainment()) { //don't remove a desktop that's in use //FIXME allow removal of containments for screens that don't currently exist @@ -1210,9 +1213,8 @@ void Containment::destroy() Applet::destroy(); } } else { - #endif Applet::destroy(); - //} + } } diff --git a/containment.h b/containment.h index 7fae76f9b..9f371512d 100644 --- a/containment.h +++ b/containment.h @@ -409,6 +409,15 @@ class PLASMA_EXPORT Containment : public Applet */ void destroy(); + /** + * Destroys this containment and all its applets (after a confirmation dialog); + * it will be removed nicely and deleted. + * Its configuration will also be deleted. + * + * @arg confirm whether or not confirmation from the user should be requested + */ + void destroy(bool confirm); + protected: /** * Sets the type of this containment. diff --git a/view.cpp b/view.cpp index 8dd7a0742..1c0671865 100644 --- a/view.cpp +++ b/view.cpp @@ -257,11 +257,11 @@ Containment* View::swapContainment(const QString& name, const QVariantList& args } } - // set our containment + // set our containment to the new one setContainment(c); // destroy the old one - old->destroy(); + old->destroy(false); // and now save the config containmentConfig = c->config();