File k3b-dvdformatting_umount.diff of Package k3b

--- libk3b/jobs/k3bdvdformattingjob.cpp
+++ libk3b/jobs/k3bdvdformattingjob.cpp
@@ -29,6 +29,8 @@
 #include <klocale.h>
 #include <kdebug.h>
 
+#include <kio/job.h>
+
 #include <qvaluelist.h>
 #include <qregexp.h>
 
@@ -118,6 +120,18 @@
     return;
   }
 
+  kdDebug() << "(k3bDvdFormattingJob) Device: " << d->device->mountDevice() << endl;
+  if ( !d->device->mountPoint().isEmpty() ) {
+    // emit infoMessage ( i18n("Unmounting disk"), INFO );
+    // umount the dvd
+    connect( KIO::unmount( d->device->mountPoint(), false ), SIGNAL(result(KIO::Job*)), this, SLOT(slotStartDvdErasing()) );
+  } else {
+    slotStartDvdErasing();
+  }
+}
+
+void K3bDvdFormattingJob::slotStartDvdErasing()
+{
   //
   // first wait for a dvd+rw or dvd-rw
   // Be aware that an empty DVD-RW might be reformatted to another writing mode
--- libk3b/jobs/k3bdvdformattingjob.h
+++ libk3b/jobs/k3bdvdformattingjob.h
@@ -77,6 +77,7 @@
   void slotProcessFinished( KProcess* );
   void slotDeviceHandlerFinished( K3bDevice::DeviceHandler* );
   void slotEjectingFinished( K3bDevice::DeviceHandler* );
+  void slotStartDvdErasing();
 
  private:
   class Private;
openSUSE Build Service is sponsored by