very basic prototype for delete undo

the idea is to just hide applets at first and then offer a really delete and undo buttons

Change-Id: I4d869cb58f5c0fb0163d5d4d6b265af860d8727e
This commit is contained in:
Marco Martin 2014-10-22 16:59:59 +02:00
parent cfd29dec88
commit f8ba97ae3e
4 changed files with 15 additions and 4 deletions

View File

@ -253,7 +253,8 @@ public:
ActiveStatus = 2, /**< The Item is active **/
NeedsAttentionStatus = 3, /**< The Item needs attention **/
RequiresAttentionStatus = 4, /**< The Item needs persistent attention **/
AcceptingInputStatus = 5 /**< The Item is accepting input **/
AcceptingInputStatus = 5, /**< The Item is accepting input **/
AwaitingDeletionStatus = -1 /**< The user asked to delete this applet*/
};
Q_ENUMS(ItemStatus)

View File

@ -220,6 +220,13 @@ void AppletPrivate::askDestroy()
return; //don't double delete
}
if (itemStatus == Types::AwaitingDeletionStatus) {
transient = true;
cleanUpAndDelete();
} else {
q->setStatus(Types::AwaitingDeletionStatus);
}
/*
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));
@ -238,10 +245,9 @@ void AppletPrivate::askDestroy()
});
return;
}
}*/
transient = true;
cleanUpAndDelete();
}
void AppletPrivate::globalShortcutChanged()

View File

@ -115,6 +115,9 @@ void ContainmentPrivate::configChanged()
void ContainmentPrivate::checkStatus(Plasma::Types::ItemStatus appletStatus)
{
if (appletStatus == Types::AwaitingDeletionStatus) {
return;
}
//qDebug() << "================== "<< appletStatus << q->status();
if (appletStatus == q->status()) {
emit q->statusChanged(appletStatus);

View File

@ -72,6 +72,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariant
connect(applet(), &Plasma::Applet::statusChanged,
this, &AppletInterface::statusChanged);
connect(applet(), &Plasma::Applet::activated,
this, &AppletInterface::activated);