Commit 47f79ce6 authored by Nate Graham's avatar Nate Graham
Browse files

[applets/devicenotifier] Play sound when device can be safely removed

Apparently this was a KDE 4 feature that was lost in the Plasma 5 port.

I've re-implemented it using a notification, so it can be turned off or
customized if the user so desires. Kamoso does something similar.

BUG: 384469
FIXED-IN: 5.21
parent 00fee348
......@@ -13,9 +13,11 @@ target_link_libraries(plasma_engine_devicenotifications
KF5::Solid
KF5::I18n
KSysGuard::ProcessCore
KF5::Notifications
) # todo: add kworkspace once ported
kcoreaddons_desktop_to_json(plasma_engine_devicenotifications plasma-dataengine-devicenotifications.desktop)
install(TARGETS plasma_engine_devicenotifications DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/dataengine)
install(FILES plasma-dataengine-devicenotifications.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install(FILES devicenotifications.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
[Global]
Name=Device Notifier
IconName=device-notifier
[Event/safelyRemovable]
Name=Device Status
Sound=Oxygen-Sys-App-Message.ogg
Action=Sound
......@@ -32,6 +32,7 @@
#include <Solid/StorageVolume>
#include <KLocalizedString>
#include <KNotification>
#include <processcore/process.h>
#include <processcore/processes.h>
......@@ -158,6 +159,7 @@ void KSolidNotify::onSolidReply(SolidReplyType type, Solid::ErrorType error, con
switch (error) {
case Solid::ErrorType::NoError:
if (type != SolidReplyType::Setup && isSafelyRemovable(udi)) {
KNotification::event(QStringLiteral("safelyRemovable"), i18n("Device Status"), i18n("A device can now be safely removed"));
errorMsg = i18n("This device can now be safely removed.");
}
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment