Fixed building without tdehw and without HAL. This resolves bug 2495.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit cc51bb4eb4)
r14.0.x
Michele Calgaro 3 years ago
parent 76363b1128
commit 225d7c5ae0
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -29,9 +29,7 @@
#include <dbus/connection.h> #include <dbus/connection.h>
#include <dbus/dbus.h> #include <dbus/dbus.h>
#include <hal/libhal.h> #include <hal/libhal.h>
#else // HAVE_HAL #endif
#include <tdehardwaredevices.h>
#endif // HAVE_HAL
#ifdef HAVE_HAL #ifdef HAVE_HAL
static char** qstringListToArray( const TQStringList& s ) static char** qstringListToArray( const TQStringList& s )
@ -615,6 +613,12 @@ void K3bDevice::HalConnection::setupDBusTQtConnection( DBusConnection* dbusConne
#else // HAVE_HAL #else // HAVE_HAL
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#else
#define TDEHardwareDevices void
#endif
K3bDevice::HalConnection* K3bDevice::HalConnection::s_instance = 0; K3bDevice::HalConnection* K3bDevice::HalConnection::s_instance = 0;
@ -674,6 +678,7 @@ bool K3bDevice::HalConnection::isConnected() const
bool K3bDevice::HalConnection::open() bool K3bDevice::HalConnection::open()
{ {
#ifdef __TDE_HAVE_TDEHWLIB
// Initialize the TDE device manager // Initialize the TDE device manager
d->m_hwdevices = TDEGlobal::hardwareDevices(); d->m_hwdevices = TDEGlobal::hardwareDevices();
@ -694,6 +699,9 @@ bool K3bDevice::HalConnection::open()
} }
return true; return true;
#else
return false;
#endif
} }
@ -710,6 +718,7 @@ TQStringList K3bDevice::HalConnection::devices() const
void K3bDevice::HalConnection::AddDeviceHandler(TDEGenericDevice* hwdevice) void K3bDevice::HalConnection::AddDeviceHandler(TDEGenericDevice* hwdevice)
{ {
#ifdef __TDE_HAVE_TDEHWLIB
if (hwdevice->type() != TDEGenericDeviceType::Disk) { if (hwdevice->type() != TDEGenericDeviceType::Disk) {
return; return;
} }
@ -730,10 +739,12 @@ void K3bDevice::HalConnection::AddDeviceHandler(TDEGenericDevice* hwdevice)
} }
} }
} }
#endif
} }
void K3bDevice::HalConnection::RemoveDeviceHandler(TDEGenericDevice* hwdevice) void K3bDevice::HalConnection::RemoveDeviceHandler(TDEGenericDevice* hwdevice)
{ {
#ifdef __TDE_HAVE_TDEHWLIB
if (hwdevice->type() != TDEGenericDeviceType::Disk) { if (hwdevice->type() != TDEGenericDeviceType::Disk) {
return; return;
} }
@ -752,10 +763,12 @@ void K3bDevice::HalConnection::RemoveDeviceHandler(TDEGenericDevice* hwdevice)
emit mediumChanged(blockDevice); emit mediumChanged(blockDevice);
} }
} }
#endif
} }
void K3bDevice::HalConnection::ModifyDeviceHandler(TDEGenericDevice* hwdevice) void K3bDevice::HalConnection::ModifyDeviceHandler(TDEGenericDevice* hwdevice)
{ {
#ifdef __TDE_HAVE_TDEHWLIB
if (hwdevice->type() != TDEGenericDeviceType::Disk) { if (hwdevice->type() != TDEGenericDeviceType::Disk) {
return; return;
} }
@ -767,11 +780,12 @@ void K3bDevice::HalConnection::ModifyDeviceHandler(TDEGenericDevice* hwdevice)
d->deviceMediumUdiMap[blockDevice] = sdevice->mediaInserted(); d->deviceMediumUdiMap[blockDevice] = sdevice->mediaInserted();
emit mediumChanged(blockDevice); emit mediumChanged(blockDevice);
} }
#endif
} }
int K3bDevice::HalConnection::lock(Device* dev) int K3bDevice::HalConnection::lock(Device* dev)
{ {
#ifdef __TDE_HAVE_TDEHWLIB
if (!d->deviceUdiMap.contains(dev->blockDeviceName())) { if (!d->deviceUdiMap.contains(dev->blockDeviceName())) {
return org_freedesktop_Hal_Device_Volume_NoSuchDevice; return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
} }
@ -792,11 +806,15 @@ int K3bDevice::HalConnection::lock(Device* dev)
else { else {
return org_freedesktop_Hal_Device_Volume_InvalidEjectOption; return org_freedesktop_Hal_Device_Volume_InvalidEjectOption;
} }
#else
return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
#endif
} }
int K3bDevice::HalConnection::unlock(Device* dev) int K3bDevice::HalConnection::unlock(Device* dev)
{ {
#ifdef __TDE_HAVE_TDEHWLIB
if (!d->deviceUdiMap.contains(dev->blockDeviceName())) { if (!d->deviceUdiMap.contains(dev->blockDeviceName())) {
return org_freedesktop_Hal_Device_Volume_NoSuchDevice; return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
} }
@ -817,6 +835,9 @@ int K3bDevice::HalConnection::unlock(Device* dev)
else { else {
return org_freedesktop_Hal_Device_Volume_InvalidEjectOption; return org_freedesktop_Hal_Device_Volume_InvalidEjectOption;
} }
#else
return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
#endif
} }
@ -825,6 +846,7 @@ int K3bDevice::HalConnection::mount( K3bDevice::Device* dev,
const TQString& fstype, const TQString& fstype,
const TQStringList& options ) const TQStringList& options )
{ {
#ifdef __TDE_HAVE_TDEHWLIB
if (!d->deviceUdiMap.contains(dev->blockDeviceName())) { if (!d->deviceUdiMap.contains(dev->blockDeviceName())) {
return org_freedesktop_Hal_Device_Volume_NoSuchDevice; return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
} }
@ -849,11 +871,15 @@ int K3bDevice::HalConnection::mount( K3bDevice::Device* dev,
else { else {
return org_freedesktop_Hal_Success; return org_freedesktop_Hal_Success;
} }
#else
return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
#endif
} }
int K3bDevice::HalConnection::unmount(K3bDevice::Device* dev, const TQStringList& options) int K3bDevice::HalConnection::unmount(K3bDevice::Device* dev, const TQStringList& options)
{ {
#ifdef __TDE_HAVE_TDEHWLIB
if (!d->deviceUdiMap.contains(dev->blockDeviceName())) { if (!d->deviceUdiMap.contains(dev->blockDeviceName())) {
return org_freedesktop_Hal_Device_Volume_NoSuchDevice; return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
} }
@ -879,11 +905,15 @@ int K3bDevice::HalConnection::unmount(K3bDevice::Device* dev, const TQStringList
else { else {
return org_freedesktop_Hal_Success; return org_freedesktop_Hal_Success;
} }
#else
return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
#endif
} }
int K3bDevice::HalConnection::eject(K3bDevice::Device* dev, const TQStringList& options) int K3bDevice::HalConnection::eject(K3bDevice::Device* dev, const TQStringList& options)
{ {
#ifdef __TDE_HAVE_TDEHWLIB
if (!d->deviceUdiMap.contains(dev->blockDeviceName())) { if (!d->deviceUdiMap.contains(dev->blockDeviceName())) {
return org_freedesktop_Hal_Device_Volume_NoSuchDevice; return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
} }
@ -904,6 +934,9 @@ int K3bDevice::HalConnection::eject(K3bDevice::Device* dev, const TQStringList&
else { else {
return org_freedesktop_Hal_Device_Volume_InvalidEjectOption; return org_freedesktop_Hal_Device_Volume_InvalidEjectOption;
} }
#else
return org_freedesktop_Hal_Device_Volume_NoSuchDevice;
#endif
} }
#endif // HAVE_HAL #endif // HAVE_HAL

@ -25,12 +25,16 @@
#include <tqobject.h> #include <tqobject.h>
#include <tqmap.h> #include <tqmap.h>
#include <tqstringlist.h> #include <tqstringlist.h>
#include <kdemacros.h>
#ifdef HAVE_HAL #ifdef HAVE_HAL
class DBusConnection; class DBusConnection;
#else // HAVE_HAL #endif
#ifdef __TDE_HAVE_TDEHWLIB
class TDEGenericDevice; class TDEGenericDevice;
#endif // HAVE_HAL #else
#define TDEGenericDevice void
#endif
namespace K3bDevice { namespace K3bDevice {
@ -165,7 +169,7 @@ namespace K3bDevice {
* \see ErrorCode * \see ErrorCode
*/ */
int unmount( Device*, int unmount( Device*,
const TQStringList& options = TQStringList() ); const TQStringList& options = TQStringList() );
/** /**
* Unmounts a device via HAL * Unmounts a device via HAL
@ -179,25 +183,23 @@ namespace K3bDevice {
* \see ErrorCode * \see ErrorCode
*/ */
int eject( Device*, int eject( Device*,
const TQStringList& options = TQStringList() ); const TQStringList& options = TQStringList() );
#ifndef HAVE_HAL private slots:
private slots: /**
/** * \internal
* \internal */
*/ void AddDeviceHandler(TDEGenericDevice*);
void AddDeviceHandler(TDEGenericDevice*);
/**
/** * \internal
* \internal */
*/ void RemoveDeviceHandler(TDEGenericDevice*);
void RemoveDeviceHandler(TDEGenericDevice*);
/**
/** * \internal
* \internal */
*/ void ModifyDeviceHandler(TDEGenericDevice*);
void ModifyDeviceHandler(TDEGenericDevice*);
#endif // HAVE_HAL
signals: signals:
/** /**

Loading…
Cancel
Save