never show the dialog on destroy()
the remove action is now hooked to another slot, askDestroy() it *MAY* solve the "Do you wish to remove this default desktop" bug, or may get it worse CCBUG:332137
This commit is contained in:
parent
0205aa1ec6
commit
614af69f02
@ -255,20 +255,6 @@ void Applet::destroy()
|
||||
return; //don't double delete
|
||||
}
|
||||
|
||||
if (isContainment()) {
|
||||
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
|
||||
d->cleanUpAndDelete();
|
||||
@ -480,7 +466,7 @@ void Applet::flushPendingConstraintsEvents()
|
||||
if (closeApplet) {
|
||||
closeApplet->setEnabled(unlocked);
|
||||
closeApplet->setVisible(unlocked);
|
||||
connect(closeApplet, SIGNAL(triggered(bool)), this, SLOT(destroy()), Qt::UniqueConnection);
|
||||
connect(closeApplet, SIGNAL(triggered(bool)), this, SLOT(askDestroy()), Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
QAction *configAction = d->actions->action("configure");
|
||||
|
@ -589,6 +589,7 @@ class PLASMA_EXPORT Applet : public QObject
|
||||
Applet(const QString &packagePath, uint appletId);
|
||||
|
||||
Q_PRIVATE_SLOT(d, void cleanUpAndDelete())
|
||||
Q_PRIVATE_SLOT(d, void askDestroy())
|
||||
Q_PRIVATE_SLOT(d, void updateShortcuts())
|
||||
Q_PRIVATE_SLOT(d, void globalShortcutChanged())
|
||||
Q_PRIVATE_SLOT(d, void propagateConfigChanged())
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <qstandardpaths.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
#include <kiconloader.h>
|
||||
#include <klocalizedstring.h>
|
||||
#include <kkeysequencewidget.h>
|
||||
@ -180,6 +181,30 @@ void AppletPrivate::showConfigurationRequiredMessage(bool show, const QString &r
|
||||
Q_UNUSED(reason)
|
||||
}
|
||||
|
||||
void AppletPrivate::askDestroy()
|
||||
{
|
||||
if (q->immutability() != Types::Mutable || transient || !started) {
|
||||
return; //don't double delete
|
||||
}
|
||||
|
||||
if (q->isContainment()) {
|
||||
QMessageBox *box = new QMessageBox(QMessageBox::Warning, i18nc("@title:window %1 is the name of the containment", "Remove %1", q->title()), i18nc("%1 is the name of the containment", "Do you really want to remove this %1?", q->title()), QMessageBox::StandardButtons( QMessageBox::Yes | QMessageBox::No ));
|
||||
box->setWindowFlags((Qt::WindowFlags)(box->windowFlags() | Qt::WA_DeleteOnClose));
|
||||
box->open();
|
||||
|
||||
QObject::connect(box->button(QMessageBox::Yes), &QAbstractButton::clicked,
|
||||
[=] () {
|
||||
transient = true;
|
||||
cleanUpAndDelete();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
transient = true;
|
||||
cleanUpAndDelete();
|
||||
}
|
||||
|
||||
void AppletPrivate::globalShortcutChanged()
|
||||
{
|
||||
if (!activationAction) {
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
|
||||
// the interface
|
||||
virtual void showConfigurationRequiredMessage(bool show, const QString &reason);
|
||||
void askDestroy();
|
||||
virtual void cleanUpAndDelete();
|
||||
|
||||
// put all setup routines for script here. at this point we can assume that
|
||||
|
Loading…
Reference in New Issue
Block a user