From 9a94a36afd6f24424a057c5c578c2ad3e75203c0 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Thu, 21 Aug 2008 02:57:42 +0000 Subject: [PATCH] introduce a detroy(bool confirm) for containments so that we can confirm on zoom out, but not on containment swapping; was not a pleasant surprise to have a containment instantly evaporated without this =/ svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=850224 --- containment.cpp | 10 ++++++---- containment.h | 9 +++++++++ view.cpp | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) 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();