Make the delete containment dialog async
a syncronous dialog brings crashes if something gets deleted while the dialog's event loop is in execution BUG:332027
This commit is contained in:
parent
62d35541ed
commit
d397358346
@ -30,6 +30,7 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QList>
|
||||
#include <QAbstractButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <kactioncollection.h>
|
||||
@ -255,10 +256,18 @@ void Applet::destroy()
|
||||
}
|
||||
|
||||
if (isContainment()) {
|
||||
if (QMessageBox::warning(0, i18nc("@title:window %1 is the name of the containment", "Remove %1", title()), i18nc("%1 is the name of the containment", "Do you really want to remove this %1?", title()), QMessageBox::StandardButtons( QMessageBox::Yes | QMessageBox::No ), QMessageBox::No) != QMessageBox::Yes) {
|
||||
QMessageBox *box = new QMessageBox(QMessageBox::Warning, i18nc("@title:window %1 is the name of the containment", "Remove %1", title()), i18nc("%1 is the name of the containment", "Do you really want to remove this %1?", title()), QMessageBox::StandardButtons( QMessageBox::Yes | QMessageBox::No ));
|
||||
box->setWindowFlags((Qt::WindowFlags)(box->windowFlags() | Qt::WA_DeleteOnClose));
|
||||
box->open();
|
||||
|
||||
connect(box->button(QMessageBox::Yes), &QAbstractButton::clicked,
|
||||
[=] () {
|
||||
d->transient = true;
|
||||
d->cleanUpAndDelete();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
d->transient = true;
|
||||
//FIXME: an animation on leave if !isContainment() would be good again .. which should be handled by the containment class
|
||||
|
Loading…
Reference in New Issue
Block a user