summaryrefslogtreecommitdiffstats
path: root/k9devices/k9cddrive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'k9devices/k9cddrive.cpp')
-rw-r--r--k9devices/k9cddrive.cpp105
1 files changed, 21 insertions, 84 deletions
diff --git a/k9devices/k9cddrive.cpp b/k9devices/k9cddrive.cpp
index d1ed25e..64cf50d 100644
--- a/k9devices/k9cddrive.cpp
+++ b/k9devices/k9cddrive.cpp
@@ -14,13 +14,8 @@
#include "k9config.h"
#include "k9tools.h"
-#ifdef HAVE_HAL
-#include "k9halconnection.h"
-#include "k9haldevice.h"
-#else
#include <k3bdevice.h>
#include <k3bdevicemanager.h>
-#endif
#include <kprocess.h>
k9CdDrive::k9CdDrive() {
@@ -29,101 +24,43 @@ k9CdDrive::k9CdDrive() {
canWriteDVD=false;
device="";
name="";
- #ifdef HAVE_HAL
- m_Device=NULL;
- #endif
}
k9CdDrive::~k9CdDrive() {}
k9CdDrives::k9CdDrives():TQObject( 0,0) {
drives.setAutoDelete(true);
- #ifdef HAVE_HAL
- m_connection=k9HalConnection::getInstance();
- connect(m_connection,TQT_SIGNAL(deviceAdded( k9HalDevice* )),this,TQT_SLOT(deviceAdded( k9HalDevice* )));
- connect(m_connection,TQT_SIGNAL(deviceRemoved( k9HalDevice* )),this,TQT_SLOT(deviceRemoved( k9HalDevice*)));
- #else
- m_devMgr=new K3bDevice::DeviceManager(this);
-
- #endif
+ m_devMgr=new K3bDevice::DeviceManager(this);
scanDrives();
}
k9CdDrives::~k9CdDrives() {
- #ifdef HAVE_HAL
- m_connection->end();
- #else
delete m_devMgr;
- #endif
}
-void k9CdDrives::deviceAdded( k9HalDevice *_device) {
-#ifdef HAVE_HAL
- addDrive( _device);
-#endif
-}
-
-void k9CdDrives::deviceRemoved(k9HalDevice *_device) {
-#ifdef HAVE_HAL
- for (k9CdDrive *d=drives.first();d;d=drives.next()) {
- if (d->getDevice()==_device) {
- emit deviceRemoved( d);
- drives.remove(d);
- break;
- }
- }
-#endif
-}
-#ifdef HAVE_HAL
-void k9CdDrives::addDrive(k9HalDevice *_device) {
- k9CdDrive *drive=new k9CdDrive;
- drive->setDevice( _device);
- drive->canReadDVD=_device->getCanReadDvd();
- drive->canWriteDVD=_device->getCanBurnDvd();
- drive->canWriteCDR=_device->getCanBurnCd();
- drive->device=_device->getDeviceName();
- drive->name=_device->getModel();
- TQValueList <int> writeSpeeds;
- for (int i=2;i <=_device->getMaxWriteSpeed()/1385;i+=2)
- writeSpeeds.append( i);
- drive->setWriteSpeeds(writeSpeeds);
- drives.append(drive);
- emit deviceAdded( drive);
-
-}
-#endif
-
/** No descriptions */
void k9CdDrives::scanDrives() {
drives.clear();
- #ifdef HAVE_HAL
- TQPtrList <k9HalDevice> list=m_connection->getDevices();
-
- for (k9HalDevice *hdrive=list.first();hdrive;hdrive=list.next()) {
- addDrive(hdrive);
- }
- #else
- m_devMgr->scanBus();
- int row=0;
- TQPtrList <K3bDevice::Device> lDev=m_devMgr->allDevices();
- for (K3bDevice::Device *dev=lDev.first();dev;dev=lDev.next()) {
- k9CdDrive *drive=new k9CdDrive;
- drive->device=dev->blockDeviceName();
- drive->name=dev->description();
- drive->canReadDVD=dev->readsDvd();
- drive->canWriteCDR=dev->writesCd();
- drive->canWriteDVD=dev->writesDvd();
- TQValueList <int> writeSpeeds;
- for (int i=2;i <=dev->determineMaximalWriteSpeed()/1385;i+=2)
- writeSpeeds.append( i);
- drive->setWriteSpeeds(writeSpeeds);
-
- drive->num=row;
- drives.append(drive);
- row++;
- emit deviceAdded(drive);
- }
+ m_devMgr->scanBus();
+ int row=0;
+ TQPtrList <K3bDevice::Device> lDev=m_devMgr->allDevices();
+ for (K3bDevice::Device *dev=lDev.first();dev;dev=lDev.next()) {
+ k9CdDrive *drive=new k9CdDrive;
+ drive->device=dev->blockDeviceName();
+ drive->name=dev->description();
+ drive->canReadDVD=dev->readsDvd();
+ drive->canWriteCDR=dev->writesCd();
+ drive->canWriteDVD=dev->writesDvd();
+ TQValueList <int> writeSpeeds;
+ for (int i=2;i <=dev->determineMaximalWriteSpeed()/1385;i+=2)
+ writeSpeeds.append( i);
+ drive->setWriteSpeeds(writeSpeeds);
+
+ drive->num=row;
+ drives.append(drive);
+ row++;
+ emit deviceAdded(drive);
+ }
- #endif
readConfig();
}