use notifications actions to undo
Change-Id: I4b9abf6047b94b4fc13aad672d1bc8e97203f502
This commit is contained in:
parent
5252020318
commit
af6149c9d0
@ -58,6 +58,7 @@ find_package(KF5KIO ${KF5_DEP_VERSION} REQUIRED)
|
|||||||
find_package(KF5Service ${KF5_DEP_VERSION} REQUIRED)
|
find_package(KF5Service ${KF5_DEP_VERSION} REQUIRED)
|
||||||
find_package(KF5WindowSystem ${KF5_DEP_VERSION} REQUIRED)
|
find_package(KF5WindowSystem ${KF5_DEP_VERSION} REQUIRED)
|
||||||
find_package(KF5XmlGui ${KF5_DEP_VERSION} REQUIRED)
|
find_package(KF5XmlGui ${KF5_DEP_VERSION} REQUIRED)
|
||||||
|
find_package(KF5Notifications ${KF5_DEP_VERSION} REQUIRED)
|
||||||
|
|
||||||
find_package(KF5DocTools ${KF5_DEP_VERSION})
|
find_package(KF5DocTools ${KF5_DEP_VERSION})
|
||||||
set_package_properties(KF5DocTools PROPERTIES DESCRIPTION "Tools to generate documentation"
|
set_package_properties(KF5DocTools PROPERTIES DESCRIPTION "Tools to generate documentation"
|
||||||
|
@ -125,6 +125,7 @@ PRIVATE
|
|||||||
KF5::Declarative #runtimePlatform
|
KF5::Declarative #runtimePlatform
|
||||||
KF5::XmlGui #KActionCollection
|
KF5::XmlGui #KActionCollection
|
||||||
KF5::GlobalAccel #Applet::setGlobalShortcut
|
KF5::GlobalAccel #Applet::setGlobalShortcut
|
||||||
|
KF5::Notifications
|
||||||
${PLASMA_EXTRA_LIBS}
|
${PLASMA_EXTRA_LIBS}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -201,6 +202,7 @@ install(FILES
|
|||||||
install(FILES data/operations/dataengineservice.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
|
install(FILES data/operations/dataengineservice.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
|
||||||
install(FILES data/operations/plasmoidservice.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
|
install(FILES data/operations/plasmoidservice.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
|
||||||
install(FILES data/operations/storage.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
|
install(FILES data/operations/storage.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
|
||||||
|
install(FILES data/notifications/plasmashell.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||||
|
|
||||||
install(TARGETS KF5Plasma EXPORT KF5PlasmaTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS KF5Plasma EXPORT KF5PlasmaTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
|
|
||||||
|
9
src/plasma/data/notifications/plasmashell.notifyrc
Normal file
9
src/plasma/data/notifications/plasmashell.notifyrc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Global]
|
||||||
|
IconName=plasma
|
||||||
|
Comment=Plasma
|
||||||
|
Name=plasmashell
|
||||||
|
|
||||||
|
[Event/plasmoidDeleted]
|
||||||
|
Name=Plasmoid deleted
|
||||||
|
Comment=A plasmoid has been deleted
|
||||||
|
Action=Popup
|
@ -35,6 +35,7 @@
|
|||||||
#include <kglobalaccel.h>
|
#include <kglobalaccel.h>
|
||||||
#include <KConfigLoader>
|
#include <KConfigLoader>
|
||||||
#include <KServiceTypeTrader>
|
#include <KServiceTypeTrader>
|
||||||
|
#include <knotification.h>
|
||||||
|
|
||||||
#include "containment.h"
|
#include "containment.h"
|
||||||
#include "corona.h"
|
#include "corona.h"
|
||||||
@ -225,6 +226,17 @@ void AppletPrivate::askDestroy()
|
|||||||
cleanUpAndDelete();
|
cleanUpAndDelete();
|
||||||
} else {
|
} else {
|
||||||
q->setStatus(Types::AwaitingDeletionStatus);
|
q->setStatus(Types::AwaitingDeletionStatus);
|
||||||
|
KNotification *notification = new KNotification("plasmoidDeleted", KNotification::Persistent |
|
||||||
|
KNotification::CloseWhenWidgetActivated, q);
|
||||||
|
QStringList actions;
|
||||||
|
notification->setText(i18n("The widget \"%1\" has been deleted.", q->title()));
|
||||||
|
actions.append(i18n("Undo"));
|
||||||
|
notification->setActions(actions);
|
||||||
|
QObject::connect(notification, &KNotification::action1Activated,
|
||||||
|
[=]() {
|
||||||
|
q->setStatus(Types::PassiveStatus);
|
||||||
|
});
|
||||||
|
notification->sendEvent();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (q->isContainment()) {
|
if (q->isContainment()) {
|
||||||
@ -246,8 +258,6 @@ void AppletPrivate::askDestroy()
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletPrivate::globalShortcutChanged()
|
void AppletPrivate::globalShortcutChanged()
|
||||||
|
Loading…
Reference in New Issue
Block a user