Added option to enable/disable Device Monitor notification panels when

disks are added/removed/changed status.
Minor tweak to menu entry in Device Monitor popup menu.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/192/head
Michele Calgaro 3 years ago
parent 5d9c673999
commit 434983acd9
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -206,7 +206,7 @@ void HwDeviceSystemTray::contextMenuAboutToShow(TDEPopupMenu* menu) {
menu->insertTitle(SmallIcon("configure"), i18n("Global Configuration"));
TDEAction *actHardwareConfig = new TDEAction(i18n("Configure Devices..."), SmallIconSet("kcmpci"), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT(slotHardwareConfig()), actionCollection());
TDEAction *actHardwareConfig = new TDEAction(i18n("Show Device Manager..."), SmallIconSet("kcmpci"), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT(slotHardwareConfig()), actionCollection());
actHardwareConfig->plug(menu);
TDEAction *actShortcutKeys = new TDEAction(i18n("Configure Shortcut Keys..."), SmallIconSet("configure"), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT(slotEditShortcutKeys()), actionCollection());
@ -637,17 +637,25 @@ void HwDeviceSystemTray::slotEditShortcutKeys() {
void HwDeviceSystemTray::deviceAdded(TDEGenericDevice* device) {
#ifdef __TDE_HAVE_TDEHWLIB
if (device->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
if (isMonitoredDevice(sdevice)) {
TQString uuid = sdevice->diskUUID();
if (uuid == "") {
uuid = sdevice->systemPath();
TDEConfig config("mediamanagerrc");
config.setGroup("Global");
if (config.readBoolEntry("DeviceMonitorPopupsEnabled", true))
{
if (device->type() == TDEGenericDeviceType::Disk)
{
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
if (isMonitoredDevice(sdevice))
{
TQString uuid = sdevice->diskUUID();
if (uuid == "")
{
uuid = sdevice->systemPath();
}
m_hardwareNotifierContainer->displayMessage(
i18n("A disk device has been added!"),
i18n("%1 (%2)").arg(sdevice->friendlyName(), sdevice->deviceNode()), SmallIcon("drive-harddisk-unmounted"),
0, 0, "ADD: " + uuid);
}
m_hardwareNotifierContainer->displayMessage(
i18n("A disk device has been added!"),
i18n("%1 (%2)").arg(sdevice->friendlyName(), sdevice->deviceNode()), SmallIcon("drive-harddisk-unmounted"),
0, 0, "ADD: " + uuid);
}
}
#endif
@ -655,17 +663,25 @@ void HwDeviceSystemTray::deviceAdded(TDEGenericDevice* device) {
void HwDeviceSystemTray::deviceRemoved(TDEGenericDevice* device) {
#ifdef __TDE_HAVE_TDEHWLIB
if (device->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
if (isMonitoredDevice(sdevice)) {
TQString uuid = sdevice->diskUUID();
if (uuid == "") {
uuid = sdevice->systemPath();
TDEConfig config("mediamanagerrc");
config.setGroup("Global");
if (config.readBoolEntry("DeviceMonitorPopupsEnabled", true))
{
if (device->type() == TDEGenericDeviceType::Disk)
{
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
if (isMonitoredDevice(sdevice))
{
TQString uuid = sdevice->diskUUID();
if (uuid == "")
{
uuid = sdevice->systemPath();
}
m_hardwareNotifierContainer->displayMessage(
i18n("A disk device has been removed!"),
i18n("%1 (%2)").arg(sdevice->friendlyName(), sdevice->deviceNode()), SmallIcon("drive-harddisk-unmounted"),
0, 0, "REMOVE: " + uuid);
}
m_hardwareNotifierContainer->displayMessage(
i18n("A disk device has been removed!"),
i18n("%1 (%2)").arg(sdevice->friendlyName(), sdevice->deviceNode()), SmallIcon("drive-harddisk-unmounted"),
0, 0, "REMOVE: " + uuid);
}
}
#endif
@ -673,17 +689,25 @@ void HwDeviceSystemTray::deviceRemoved(TDEGenericDevice* device) {
void HwDeviceSystemTray::deviceChanged(TDEGenericDevice* device) {
#ifdef __TDE_HAVE_TDEHWLIB
if (device->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
if (isMonitoredDevice(sdevice)) {
TQString uuid = sdevice->diskUUID();
if (uuid == "") {
uuid = sdevice->systemPath();
TDEConfig config("mediamanagerrc");
config.setGroup("Global");
if (config.readBoolEntry("DeviceMonitorPopupsEnabled", true))
{
if (device->type() == TDEGenericDeviceType::Disk)
{
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
if (isMonitoredDevice(sdevice))
{
TQString uuid = sdevice->diskUUID();
if (uuid == "")
{
uuid = sdevice->systemPath();
}
m_hardwareNotifierContainer->displayMessage(
i18n("A disk device has been changed!"),
i18n("%1 (%2)").arg(sdevice->friendlyName(), sdevice->deviceNode()), SmallIcon("drive-harddisk-unmounted"),
0, 0, "CHANGE: " + uuid);
}
m_hardwareNotifierContainer->displayMessage(
i18n("A disk device has been changed!"),
i18n("%1 (%2)").arg(sdevice->friendlyName(), sdevice->deviceNode()), SmallIcon("drive-harddisk-unmounted"),
0, 0, "CHANGE: " + uuid);
}
}
#endif

@ -25,8 +25,13 @@
<default>true</default>
</entry>
<entry name="NotificationPopupsEnabled" type="Bool">
<label>Enable notification popups</label>
<whatsthis>Deselect this if you do not want action request popups to be generated when devices are plugged in.</whatsthis>
<label>Enable notification dialogs popups</label>
<whatsthis>Deselect this if you do not want action request dialog popups to be generated when devices are plugged in.</whatsthis>
<default>true</default>
</entry>
<entry name="DeviceMonitorPopupsEnabled" type="Bool">
<label>Enable device monitor notification popups</label>
<whatsthis>Deselect this if you do not want device monitoring popups to be generated when devices are added, modified or removed.</whatsthis>
<default>true</default>
</entry>
</group>

@ -63,6 +63,17 @@
<string>Deselect this if you do not want action request dialog popups to be generated when devices are plugged in.</string>
</property>
</widget>
<widget class="TQCheckBox">
<property name="name">
<cstring>kcfg_DeviceMonitorPopupsEnabled</cstring>
</property>
<property name="text">
<string>Enable device monitor notification popups</string>
</property>
<property name="whatsThis" stdset="0">
<string>Deselect this if you do not want device monitoring popups to be generated when devices are added, modified or removed.</string>
</property>
</widget>
<widget class="TQGroupBox">
<property name="name">
<cstring>groupbox_mount</cstring>
@ -350,6 +361,7 @@ Display the short name as is; store a long name when the short name is not all u
<tabstop>kcfg_CdPollingEnabled</tabstop>
<tabstop>kcfg_AutostartEnabled</tabstop>
<tabstop>kcfg_NotificationPopupsEnabled</tabstop>
<tabstop>kcfg_DeviceMonitorPopupsEnabled</tabstop>
<tabstop>option_automount</tabstop>
<tabstop>option_ro</tabstop>
<tabstop>option_quiet</tabstop>

Loading…
Cancel
Save