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
This commit is contained in:
Aaron J. Seigo 2008-08-21 02:57:42 +00:00
parent 2c341a5521
commit 9a94a36afd
3 changed files with 17 additions and 6 deletions

View File

@ -1187,13 +1187,16 @@ void Containment::focusPreviousApplet()
} }
void Containment::destroy() void Containment::destroy()
{
destroy(true);
}
void Containment::destroy(bool confirm)
{ {
if (immutability() != Mutable) { if (immutability() != Mutable) {
return; return;
} }
//TODO For desktop containment change we need to remove containment so do we need these?
#if 0
if (isContainment()) { if (isContainment()) {
//don't remove a desktop that's in use //don't remove a desktop that's in use
//FIXME allow removal of containments for screens that don't currently exist //FIXME allow removal of containments for screens that don't currently exist
@ -1210,9 +1213,8 @@ void Containment::destroy()
Applet::destroy(); Applet::destroy();
} }
} else { } else {
#endif
Applet::destroy(); Applet::destroy();
//} }
} }

View File

@ -409,6 +409,15 @@ class PLASMA_EXPORT Containment : public Applet
*/ */
void destroy(); 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: protected:
/** /**
* Sets the type of this containment. * Sets the type of this containment.

View File

@ -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); setContainment(c);
// destroy the old one // destroy the old one
old->destroy(); old->destroy(false);
// and now save the config // and now save the config
containmentConfig = c->config(); containmentConfig = c->config();